Date: Mon, 3 Nov 1997 13:22:36 +0200 (IST) From: Eli Zaretskii To: Paul Derbyshire cc: djgpp AT delorie DOT com Subject: Re: EMACS problem In-Reply-To: <63jutt$ple@freenet-news.carleton.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 3 Nov 1997, Paul Derbyshire wrote: > > Such advice should go to the maintainer of cc-mode (the Emacs module > > that handles C- and C++-specific indentation), not to this group. > > The article was in the group, hence so was the follow-up. The original article only asked why is it slow, it didn't offer advice about improvements. > Also, didn't it pertain specifically to the DJGPP version of Emacs? No. > CC-mode is in Lisp. I was under the impression the bulk of Emacs itself is > in C/C++. Only a small number of Emacs primitives are written in C (no C++). The rest is in ELisp. > If it is in C++, buffer representation with ropes will improve > performance of the base code and any elisp code that random-accesses the > buffer, since the elisp code will simply call some function in emacs' C > code, which in turn accesses the buffer for real. Buffer access is one of the C primitives right now. The slowness of the auto-indent in the cases such as the one that gave birth to this thread is NOT (AFAIK) because the buffer access is slow (it's not). > Then the cc-mode might create a list of lines, how much they're indented, > and the "parent" line and "child" line: a line's parent line pointer points to > the line above it that is not a comment or a preprocessor directive, and > thus determines its indenting, and the child pointer the likewise line > below it. It does something like that when it parses the source. But it is still slow in some cases, and it needs to reparse when you insert certain characters (like braces etc.) which change the parse tree. (You algorithm also will need updates at certain points.) But anyway, this discussion is *way* off-topic now.