From: Angelo Graziosi <angelo.graziosi@alice.it>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs <emacs-devel@gnu.org>
Subject: Re: bug#9199: Imenu does not work any more with C/C++ mode
Date: Thu, 15 Mar 2012 22:06:32 +0100 [thread overview]
Message-ID: <4F6259D8.10905@alice.it> (raw)
In-Reply-To: <jwv7gymtzpe.fsf-monnier+gnus-read-ephemeral-bug@gnu.org>
Il 15/03/2012 2.39, Stefan Monnier ha scritto:
>> $ cat init.el
>> (add-hook 'c-mode-hook
>> '(lambda()
>> (imenu-add-to-menubar "Functions")
>> )
>> )
>
> Running for the Useless Use of Quote Award? ;-)
>
>> $ cat test.c
>> int main(){}
>> void foo1(){}
>> void foo2(){}
>> void foo2(){}
>> $ emacs test.c&
>> Now click on 'Functions' in the menu bar, the result is as in
>
> Hmm... indeed.
>
>> If I remove init.el completely and
>> $ emacs test.c&
>> M-x imenu-add-to-menubar<RET>
>> Functions<RET>
>> Now clicking on Functions works as expected!
>
> Yup: the reason why this (and other major modes) works is that the bug
> only manifests itself if you call imenu-add-to-menubar more than once
> (and it so happens that c-mode-hook is run twice for some reason).
>
> I believe this is fixed in the trunk now thanks the the patch below,
Indeed... :-)
Thanks,
Angelo.
>
>
> Stefan
>
>
> === modified file 'lisp/ChangeLog'
> --- lisp/ChangeLog 2012-03-13 23:27:56 +0000
> +++ lisp/ChangeLog 2012-03-15 01:37:45 +0000
> @@ -1,3 +1,9 @@
> +2012-03-15 Stefan Monnier<monnier@iro.umontreal.ca>
> +
> + * imenu.el: Fix multiple inheritance breakage (bug#9199).
> + (imenu-add-to-menubar): Don't add a redundant index.
> + (imenu-update-menubar): Handle a dynamically composed keymap.
> +
> 2012-03-13 Katsumi Yamaoka<yamaoka@jpl.org>
>
> * mail/sendmail.el (mail-encode-header):
>
> === modified file 'lisp/imenu.el'
> --- lisp/imenu.el 2012-01-19 07:21:25 +0000
> +++ lisp/imenu.el 2012-03-15 01:32:35 +0000
> @@ -963,13 +963,14 @@
> imenu-generic-expression
> (not (eq imenu-create-index-function
> 'imenu-default-create-index-function)))
> + (unless (keymapp (lookup-key (current-local-map) [menu-bar index]))
> (let ((newmap (make-sparse-keymap)))
> (set-keymap-parent newmap (current-local-map))
> (setq imenu--last-menubar-index-alist nil)
> (define-key newmap [menu-bar index]
> `(menu-item ,name ,(make-sparse-keymap "Imenu")))
> (use-local-map newmap)
> - (add-hook 'menu-bar-update-hook 'imenu-update-menubar))
> + (add-hook 'menu-bar-update-hook 'imenu-update-menubar)))
> (error "The mode `%s' does not support Imenu"
> (format-mode-line mode-name))))
>
> @@ -1008,6 +1009,9 @@
> (car (cdr menu))))
> 'imenu--menubar-select))
> (setq old (lookup-key (current-local-map) [menu-bar index]))
> + ;; This should never happen, but in some odd cases, potentially,
> + ;; lookup-key may return a dynamically composed keymap.
> + (if (keymapp (cadr old)) (setq old (cadr old)))
> (setcdr old (cdr menu1)))))))
>
> (defun imenu--menubar-select (item)
>
prev parent reply other threads:[~2012-03-15 21:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 21:04 bug#9199: Imenu does not work any more with C/C++ mode Angelo Graziosi
2012-03-15 1:39 ` Stefan Monnier
2012-03-15 21:06 ` Angelo Graziosi [this message]
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=4F6259D8.10905@alice.it \
--to=angelo.graziosi@alice.it \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.