diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-09-24 22:50:24 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-09-24 22:50:24 +0000 |
commit | 79e098ca054f9501ea762bd27cde5ef1001301de (patch) | |
tree | ca809f401cb40ea3f20e04bed950b9ff5967d166 /lisp/imenu.el | |
parent | edce365443566c82e3882896f44727ce8665a961 (diff) | |
download | emacs-79e098ca054f9501ea762bd27cde5ef1001301de.tar.gz emacs-79e098ca054f9501ea762bd27cde5ef1001301de.tar.bz2 emacs-79e098ca054f9501ea762bd27cde5ef1001301de.zip |
(imenu--cleanup): Handle shared structure in alist.
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r-- | lisp/imenu.el | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el index 64d5007e855..59112086de2 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -469,16 +469,21 @@ This function is called after the function pointed out by (setq imenu--index-alist (list nil))) ;; Add a rescan option to the index. (cons imenu--rescan-item imenu--index-alist)) -;;; + ;;; Find all markers in alist and makes ;;; them point nowhere. -;;; +;;; The top-level call uses nil as the argument; +;;; non-nil arguments are in recursivecalls. +(defvar imenu--cleanup-seen) + (defun imenu--cleanup (&optional alist) - ;; Sets the markers in imenu--index-alist - ;; point nowhere. - ;; if alist is provided use that list. - (or alist - (setq alist imenu--index-alist)) + ;; If alist is provided use that list. + ;; If not, empty the table of lists already seen + ;; and use imenu--index-alist. + (if alist + (setq imenu--cleanup-seen (cons alist imenu--cleanup-seen)) + (setq alist imenu--index-alist imenu--cleanup-seen (list alist))) + (and alist (mapcar (function @@ -486,6 +491,8 @@ This function is called after the function pointed out by (cond ((markerp (cdr item)) (set-marker (cdr item) nil)) + ;; Don't process one alist twice. + ((memq (cdr item) imenu--cleanup-seen)) ((imenu--subalist-p item) (imenu--cleanup (cdr item)))))) alist) |