diff options
| author | Glenn Morris | 2008-09-30 03:38:42 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-09-30 03:38:42 +0000 |
| commit | c27c178cd23dcc5b977c6f97ccc7005b4f712088 (patch) | |
| tree | 68f31caddbc2ef9e66b0b1d4e5209ebde7b54614 | |
| parent | 4043c1949e6c5f6c6eb2a0024043e24d61a994fa (diff) | |
| download | emacs-c27c178cd23dcc5b977c6f97ccc7005b4f712088.tar.gz emacs-c27c178cd23dcc5b977c6f97ccc7005b4f712088.zip | |
Daniel Colascione <danc at merrillpress.com>
(imenu--split-menu): Fix bug with shared lists that deleted some
nested menu items.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/imenu.el | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d77a8b9f994..f2e06d85506 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-09-30 Daniel Colascione <danc@merrillpress.com> | ||
| 2 | |||
| 3 | * imenu.el (imenu--split-menu): Fix bug with shared lists that deleted | ||
| 4 | some nested menu items. | ||
| 5 | |||
| 1 | 2008-09-30 Jay Belanger <jay.p.belanger@gmail.com> | 6 | 2008-09-30 Jay Belanger <jay.p.belanger@gmail.com> |
| 2 | 7 | ||
| 3 | * calc/calc-units.el (math-standard-units): Add entries used to | 8 | * calc/calc-units.el (math-standard-units): Add entries used to |
diff --git a/lisp/imenu.el b/lisp/imenu.el index 8573486b5aa..370875c3d54 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el | |||
| @@ -483,6 +483,8 @@ element recalculates the buffer's index alist.") | |||
| 483 | 483 | ||
| 484 | ;; Split LIST into sublists of max length N. | 484 | ;; Split LIST into sublists of max length N. |
| 485 | ;; Example (imenu--split '(1 2 3 4 5 6 7 8) 3)-> '((1 2 3) (4 5 6) (7 8)) | 485 | ;; Example (imenu--split '(1 2 3 4 5 6 7 8) 3)-> '((1 2 3) (4 5 6) (7 8)) |
| 486 | ;; | ||
| 487 | ;; The returned list DOES NOT share structure with LIST. | ||
| 486 | (defun imenu--split (list n) | 488 | (defun imenu--split (list n) |
| 487 | (let ((remain list) | 489 | (let ((remain list) |
| 488 | (result '()) | 490 | (result '()) |
| @@ -504,10 +506,15 @@ element recalculates the buffer's index alist.") | |||
| 504 | 506 | ||
| 505 | ;;; Split the alist MENULIST into a nested alist, if it is long enough. | 507 | ;;; Split the alist MENULIST into a nested alist, if it is long enough. |
| 506 | ;;; In any case, add TITLE to the front of the alist. | 508 | ;;; In any case, add TITLE to the front of the alist. |
| 509 | ;;; If IMENU--RESCAN-ITEM is present in MENULIST, it is moved to the | ||
| 510 | ;;; beginning of the returned alist. | ||
| 511 | ;;; | ||
| 512 | ;;; The returned alist DOES NOT share structure with MENULIST. | ||
| 507 | (defun imenu--split-menu (menulist title) | 513 | (defun imenu--split-menu (menulist title) |
| 508 | (let (keep-at-top tail) | 514 | (let ((menulist (copy-sequence menulist)) |
| 515 | keep-at-top tail) | ||
| 509 | (if (memq imenu--rescan-item menulist) | 516 | (if (memq imenu--rescan-item menulist) |
| 510 | (setq keep-at-top (cons imenu--rescan-item nil) | 517 | (setq keep-at-top (list imenu--rescan-item) |
| 511 | menulist (delq imenu--rescan-item menulist))) | 518 | menulist (delq imenu--rescan-item menulist))) |
| 512 | (setq tail menulist) | 519 | (setq tail menulist) |
| 513 | (dolist (item tail) | 520 | (dolist (item tail) |
| @@ -515,7 +522,7 @@ element recalculates the buffer's index alist.") | |||
| 515 | (push item keep-at-top) | 522 | (push item keep-at-top) |
| 516 | (setq menulist (delq item menulist)))) | 523 | (setq menulist (delq item menulist)))) |
| 517 | (if imenu-sort-function | 524 | (if imenu-sort-function |
| 518 | (setq menulist (sort (copy-sequence menulist) imenu-sort-function))) | 525 | (setq menulist (sort menulist imenu-sort-function))) |
| 519 | (if (> (length menulist) imenu-max-items) | 526 | (if (> (length menulist) imenu-max-items) |
| 520 | (setq menulist | 527 | (setq menulist |
| 521 | (mapcar | 528 | (mapcar |
| @@ -527,6 +534,9 @@ element recalculates the buffer's index alist.") | |||
| 527 | 534 | ||
| 528 | ;;; Split up each long alist that are nested within ALIST | 535 | ;;; Split up each long alist that are nested within ALIST |
| 529 | ;;; into nested alists. | 536 | ;;; into nested alists. |
| 537 | ;;; | ||
| 538 | ;;; Return a split and sorted copy of ALIST. The returned alist DOES | ||
| 539 | ;;; NOT share structure with ALIST. | ||
| 530 | (defun imenu--split-submenus (alist) | 540 | (defun imenu--split-submenus (alist) |
| 531 | (mapcar (function | 541 | (mapcar (function |
| 532 | (lambda (elt) | 542 | (lambda (elt) |