Show
Ignore:
Timestamp:
2006年05月03日 18時37分43秒 (3 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk

    • Property svn:ignore changed from
      bin
      to
      bin
      site-lisp
  • trunk/lisp/imenu.el

    r4037 r4073  
    209209;;;###autoload 
    210210(defvar imenu-create-index-function 'imenu-default-create-index-function 
    211   "The function to use for creating a buffer index. 
    212  
    213 It should be a function that takes no arguments and returns an index 
    214 of the current buffer as an alist. 
    215  
    216 Simple elements in the alist look like (INDEX-NAME . INDEX-POSITION). 
    217 Special elements look like (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...). 
    218 A nested sub-alist element looks like (INDEX-NAME SUB-ALIST). 
    219 The function `imenu--subalist-p' tests an element and returns t 
    220 if it is a sub-alist. 
    221  
    222 This function is called within a `save-excursion'.") 
     211  "The function to use for creating an index alist of the current buffer. 
     212 
     213It should be a function that takes no arguments and returns 
     214an index alist of the current buffer.  The function is 
     215called within a `save-excursion'. 
     216 
     217See `imenu--index-alist' for the format of the buffer index alist.") 
    223218;;;###autoload 
    224219(make-variable-buffer-local 'imenu-create-index-function) 
     
    432427;; Buffer local. 
    433428(defvar imenu--index-alist nil 
    434   "The buffer index computed for this buffer in Imenu. 
    435 Simple elements in the alist look like (INDEX-NAME . INDEX-POSITION). 
    436 Special elements look like (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...). 
    437 A nested sub-alist element looks like (INDEX-NAME SUB-ALIST).") 
     429  "The buffer index alist computed for this buffer in Imenu. 
     430 
     431Simple elements in the alist look like (INDEX-NAME . POSITION). 
     432POSITION is the buffer position of the item; to go to the item 
     433is simply to move point to that position. 
     434 
     435Special elements look like (INDEX-NAME POSITION FUNCTION ARGUMENTS...). 
     436To \"go to\" a special element means applying FUNCTION 
     437to INDEX-NAME, POSITION, and the ARGUMENTS. 
     438 
     439A nested sub-alist element looks like (INDEX-NAME SUB-ALIST). 
     440The function `imenu--subalist-p' tests an element and returns t 
     441if it is a sub-alist. 
     442 
     443There is one simple element with negative POSITION; selecting that 
     444element recalculates the buffer's index alist.") 
    438445 
    439446(make-variable-buffer-local 'imenu--index-alist) 
    440447 
    441448(defvar imenu--last-menubar-index-alist nil 
    442   "The latest buffer index used to update the menu bar menu.") 
     449  "The latest buffer index alist used to update the menu bar menu.") 
    443450 
    444451(make-variable-buffer-local 'imenu--last-menubar-index-alist) 
     
    548555 
    549556(defun imenu--make-index-alist (&optional noerror) 
    550   "Create an index-alist for the definitions in the current buffer. 
    551  
     557  "Create an index alist for the definitions in the current buffer. 
     558This works by using the hook function `imenu-create-index-function'. 
    552559Report an error if the list is empty unless NOERROR is supplied and 
    553560non-nil. 
    554561 
    555 Simple elements in the alist look like (INDEX-NAME . INDEX-POSITION). 
    556 Special elements look like (INDEX-NAME FUNCTION ARGUMENTS...). 
    557 A nested sub-alist element looks like (INDEX-NAME SUB-ALIST). 
    558 The function `imenu--subalist-p' tests an element and returns t 
    559 if it is a sub-alist. 
    560  
    561 There is one simple element with negative POSITION; that's intended 
    562 as a way for the user to ask to recalculate the buffer's index alist." 
     562See `imenu--index-alist' for the format of the index alist." 
    563563  (or (and imenu--index-alist 
    564564           (or (not imenu-auto-rescan) 
     
    658658 
    659659(defun imenu-default-create-index-function () 
    660   "*Wrapper for index searching functions
    661  
    662 Moves point to end of buffer and then repeatedly calls 
     660  "*Default function to create an index alist of the current buffer
     661 
     662The most general method is to move point to end of buffer, then repeatedly call 
    663663`imenu-prev-index-position-function' and `imenu-extract-index-name-function'. 
    664 Their results are gathered into an index alist." 
     664All the results returned by the latter are gathered into an index alist. 
     665This method is used if those two variables are non-nil. 
     666 
     667The alternate method, which is the one most often used, is to call 
     668`imenu--generic-function' with `imenu-generic-expression' as argument." 
    665669  ;; These should really be done by setting imenu-create-index-function 
    666670  ;; in these major modes.  But save that change for later. 
     
    688692         (error "This buffer cannot use `imenu-default-create-index-function'")))) 
    689693 
    690 ;; Not used and would require cl at run time 
    691 ;; (defun imenu--flatten-index-alist (index-alist &optional concat-names prefix) 
    692 ;;   ;; Takes a nested INDEX-ALIST and returns a flat index alist. 
    693 ;;   ;; If optional CONCAT-NAMES is non-nil, then a nested index has its 
    694 ;;   ;; name and a space concatenated to the names of the children. 
    695 ;;   ;; Third argument PREFIX is for internal use only. 
    696 ;;   (mapcan 
    697 ;;    (lambda (item) 
    698 ;;      (let* ((name (car item)) 
    699 ;;          (pos (cdr item)) 
    700 ;;          (new-prefix (and concat-names 
    701 ;;                           (if prefix 
    702 ;;                               (concat prefix imenu-level-separator name) 
    703 ;;                             name)))) 
    704 ;;        (cond 
    705 ;;      ((or (markerp pos) (numberp pos)) 
    706 ;;       (list (cons new-prefix pos))) 
    707 ;;      (t 
    708 ;;       (imenu--flatten-index-alist pos new-prefix))))) 
    709 ;;    index-alist)) 
    710  
    711694;;; 
    712695;;; Generic index gathering function. 
     
    725708;; so it needs to be careful never to loop! 
    726709(defun imenu--generic-function (patterns) 
    727   "Return an index of the current buffer as an alist
     710  "Return an index alist of the current buffer based on PATTERNS
    728711 
    729712PATTERNS is an alist with elements that look like this: 
     
    733716with zero or more ARGUMENTS.  The former format creates a simple 
    734717element in the index alist when it matches; the latter creates a 
    735 special element of the form (NAME POSITION-MARKER FUNCTION 
    736 ARGUMENTS...)  with FUNCTION and ARGUMENTS copied from 
    737 `imenu-generic-expression'. 
     718special element of the form (INDEX-NAME POSITION-MARKER FUNCTION 
     719ARGUMENTS...) with FUNCTION and ARGUMENTS copied from PATTERNS. 
    738720 
    739721MENU-TITLE is a string used as the title for the submenu or nil