From dd331297c1c7bc37ebd865a4196a4f41e9555f83 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 31 Jan 2013 01:57:54 +0800 Subject: [PATCH] * lisp/imenu.el (imenu--truncate-items): Fix subalist checking. Fixes: debbugs:13576 --- lisp/ChangeLog | 5 +++++ lisp/imenu.el | 18 ++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e46e66651ca..31580a50b02 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-01-30 Leo Liu + + * imenu.el (imenu--truncate-items): Fix subalist checking. + (Bug#13576) + 2013-01-30 Glenn Morris * mouse.el (mouse-drag-line): Avoid pushing same event onto diff --git a/lisp/imenu.el b/lisp/imenu.el index 435d97fcdb4..80fc441c896 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -555,16 +555,14 @@ NOT share structure with 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. -- 2.39.2