From: Leo Liu Date: Wed, 30 Jan 2013 17:57:54 +0000 (+0800) Subject: * lisp/imenu.el (imenu--truncate-items): Fix subalist checking. X-Git-Tag: emacs-24.3.90~173^2~7^2~193 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dd331297c1c7bc37ebd865a4196a4f41e9555f83;p=emacs.git * lisp/imenu.el (imenu--truncate-items): Fix subalist checking. Fixes: debbugs:13576 --- 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.