;;; imenu.el --- framework for mode-specific buffer indexes
-;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2001-2012 Free Software Foundation, Inc.
;; Author: Ake Stenhoff <etxaksf@aom.ericsson.se>
;; Lars Lindberg <lli@sypro.cap.se>
;; No longer used. KFS 2004-10-27
;; (defcustom imenu-scanning-message "Scanning buffer for index (%3d%%)"
-;; "*Progress message during the index scanning of the buffer.
+;; "Progress message during the index scanning of the buffer.
;; If non-nil, user gets a message during the scanning of the buffer.
;;
;; Relevant only if the mode-specific function that creates the buffer
`fortran-mode' with `imenu-syntax-alist' set locally to give the
characters which normally have \"symbol\" syntax \"word\" syntax
during matching.")
+;;;###autoload(put 'imenu-generic-expression 'risky-local-variable t)
;;;###autoload
(make-variable-buffer-local 'imenu-generic-expression)
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; FIXME: This is the only imenu-example-* definition that's actually used,
-;; and it seems to only be used by cperl-mode.el. We should just move it to
-;; cperl-mode.el and remove the rest.
+;; FIXME: This was the only imenu-example-* definition actually used,
+;; by cperl-mode.el. Now cperl-mode has its own copy, so these can
+;; all be removed.
(defun imenu-example--name-and-position ()
"Return the current/previous sexp and its (beginning) location.
Don't move point."
(end (progn (forward-sexp) (point))))
(cons (buffer-substring beg end)
beg))))
+(make-obsolete 'imenu-example--name-and-position
+ "use your own function instead." "23.2")
;;;
;;; Lisp
(end (progn (forward-sexp -1) (point))))
(buffer-substring beg end)))
(error nil)))))
+(make-obsolete 'imenu-example--lisp-extract-index-name "your own" "23.2")
(defun imenu-example--create-lisp-index ()
;; Example of a candidate for `imenu-create-index-function'.
(push (cons "Syntax-unknown" index-unknown-alist)
index-alist))
index-alist))
+(make-obsolete 'imenu-example--create-lisp-index "your own" "23.2")
;; Regular expression to find C functions
(defvar imenu-example--function-name-regexp-c
(push (imenu-example--name-and-position) index-alist))))
(imenu-progress-message prev-pos 100)
(nreverse index-alist)))
-
+(make-obsolete 'imenu-example--create-c-index "your own" "23.2")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
There is one simple element with negative POSITION; selecting that
element recalculates the buffer's index alist.")
+;;;###autoload(put 'imenu--index-alist 'risky-local-variable t)
(make-variable-buffer-local '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.
+;;; non-nil arguments are in recursive calls.
(defvar imenu--cleanup-seen)
(defun imenu--cleanup (&optional alist)
;; in these major modes. But save that change for later.
(cond ((and imenu-prev-index-position-function
imenu-extract-index-name-function)
- (let ((index-alist '())
+ (let ((index-alist '()) (pos (point))
prev-pos name)
(goto-char (point-max))
(imenu-progress-message prev-pos 0 t)
;; Search for the function
(while (funcall imenu-prev-index-position-function)
+ (when (= pos (point))
+ (error "Infinite loop at %s:%d: imenu-prev-index-position-function does not move point" (buffer-name) pos))
+ (setq pos (point))
(imenu-progress-message prev-pos nil t)
(save-excursion
(setq name (funcall imenu-extract-index-name-function)))
(provide 'imenu)
-;; arch-tag: 98a2f5f5-4b91-4704-b18c-3aacf77d77a7
;;; imenu.el ends here