delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/02/07:40:55

Date: Sun, 2 Nov 1997 14:36:13 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Paul Derbyshire <ao950 AT FreeNet DOT Carleton DOT CA>
cc: djgpp AT delorie DOT com
Subject: Re: EMACS problem
In-Reply-To: <63budl$31e@freenet-news.carleton.ca>
Message-ID: <Pine.SUN.3.91.971102143551.11098V-100000@is>
MIME-Version: 1.0

On 31 Oct 1997, Paul Derbyshire wrote:

> Two things that together may ensure a fix in a future EMACS:

Such advice should go to the maintainer of cc-mode (the Emacs module
that handles C- and C++-specific indentation), not to this group.

> One, be sure
> to use STL ropes or something similar for buffer contents
> representation.

I'm not sure if this advice is at all applicable to the case in point,
since it is written in a dialect of Lisp.  When you work in Lisp, you
need to think Lisp, not C++, otherwise you get bad code.

> Two, use an indent logic that is "local", i.e. only needs to look at the
> immediate neighborhood of the insertion point to know what to do. I.e.
> indent same as line above, unless it ends with a hanging {, then indent by
> two more, or if it has a } with no matching {, indent two less (with two a
> user-configirable parameter)...

If you have ever tried to implement such a feature in an editor, you
must know that it will not work.  The problem is that indentation must
ignore comments and pre-processor directives.  In the following
fragment, you want "bar" to be aligned with "foo":

	  foo ();
      /* Let's see if they want bar  */
    #ifdef CALL_BAR
	  bar ();
    #endif

However, as we all know, C source files can have extremely long runs
of comments and pre-processor directives, especially at the beginning
of the file.  Skipping back all of these directives can take a lot of
time, but there's no simple solution to that problem, unless you are
willing to tolerate incorrect indentation from time to time.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019