unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* imenu with cc-mode in emacs 22 (win32)
@ 2008-11-12 11:21 Rudolfo Ungern
  2008-11-12 12:58 ` Alan Mackenzie
       [not found] ` <mailman.133.1226494022.26697.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Rudolfo Ungern @ 2008-11-12 11:21 UTC (permalink / raw)
  To: help-gnu-emacs

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.

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.

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)

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.

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.

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

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.

Thanks, Rolf


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: imenu with cc-mode in emacs 22 (win32)
  2008-11-12 11:21 imenu with cc-mode in emacs 22 (win32) Rudolfo Ungern
@ 2008-11-12 12:58 ` Alan Mackenzie
       [not found] ` <mailman.133.1226494022.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2008-11-12 12:58 UTC (permalink / raw)
  To: Rudolfo Ungern; +Cc: bug-cc-mode, help-gnu-emacs

[ 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).

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: imenu with cc-mode in emacs 22 (win32)
       [not found] ` <mailman.133.1226494022.26697.help-gnu-emacs@gnu.org>
@ 2008-11-13  1:45   ` Rudolfo Ungern
  2008-11-13 11:26     ` Rudolfo Ungern
  0 siblings, 1 reply; 6+ messages in thread
From: Rudolfo Ungern @ 2008-11-13  1:45 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: bug-cc-mode

Hi Alan,

thanks for your input. With the "debug-on-quit" option I could figure
out that the problem is related with the org-mode that I am using.

If I don't load org-mode, the imenu functionality is working also in
the
cc-mode.

Here is the stack trace that I get when org-mode is loaded.

Debugger entered--Lisp error: (quit)
  byte-code( ... )
  org-show-context(org-goto)
  (lambda nil (org-show-context (quote org-goto)))()
  run-hooks(imenu-after-jump-hook)
  imenu(("dlgInputProc" . #<marker at 1512 in ScriptTester.c>))
  call-interactively(imenu)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

org-mode has version 5.23a, it is the one that comes within Emacs
22.3:

 org-version is a variable defined in `org.el'.
 Its value is "5.23a"

I mentioned that I do not have these kind of problems when running
emacs 21.3. I should add here that for the old emacs version I did
download org-mode from the org-mode.org site and this is version
6.08c.

I have tried now several c files, also small ones, and it doesn' seem
to relate with the content or size of the c code file.

Next step I try to do is to upgrade the org-mode related files to
version 6.08 in emacs 22. Guess this would only be a question
of placing the newer files into a elisp directory that comes in the
path specification before the standard elisp library directories.

I am happy to help to fix this issue (if this is a bug). I just need
to understand a bit more how to file a bug.

On Nov 12, 1:58 pm, Alan Mackenzie <a...@muc.de> wrote:
> [ Reply-To: set to bug-cc-m...@gnu.org ]
>

> > 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.
>

> --
> Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: imenu with cc-mode in emacs 22 (win32)
  2008-11-13  1:45   ` Rudolfo Ungern
@ 2008-11-13 11:26     ` Rudolfo Ungern
  2008-11-17 18:58       ` Rudolfo Ungern
  0 siblings, 1 reply; 6+ messages in thread
From: Rudolfo Ungern @ 2008-11-13 11:26 UTC (permalink / raw)
  To: help-gnu-emacs

Okay,

I am using now version 6.09a of org-mode with emacs-22.3.1 and
navigating with imenu is working now.

The strange thing is that it is only working directly from imenu
(invoked with M-x imenu and continued with completion), if I want
to navigate with speedbar (the one that comes with emacs 22.3.1
and that says version 1.0 in the window title) I get stuck again.

If I press C-g I am at the right place in the file, though. But that
is probably not how convenient navigating is meant to be:
"hit enter and hit C-g"  ;-)

So here is the stack trace that I get with debugging turned on.

1.case (file is already open, ie. loaded in the active buffer):

Debugger entered--Lisp error: (quit)
  outline-on-heading-p(t)
  org-back-to-heading(t)
  org-flag-heading(nil)
  byte-code("...")
  org-show-context(org-goto)
  (lambda nil (org-show-context (quote org-goto)))()
  run-hooks(speedbar-visiting-tag-hook)
  speedbar-tag-find("dlgDownload" #<marker at 22107 in Test.c> 1)
  speedbar-do-function-pointer()
  speedbar-edit-line()
  call-interactively(speedbar-edit-line)

2. case (file is not visited yet)

Debugger entered--Lisp error: (quit)
  remove-overlays(511 528 invisible outline)
  outline-flag-region(511 528 nil)
  org-flag-heading(nil)
  byte-code("...")
  org-show-context(org-goto)
  (lambda nil (org-show-context (quote org-goto)))()
  run-hooks(speedbar-visiting-tag-hook)
  speedbar-tag-find("tagGlobal" #<marker at 512 in global.h> 2)
  speedbar-do-function-pointer()
  speedbar-edit-line()
  call-interactively(speedbar-edit-line)

I have no idea, if this really follows a certain pattern, it might as
well depend on the delay until I finally hit C-g.

Rolf


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: imenu with cc-mode in emacs 22 (win32)
  2008-11-13 11:26     ` Rudolfo Ungern
