🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #188876

c-mode problem (with '\n'?)

#188876
From: Dennis Jespersen
Date: Thu, 30 May 1991 17:25
35 lines
1791 bytes
I am using gnu emacs version 18.55.121 on a NeXT with system software
2.0.  Using the file c-mode.el that comes with the machine
(/usr/lib/emacs/lisp/c-mode.el), there seem to be problems when a
program has things like '\n' in it.  For example, this simple fragment:

/* From K&R I, Chap. 1, p. 17 */

main()
{
  int c, nl;

  nl = 0;
  while ((c=getchar()) != EOF)
    if (c == '\n')
	++nl;
	printf("%d\n", nl);
      }

Emacs complains about unbalanced parentheses and won't properly indent
the code (the indentation given above is what it gives me -- the
printf() line is improperly indented and the final closing brace
really does close the function).  Any suggestions as to the fix?  By
the way, the header information on c-mode.el is:
;; C code editing commands for Emacs
;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
--
Dennis Jespersen
MS 202A-1
NASA Ames Research Center
Moffett Field, CA 94035-1000
Voice: (415) 604-6742
FAX:   (415) 604-1095
email: jesperse@rft28.nas.nasa.gov
We have met the enemy and he is us. -- Pogo
Technical Details
Message-ID: <JESPERSE.91May30112512@rft28.nas.nasa.gov>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!elroy.jpl.nasa.gov!usc!jarthur!nntp-server.caltech.edu!mustang!data.nas.nasa.gov!data!jesperse

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,2d30b5d196612b78,start
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-05-30 16:39:16 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!elroy.jpl.nasa.gov!usc!jarthur!nntp-server.caltech.edu!mustang!data.nas.nasa.gov!data!jesperse
From: jesperse@nas.nasa.gov (Dennis Jespersen)
Newsgroups: gnu.emacs.help
Subject: c-mode problem (with '\n'?)
Summary: c-mode.el has troubles when code has '\n' (for example)
Message-ID: <JESPERSE.91May30112512@rft28.nas.nasa.gov>
Date: 30 May 91 17:25:12 GMT
Sender: news@nas.nasa.gov
Distribution: gnu
Organization: Computational Fluid Dynamics Branch, NASA Ames Research Center
Lines: 35