all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>,
	martin rudalics <rudalics@gmx.at>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: Unbearably slow editing in .h files (was: patch: add-log.el: changelog find file under point)
Date: Sat, 23 Feb 2008 22:49:01 +0000	[thread overview]
Message-ID: <20080223224901.GB3476@muc.de> (raw)
In-Reply-To: <jwvablydo8q.fsf-monnier+emacs@gnu.org>

Hello, Stefan and Martin.

On Mon, Feb 18, 2008 at 03:09:42PM -0500, Stefan Monnier wrote:
> > The simple approach is based on searching and comparing the result with
> > that of `add-log-current-defun'.  It works pretty well most of the time
> > but may exhibit the nasty behavior described in

> > http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00443.html

, whose content is thus:

:Try the following:
:
:  emacs -Q src/lisp.h
:  C-s Fplist_put RET
:  C-x 4 a
:
:you should see Emacs get stuck in an infinite loop (not a bad, one: C-g
:stops it just fine).
:
:
:Stefan
:
:PS: BTW, am I the only one who experiences odd slowdowns when editing
:src/lisp.h, apparently due to font-lock occasionally taking a lot of time
:(like a second or two) to do its job.  Not easy to reproduce, sadly.

It does a lot of cacheing of things; that second or two is filling up
caches, which prevents it from being "reproduced" immediately.  ;-)

> > On my 1 GHz machine this means that I have to wait some 40 secs until
> > I'm told that there are no matches.  I can think of two ways to handle
> > this: (1) Convince Alan that the behavior of `c-beginning-of-defun' is
> > intolerable - AFAICT this has been tried before.

;-)  I think that lisp.h is an ill-conditioned file, in some way.  Or
are you telling me that the slowness happens in a lot of files.h?  The
intolerability could be due to searching for an unnested brace instead
of one at column zero.

(2) Fix this within
> > `add-log-current-defun' to not use `c-beginning-of-defun' - I'm unable
> > to do this myself because I completely fail to understand that part of
> > the function.

What is add-log-current-defun using c-beginning-of-defun for?  How many
times does it call c-b-o-d?  If it's calling it lots of times, why.  OK,
cancel that, I've just had a look at the function (in Emacs-22).  It's
using several sledgehammers to crack some tiny nuts, presumably dating
from the era in which the sledgehammer was the only available tool.  The
bit in add-log-current-defun dealing with C files could usefully use
`c-beginning-of-macro' and, in particular,
`c-where-wrt-to-brace-construct'.

The latter function painstakingly analyses where, in a defun, point is,
returning a value such as 'in-header or 'outwith-function.  It's a
somewhat slow function, is called at the start of every
c-{beginning,end}-of-defun call, and its result is not currently cached.
Using it directly, instead of the five explicit calls to
c-\(beginning\|end\)-of-defun would give a speed up of 5 or 2.5 in C-x 4
a.

> Nowadays, I find myself regularly using M-x fundamental-mode in .h files
> in order to be able to edit them sanely.  We have to do something to
> fix it.  Alan?

