help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: imenu with cc-mode in emacs 22 (win32)


From: Alan Mackenzie
Subject: Re: imenu with cc-mode in emacs 22 (win32)
Date: Wed, 12 Nov 2008 12:58:40 +0000
User-agent: Mutt/1.5.9i

[ Reply-To: set to bug-cc-mode@gnu.org ]

Hi, Rolf!

On Wed, Nov 12, 2008 at 03:21:32AM -0800, Rudolfo Ungern wrote:
> Hi,

> i switched to emacs-22.3 recently and have a problem with speedbar/
> imenu in cc-mode. When I try to navigate with imenu to a function emacs
> eats up all the CPU resources and is not responding anymore.

Not good.  Does this happen with any C file, or just sometimes?  If the
latter, could you possibly pare a file down to the minimum which shows
the bug, then post it?  Thanks!

Please give an exact recipe (in terms of keystrokes or mouse clicks) to
reproduce the problem.

I've redirected this mail to the CC Mode list at bug-cc-mode@gnu.org,
because it smells like that sort of problem.

> Imenu is working with perl files (with perl-mode) with sql files, but
> not with cc mode. No matter if it is c++ or plain c code.

What is your CC exact Mode configuration?  (Please do C-c C-b in a CC
Mode buffer.  That will open a mail buffer with all the information,
pre-addressed to bug-cc-mode@gnu.org.  If you use a different mail
client, just copy everything across.  Thanks!)

> It must be something in my .emacs, because navigating in the same
> source files with imenu works if I skip my .emacs (that is: start emacs
> as another user)

It might well be your .emacs which is triggering the bug, but the bug
itself is mine.  :-)

> On the other hand the same .emacs file works find with emacs-21.3 and
> imenu.  (of course i use some different code depending on the emacs
> version, but that does not affect imenu nor cc-mode.

CC Mode was amended a lot between Emacs 21.3 and 22.1.

> It seems like the imenu related lisp code runs in some never-ending
> loop.  I guess it would help me a lot, if I can have some hints how to
> activate the elisp debugger.

The simplest ways are (setq debug-on-error t) and (setq debug-on-quit t).
The second one seems the most relevant here.  After setting
debug-on-quit, get into the infinite loop and C-g it - this gets you into
the debugger, with a display of the calling stack.  The debugger is
documented on the page "debugger" in the Elisp manual.

Or for really heavy debugging, look up Edebug in the elisp manual.  With
edebug, you have to "instrument" a function first.  When you get to that
function, you can then do things like single stepping, etc.

> I know that this post is pretty vague, but the alternative would have
> been to paste 400 lines of the .emacs into this post.

Well, who know, I might ask you to do just that a bit later.  :-)

> I usually use

>  (add-hook 'c-mode-common-hook 'my-c-mode-hook)

> in my .emacs file, with some indentation adjustments in my-c-mode-
> hook.  but even if I deactivate this add-hook expression I still run in
> the problem with imenu.

> The other suspected piece of code is in customization:

> (custom-set-variables
>   ;
>  '(imenu-sort-function (quote imenu--sort-by-name)))

> but commenting it out, doesn't help either.

> If someone knows what areas have changed in imenu from emacs21 to
> emacs22, that could give me a hint where to search for the root of the
> problem.

CC Mode changed from version 5.28 to 5.31.n.  This contains the bulk of
the imenu code for C, etc.  The pertinent file in Emacs is in
.../emacs/lisp/progmodes/cc-menu.el.  The imenu code itself is in
.../emacs/lisp/imenu.el.  You can see recent changes to it in
.../emacs/lisp/ChangeLog.  Alternatively, have a look at the CVS
repository at
http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/imenu.el.

Have fun!

> Thanks, Rolf

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]