🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99339

Re: Indentation bug in C mode

#99339
From: Joe Wells
Date: Sat, 29 Sep 1990 09:12
40 lines
1748 bytes
Weening> Emacs 18.55, Sun OS 4.0.3.  In C mode, code such as the following
Weening> doesn't indent correctly:

Weening> main() {
Weening>   while (1) {
Weening>     x = 1;
Weening> #define foo (a+\
Weening> 	     b)
Weening>   y = 2;

Weening> After the continuation line of the #define, Emacs indents two
Weening> columns instead of four as needed in this context.

c-backward-to-noncomment doesn't handle continuation lines properly.
Here's the fix:

*** /usr14/gnu/dist-18.55/lisp/c-mode.el	Fri May 27 21:28:12 1988
--- c-mode.el	Sat Sep 29 05:10:31 1990
***************
*** 500,504 ****
  		 (looking-at "\\*/")))
  	  (search-backward "/*" lim 'move)
! 	(beginning-of-line)
  	(skip-chars-forward " \t")
  	(setq stop (or (not (looking-at "#")) (<= (point) lim)))
--- 500,508 ----
  		 (looking-at "\\*/")))
  	  (search-backward "/*" lim 'move)
! 	(while (progn
! 		 (beginning-of-line)
! 		 (eq ?\\ (char-after (- (point) 2))))
! 	  (forward-char -1)
! 	  (beginning-of-line))
  	(skip-chars-forward " \t")
  	(setq stop (or (not (looking-at "#")) (<= (point) lim)))

Enjoy,

-- 
Joe Wells <jbw@bu.edu>
Technical Details
Message-ID: <9009290912.AA25872@bucsf.bu.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!BUCSF.BU.EDU!jbw
References: <9009111409.AA04113@ccrwest.UUCP>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,1ff8cb50efbd71cd
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-09-29 02:12:13 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!BUCSF.BU.EDU!jbw
From: jbw@BUCSF.BU.EDU (Joe Wells)
Newsgroups: gnu.emacs.bug
Subject: Re: Indentation bug in C mode
Message-ID: <9009290912.AA25872@bucsf.bu.edu>
Date: 29 Sep 90 09:12:13 GMT
References: <9009111409.AA04113@ccrwest.UUCP>
Sender: root@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 40
Posted: Sat Sep 29 10:12:13 1990