[Top][All Lists]

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

Re: Regression in `imenu--mouse-menu'

From: Stefan Monnier
Subject: Re: Regression in `imenu--mouse-menu'
Date: Fri, 16 May 2003 16:55:24 -0400

> As indicated in its doc string the function `imenu--mouse-menu' should
> "Returns t for rescan and otherwise an element or subelement of

Alright, you got me: I failed to update the docstring.

> That new behavior is quite annoying and breaks existing code (for
> example, in the JDEE and Semantic, that use `imenu--menubar-select'
> to display (possibly large) completion menus, to benefit of the nice
> automatic menu split done by imenu).

The `--' in the name is intended to make it clear that it's
an internal function.

Anyway, the patch below should fix it.  Will be applied shortly,


--- imenu.el.~1.93.~    Tue May  6 11:13:49 2003
+++ imenu.el    Fri May 16 16:50:32 2003
@@ -634,7 +634,7 @@
-(defun imenu--create-keymap-1 (title alist)
+(defun* imenu--create-keymap (title alist &optional (cmd 'identity))
   (let ((counter 0))
     (list* 'keymap title
@@ -642,10 +642,9 @@
              (list* (car item) (car item)
                      ((imenu--subalist-p item)
-                      (imenu--create-keymap-1 (car item) (cdr item)))
+                      (imenu--create-keymap (car item) (cdr item) cmd))
-                      `(lambda () (interactive)
-                         (imenu--menubar-select ',item))))))
+                      `(lambda () (interactive) (,cmd ',item))))))
 (defun imenu--in-alist (str alist)
@@ -905,10 +904,10 @@
 Returns t for rescan and otherwise an element or subelement of INDEX-ALIST."
   (setq index-alist (imenu--split-submenus index-alist))
   (let* ((menu (imenu--split-menu index-alist (or title (buffer-name))))
-        (map (imenu--create-keymap-1 (car menu)
-                                     (if (< 1 (length (cdr menu)))
-                                         (cdr menu)
-                                       (cdr (car (cdr menu)))))))
+        (map (imenu--create-keymap (car menu)
+                                   (cdr (if (< 1 (length (cdr menu)))
+                                            menu
+                                          (car (cdr menu)))))))
     (popup-menu map event)))
 (defun imenu-choose-buffer-index (&optional prompt alist)
@@ -1001,10 +1000,11 @@
          (setq index-alist (imenu--split-submenus index-alist))
          (setq menu (imenu--split-menu index-alist
-         (setq menu1 (imenu--create-keymap-1 (car menu)
-                                             (if (< 1 (length (cdr menu)))
-                                                 (cdr menu)
-                                               (cdr (car (cdr menu))))))
+         (setq menu1 (imenu--create-keymap (car menu)
+                                           (cdr (if (< 1 (length (cdr menu)))
+                                                    menu
+                                                  (car (cdr menu))))
+                                           'imenu--menubar-select))
          (setq old (lookup-key (current-local-map) [menu-bar index]))
          (setcdr old (cdr menu1)))))))

reply via email to

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