diff options
| author | Richard M. Stallman | 2005-01-15 18:09:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-01-15 18:09:16 +0000 |
| commit | 5f7bccdad82c81f8a78b2953ec854e43ee1e9350 (patch) | |
| tree | 5d095341afe756498e852432c1c0b75673275f59 | |
| parent | 56abefac4fea4294b2ab948977bf75d7debfb849 (diff) | |
| download | emacs-5f7bccdad82c81f8a78b2953ec854e43ee1e9350.tar.gz emacs-5f7bccdad82c81f8a78b2953ec854e43ee1e9350.zip | |
(imenu--split-menu): Copy menulist before sorting.
(imenu--generic-function): Use START, not BEG, as pos of definition.
| -rw-r--r-- | lisp/imenu.el | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el index af617498b07..6ee72a88bc4 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el | |||
| @@ -532,7 +532,7 @@ A nested sub-alist element looks like (INDEX-NAME SUB-ALIST).") | |||
| 532 | (push item keep-at-top) | 532 | (push item keep-at-top) |
| 533 | (setq menulist (delq item menulist)))) | 533 | (setq menulist (delq item menulist)))) |
| 534 | (if imenu-sort-function | 534 | (if imenu-sort-function |
| 535 | (setq menulist (sort menulist imenu-sort-function))) | 535 | (setq menulist (sort (copy-sequence menulist) imenu-sort-function))) |
| 536 | (if (> (length menulist) imenu-max-items) | 536 | (if (> (length menulist) imenu-max-items) |
| 537 | (setq menulist | 537 | (setq menulist |
| 538 | (mapcar | 538 | (mapcar |
| @@ -817,32 +817,30 @@ depending on PATTERNS." | |||
| 817 | (setq start (point)) | 817 | (setq start (point)) |
| 818 | (goto-char (match-end index)) | 818 | (goto-char (match-end index)) |
| 819 | (setq beg (match-beginning index)) | 819 | (setq beg (match-beginning index)) |
| 820 | (goto-char beg) | 820 | ;; Go to the start of the match. |
| 821 | ;; That's the official position of this definition. | ||
| 822 | (goto-char start) | ||
| 821 | (imenu-progress-message prev-pos nil t) | 823 | (imenu-progress-message prev-pos nil t) |
| 822 | ;; Add this sort of submenu only when we've found an | 824 | ;; Add this sort of submenu only when we've found an |
| 823 | ;; item for it, avoiding empty, duff menus. | 825 | ;; item for it, avoiding empty, duff menus. |
| 824 | (unless (assoc menu-title index-alist) | 826 | (unless (assoc menu-title index-alist) |
| 825 | (push (list menu-title) index-alist)) | 827 | (push (list menu-title) index-alist)) |
| 826 | (if imenu-use-markers | 828 | (if imenu-use-markers |
| 827 | (setq beg (copy-marker beg))) | 829 | (setq start (copy-marker start))) |
| 828 | (let ((item | 830 | (let ((item |
| 829 | (if function | 831 | (if function |
| 830 | (nconc (list (match-string-no-properties index) | 832 | (nconc (list (match-string-no-properties index) |
| 831 | beg function) | 833 | start function) |
| 832 | rest) | 834 | rest) |
| 833 | (cons (match-string-no-properties index) | 835 | (cons (match-string-no-properties index) |
| 834 | beg))) | 836 | start))) |
| 835 | ;; This is the desired submenu, | 837 | ;; This is the desired submenu, |
| 836 | ;; starting with its title (or nil). | 838 | ;; starting with its title (or nil). |
| 837 | (menu (assoc menu-title index-alist))) | 839 | (menu (assoc menu-title index-alist))) |
| 838 | ;; Insert the item unless it is already present. | 840 | ;; Insert the item unless it is already present. |
| 839 | (unless (member item (cdr menu)) | 841 | (unless (member item (cdr menu)) |
| 840 | (setcdr menu | 842 | (setcdr menu |
| 841 | (cons item (cdr menu))))) | 843 | (cons item (cdr menu)))))))) |
| 842 | ;; Move to the start of the entire match, | ||
| 843 | ;; to ensure we keep moving backwards | ||
| 844 | ;; as long as the match is nonempty. | ||
| 845 | (goto-char start)))) | ||
| 846 | (set-syntax-table old-table))) | 844 | (set-syntax-table old-table))) |
| 847 | (imenu-progress-message prev-pos 100 t) | 845 | (imenu-progress-message prev-pos 100 t) |
| 848 | ;; Sort each submenu by position. | 846 | ;; Sort each submenu by position. |