emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/imenu.el,v


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/imenu.el,v
Date: Tue, 30 Sep 2008 03:38:29 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       08/09/30 03:38:28

Index: imenu.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/imenu.el,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -b -r1.125 -r1.126
--- imenu.el    6 May 2008 07:57:39 -0000       1.125
+++ imenu.el    30 Sep 2008 03:38:28 -0000      1.126
@@ -483,6 +483,8 @@
 
 ;; Split LIST into sublists of max length N.
 ;; Example (imenu--split '(1 2 3 4 5 6 7 8) 3)-> '((1 2 3) (4 5 6) (7 8))
+;;
+;; The returned list DOES NOT share structure with LIST.
 (defun imenu--split (list n)
   (let ((remain list)
        (result '())
@@ -504,10 +506,15 @@
 
 ;;; Split the alist MENULIST into a nested alist, if it is long enough.
 ;;; In any case, add TITLE to the front of the alist.
+;;; If IMENU--RESCAN-ITEM is present in MENULIST, it is moved to the
+;;; beginning of the returned alist.
+;;;
+;;; The returned alist DOES NOT share structure with MENULIST.
 (defun imenu--split-menu (menulist title)
-  (let (keep-at-top tail)
+  (let ((menulist (copy-sequence menulist))
+        keep-at-top tail)
     (if (memq imenu--rescan-item menulist)
-       (setq keep-at-top (cons imenu--rescan-item nil)
+       (setq keep-at-top (list imenu--rescan-item)
              menulist (delq imenu--rescan-item menulist)))
     (setq tail menulist)
     (dolist (item tail)
@@ -515,7 +522,7 @@
        (push item keep-at-top)
        (setq menulist (delq item menulist))))
     (if imenu-sort-function
-       (setq menulist (sort (copy-sequence menulist) imenu-sort-function)))
+       (setq menulist (sort menulist imenu-sort-function)))
     (if (> (length menulist) imenu-max-items)
        (setq menulist
              (mapcar
@@ -527,6 +534,9 @@
 
 ;;; Split up each long alist that are nested within ALIST
 ;;; into nested alists.
+;;;
+;;; Return a split and sorted copy of ALIST. The returned alist DOES
+;;; NOT share structure with ALIST.
 (defun imenu--split-submenus (alist)
   (mapcar (function
           (lambda (elt)




reply via email to

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