From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: Regression in `imenu--mouse-menu' Date: Fri, 16 May 2003 16:55:24 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305162055.h4GKtP1u028824@rum.cs.yale.edu> References: <25287543.1053089246520.JavaMail.www@wwinf0401> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053118550 32676 80.91.224.249 (16 May 2003 20:55:50 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 16 May 2003 20:55:50 +0000 (UTC) Cc: emacs-devel Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri May 16 22:55:49 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19GmF3-0008Ut-00 for ; Fri, 16 May 2003 22:55:49 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19GmNZ-0000XG-00 for ; Fri, 16 May 2003 23:04:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19GmGF-00017j-00 for emacs-devel@quimby.gnus.org; Fri, 16 May 2003 16:57:03 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19GmFW-0008NI-00 for emacs-devel@gnu.org; Fri, 16 May 2003 16:56:18 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19GmF5-0007zf-00 for emacs-devel@gnu.org; Fri, 16 May 2003 16:55:55 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19GmEf-000732-00 for emacs-devel@gnu.org; Fri, 16 May 2003 16:55:25 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h4GKtPx6028826; Fri, 16 May 2003 16:55:25 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h4GKtP1u028824; Fri, 16 May 2003 16:55:25 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: David PONCE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13942 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13942 > As indicated in its doc string the function `imenu--mouse-menu' should > "Returns t for rescan and otherwise an element or subelement of > INDEX-ALIST.". 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, Stefan --- imenu.el.~1.93.~ Tue May 6 11:13:49 2003 +++ imenu.el Fri May 16 16:50:32 2003 @@ -634,7 +634,7 @@ alist) t)) -(defun imenu--create-keymap-1 (title alist) +(defun* imenu--create-keymap (title alist &optional (cmd 'identity)) (let ((counter 0)) (list* 'keymap title (mapcar @@ -642,10 +642,9 @@ (list* (car item) (car item) (cond ((imenu--subalist-p item) - (imenu--create-keymap-1 (car item) (cdr item))) + (imenu--create-keymap (car item) (cdr item) cmd)) (t - `(lambda () (interactive) - (imenu--menubar-select ',item)))))) + `(lambda () (interactive) (,cmd ',item)))))) alist)))) (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 (buffer-name))) - (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)))))))