aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-09-24 22:50:24 +0000
committerRichard M. Stallman1996-09-24 22:50:24 +0000
commit79e098ca054f9501ea762bd27cde5ef1001301de (patch)
treeca809f401cb40ea3f20e04bed950b9ff5967d166
parentedce365443566c82e3882896f44727ce8665a961 (diff)
downloademacs-79e098ca054f9501ea762bd27cde5ef1001301de.tar.gz
emacs-79e098ca054f9501ea762bd27cde5ef1001301de.zip
(imenu--cleanup): Handle shared structure in alist.
-rw-r--r--lisp/imenu.el21
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
469 (setq imenu--index-alist (list nil))) 469 (setq imenu--index-alist (list nil)))
470 ;; Add a rescan option to the index. 470 ;; Add a rescan option to the index.
471 (cons imenu--rescan-item imenu--index-alist)) 471 (cons imenu--rescan-item imenu--index-alist))
472;;; 472
473;;; Find all markers in alist and makes 473;;; Find all markers in alist and makes
474;;; them point nowhere. 474;;; them point nowhere.
475;;; 475;;; The top-level call uses nil as the argument;
476;;; non-nil arguments are in recursivecalls.
477(defvar imenu--cleanup-seen)
478
476(defun imenu--cleanup (&optional alist) 479(defun imenu--cleanup (&optional alist)
477 ;; Sets the markers in imenu--index-alist 480 ;; If alist is provided use that list.
478 ;; point nowhere. 481 ;; If not, empty the table of lists already seen
479 ;; if alist is provided use that list. 482 ;; and use imenu--index-alist.
480 (or alist 483 (if alist
481 (setq alist imenu--index-alist)) 484 (setq imenu--cleanup-seen (cons alist imenu--cleanup-seen))
485 (setq alist imenu--index-alist imenu--cleanup-seen (list alist)))
486
482 (and alist 487 (and alist
483 (mapcar 488 (mapcar
484 (function 489 (function
@@ -486,6 +491,8 @@ This function is called after the function pointed out by
486 (cond 491 (cond
487 ((markerp (cdr item)) 492 ((markerp (cdr item))
488 (set-marker (cdr item) nil)) 493 (set-marker (cdr item) nil))
494 ;; Don't process one alist twice.
495 ((memq (cdr item) imenu--cleanup-seen))
489 ((imenu--subalist-p item) 496 ((imenu--subalist-p item)
490 (imenu--cleanup (cdr item)))))) 497 (imenu--cleanup (cdr item))))))
491 alist) 498 alist)