@ 2008-11-17 18:58       ` Rudolfo Ungern
  2008-11-18 15:57         ` Rudolfo Ungern
  0 siblings, 1 reply; 6+ messages in thread
From: Rudolfo Ungern @ 2008-11-17 18:58 UTC (permalink / raw)
  To: help-gnu-emacs

Okay,

> On the other hand the same .emacs file works fine with
> emacs-21.3 and imenu.

I have to correct my above statement that emacs 21.3 doesn't
show any problem. I did now another test and figured out, that
for emacs 21.3 it is only plain imenu, that is working, but not in
combination with speedbar.

I get the following stack trace after hitting C-g when I try to
navigate to a function in the file Display.c

Debugger entered--Lisp error: (quit)
  vertical-motion(55 #<window 3 on Display.c>)
  lazy-lock-fontify-conservatively(#<window 3 on Display.c>)
  lazy-lock-fontify-after-visage()
  run-hooks(outline-view-change-hook)
  outline-flag-region(7544 7577 nil)
  org-flag-heading(nil)
  byte-code("..."
  org-show-context(org-goto)
  (lambda nil (org-show-context (quote org-goto)))()
  run-hooks(speedbar-visiting-tag-hook)
  speedbar-tag-find("cmFileMapInit" #<marker at 7549 in Display.c> 2)
  speedbar-do-function-pointer()
  speedbar-edit-line()
  call-interactively(speedbar-edit-line)

So it seems to be an issue with org-mode. The problem with imenu
may be solved with the step from org-mode version 5.23 to 6.09, but
speedbar on cc-mode still doesn't work with org-mode.

Rolf.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: imenu with cc-mode in emacs 22 (win32)
  2008-11-17 18:58       ` Rudolfo Ungern
@ 2008-11-18 15:57         ` Rudolfo Ungern
  0 siblings, 0 replies; 6+ messages in thread
From: Rudolfo Ungern @ 2008-11-18 15:57 UTC (permalink / raw)
  To: help-gnu-emacs

I have sent this to the org-mode mailing list, because it rather
seemed
to be an issue of the code in org-mode.

The main author of org-mode, Carsten Dominik has build a patch for
this:
The "add-hook 'speedbar-visiting-tag-hook" statement in org.el has to
be modified from

  (lambda () (org-show-context 'org-goto))

to

  (lambda () (and (org-mode-p) (org-show-context 'org-goto)))

for further details see http://article.gmane.org/gmane.emacs.orgmode/9445

Rolf


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-11-18 15:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 11:21 imenu with cc-mode in emacs 22 (win32) Rudolfo Ungern
2008-11-12 12:58 ` Alan Mackenzie
     [not found] ` <mailman.133.1226494022.26697.help-gnu-emacs@gnu.org>
2008-11-13  1:45   ` Rudolfo Ungern
2008-11-13 11:26     ` Rudolfo Ungern
2008-11-17 18:58       ` Rudolfo Ungern
2008-11-18 15:57         ` Rudolfo Ungern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).