Which files.h are you talking about, Stefan?  CC Mode seems to work well
enough for me in my day job (maintaining typical old
"proprietary-quality" C code).  Maybe .../src/lisp.h and one or two
others are somewhat extreme in their use of macros, or something.  A
solution might be to set open-paren-in-column-0-is-defun-start in the
file local variables list, but I can't remember offhand if CC Mode
handles it properly (I suspect it doesn't).
 
>         Stefan

-- 
Alan.




  reply	other threads:[~2008-02-23 22:49 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-04 21:18 patch: add-log.el: changelog find file under poin Jan Nieuwenhuizen
2007-11-06 23:45 ` Juri Linkov
2007-11-07 13:38   ` Jan Nieuwenhuizen
2007-11-09  8:40 ` Dan Nicolaescu
2007-11-09  9:40   ` Juri Linkov
2008-01-20  6:14 ` Richard Stallman
2008-01-21  3:02   ` Glenn Morris
2008-01-21 20:30     ` Richard Stallman
2008-01-21 20:35       ` Glenn Morris
2008-01-22 22:29         ` Richard Stallman
2008-01-22 22:38           ` Glenn Morris
2008-01-22 23:09           ` Dan Nicolaescu
2008-01-23  1:32             ` Juri Linkov
2008-01-23  2:25               ` Dan Nicolaescu
2008-01-23  9:28                 ` Juri Linkov
2008-01-23 16:20                 ` Richard Stallman
2008-01-27 19:54                   ` Dan Nicolaescu
2008-01-28 10:20                     ` martin rudalics
2008-01-30  2:58                       ` Dan Nicolaescu
2008-02-18 19:46                         ` patch: add-log.el: changelog find file under point martin rudalics
2008-02-18 20:09                           ` Unbearably slow editing in .h files (was: patch: add-log.el: changelog find file under point) Stefan Monnier
2008-02-23 22:49                             ` Alan Mackenzie [this message]
2008-02-23 22:51                               ` Unbearably slow editing in .h files martin rudalics
2008-02-23 23:25                                 ` Alan Mackenzie
2008-02-24  8:55                                   ` martin rudalics
2008-04-02 22:07                                 ` Alan Mackenzie
2008-04-02 23:47                                   ` Dan Nicolaescu
2008-04-03  9:14                                     ` Alan Mackenzie
2008-04-03 13:10                                       ` Dan Nicolaescu
2008-04-03 14:17                                         ` Alan Mackenzie
2008-04-03 15:22                                           ` Dan Nicolaescu
2008-04-03 17:58                                             ` Alan Mackenzie
2008-02-24  0:37                               ` Stefan Monnier
2008-02-24  8:39                                 ` Alan Mackenzie
2008-02-24 14:46                                   ` Jason Rumney
2008-02-24 19:48                                     ` Eli Zaretskii
2008-02-24 19:49                                   ` Eli Zaretskii
2008-02-24 10:28                                 ` Andreas Schwab
2008-02-24 13:49                                   ` Stefan Monnier
2008-02-24 14:41                                     ` Alan Mackenzie
2008-02-24 15:42                                       ` Stefan Monnier
2008-02-24 20:12                                         ` Alan Mackenzie
2008-02-24 22:29                                     ` Richard Stallman
2008-02-25  2:14                                       ` Stefan Monnier
2008-02-18 23:31                           ` patch: add-log.el: changelog find file under point Juri Linkov
2008-02-19  6:34                             ` martin rudalics
2008-02-20 21:29                               ` Juri Linkov
2008-02-21  7:26                                 ` martin rudalics
2008-02-21 22:29                                   ` Richard Stallman
2008-02-22 19:26                                     ` martin rudalics
2008-02-23 19:28                                       ` Richard Stallman
2008-02-23 22:32                                         ` martin rudalics
2008-02-24 15:23                                           ` Richard Stallman
2008-02-24 15:23                                           ` Richard Stallman
2008-02-24 22:34                                             ` martin rudalics
2008-02-25 10:57                                               ` Richard Stallman
2008-02-25 14:05                                                 ` martin rudalics
2008-01-22  0:08       ` patch: add-log.el: changelog find file under poin Juri Linkov
2008-01-22  1:17         ` Drew Adams
2008-01-22  9:54           ` Juri Linkov
2008-01-22 14:34             ` Drew Adams
2008-01-22 22:29         ` Richard Stallman
2008-01-23  1:29           ` Juri Linkov
2008-01-23 16:20             ` Richard Stallman
2008-01-28  8:55             ` Jan Nieuwenhuizen
2008-01-28  9:29               ` Johan Bockgård
2008-01-22  8:21   ` Dan Nicolaescu
2008-01-22  9:56     ` Juri Linkov
2008-01-22 23:13       ` Dan Nicolaescu
2008-01-22 22:29     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080223224901.GB3476@muc.de \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.