GNU bug report logs - #13576
24.2.92; [PATCH] a bug in imenu--truncate-items

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Mon, 28 Jan 2013 15:16:01 UTC

Severity: normal

Tags: patch

Found in version 24.2.92

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13576 in the body.
You can then email your comments to 13576 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13576; Package emacs. (Mon, 28 Jan 2013 15:16:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 28 Jan 2013 15:16:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.92; [PATCH] a bug in imenu--truncate-items
Date: Mon, 28 Jan 2013 23:09:04 +0800
According to documentation on imenu--index-alist, a special item looks
like:

        (INDEX-NAME POSITION FUNCTION ARGUMENTS...)

which fails imenu--truncate-items.

diff --git a/lisp/imenu.el b/lisp/imenu.el
index 80dacf93..649fc0a7 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -557,7 +557,7 @@ (defun imenu--truncate-items (menulist)
   "Truncate all strings in MENULIST to `imenu-max-item-length'."
   (mapcar (lambda (item)
             (cond
-             ((consp (cdr item))
+             ((imenu--subalist-p item)
               (imenu--truncate-items (cdr item)))
              ;; truncate if necessary
              ((and (numberp imenu-max-item-length)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13576; Package emacs. (Mon, 28 Jan 2013 16:31:02 GMT) Full text and rfc822 format available.

Message #8 received at 13576 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Leo Liu'" <sdl.web <at> gmail.com>, <13576 <at> debbugs.gnu.org>
Subject: RE: bug#13576: 24.2.92; [PATCH] a bug in imenu--truncate-items
Date: Mon, 28 Jan 2013 08:30:14 -0800
Perhaps related to bug #12717?

> According to documentation on imenu--index-alist, a special item looks
> like: (INDEX-NAME POSITION FUNCTION ARGUMENTS...)
> which fails imenu--truncate-items.
>
> -             ((consp (cdr item))
> +             ((imenu--subalist-p item)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13576; Package emacs. (Tue, 29 Jan 2013 02:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 13576 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13576 <at> debbugs.gnu.org
Subject: Re: bug#13576: 24.2.92; [PATCH] a bug in imenu--truncate-items
Date: Mon, 28 Jan 2013 21:25:01 -0500
> diff --git a/lisp/imenu.el b/lisp/imenu.el
> index 80dacf93..649fc0a7 100644
> --- a/lisp/imenu.el
> +++ b/lisp/imenu.el
> @@ -557,7 +557,7 @@ (defun imenu--truncate-items (menulist)
>    "Truncate all strings in MENULIST to `imenu-max-item-length'."
>    (mapcar (lambda (item)
>              (cond
> -             ((consp (cdr item))
> +             ((imenu--subalist-p item)
>                (imenu--truncate-items (cdr item)))
>               ;; truncate if necessary
>               ((and (numberp imenu-max-item-length)

Looks right, please install it in trunk,


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13576; Package emacs. (Tue, 29 Jan 2013 07:23:01 GMT) Full text and rfc822 format available.

Message #14 received at 13576 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13576 <at> debbugs.gnu.org
Subject: Re: bug#13576: 24.2.92; [PATCH] a bug in imenu--truncate-items
Date: Tue, 29 Jan 2013 15:22:12 +0800
On 2013-01-29 10:25 +0800, Stefan Monnier wrote:
> Looks right, please install it in trunk,

I'll install something along these lines which also truncate the
car of a sub-alist.

diff --git a/lisp/imenu.el b/lisp/imenu.el
index 80dacf93..1d721659 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -555,16 +555,14 @@ (defun imenu--split-submenus (alist)
 
 (defun imenu--truncate-items (menulist)
   "Truncate all strings in MENULIST to `imenu-max-item-length'."
-  (mapcar (lambda (item)
-            (cond
-             ((consp (cdr item))
-              (imenu--truncate-items (cdr item)))
-             ;; truncate if necessary
-             ((and (numberp imenu-max-item-length)
-                   (> (length (car item)) imenu-max-item-length))
-              (setcar item (substring (car item) 0 imenu-max-item-length)))))
-	  menulist))
-
+  (mapc (lambda (item)
+	  ;; truncate if necessary
+	  (when (and (numberp imenu-max-item-length)
+		     (> (length (car item)) imenu-max-item-length))
+	    (setcar item (substring (car item) 0 imenu-max-item-length)))
+	  (when (imenu--subalist-p item)
+	    (imenu--truncate-items (cdr item))))
+	menulist))
 
 (defun imenu--make-index-alist (&optional noerror)
   "Create an index alist for the definitions in the current buffer.




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Wed, 30 Jan 2013 18:03:01 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Wed, 30 Jan 2013 18:03:01 GMT) Full text and rfc822 format available.

Message #19 received at 13576-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: 13576-done <at> debbugs.gnu.org
Subject: Re: bug#13576: 24.2.92; [PATCH] a bug in imenu--truncate-items
Date: Thu, 31 Jan 2013 02:01:20 +0800
Fixed in trunk




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 28 Feb 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.