/[emacs]/emacs/lisp/imenu.el
ViewVC logotype

Diff of /emacs/lisp/imenu.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.89 by rms, Mon Mar 18 04:27:30 2002 UTC revision 1.89.2.1 by miles, Fri Apr 4 06:20:08 2003 UTC
# Line 104  This variable is buffer-local." Line 104  This variable is buffer-local."
104    :type 'integer    :type 'integer
105    :group 'imenu)    :group 'imenu)
106    
107  (defcustom imenu-always-use-completion-buffer-p nil  (defvar imenu-always-use-completion-buffer-p nil)
108    "*Set this to non-nil for displaying the index in a completion buffer.  (make-obsolete-variable 'imenu-always-use-completion-buffer-p
109                            'imenu-use-popup-menu "21.4")
110  `never' means never automatically display a listing of any kind.  
111  A value of nil (the default) means display the index as a mouse menu  (defcustom imenu-use-popup-menu
112  if the mouse was used to invoke `imenu'.    (if imenu-always-use-completion-buffer-p
113  Another non-nil value means always display the index in a completion buffer."        (not (eq imenu-always-use-completion-buffer-p 'never))
114    :type '(choice (const :tag "On Mouse" nil)      'on-mouse)
115                   (const :tag "Never" never)    "Use a popup menu rather than a minibuffer prompt.
116                   (other :tag "Always" t))  If nil, always use a minibuffer prompt.
117    :group 'imenu)  If t, always use a popup menu,
118    If `on-mouse' use a popup menu when `imenu' was invoked with the mouse."
119      :type '(choice (const :tag "On Mouse" on-mouse)
120                     (const :tag "Never" nil)
121                     (other :tag "Always" t)))
122    
123    (defcustom imenu-eager-completion-buffer
124      (not (eq imenu-always-use-completion-buffer-p 'never))
125      "If non-nil, eagerly popup the completion buffer."
126      :type 'boolean)
127    
128  (defcustom imenu-after-jump-hook nil  (defcustom imenu-after-jump-hook nil
129    "*Hooks called after jumping to a place in the buffer.    "*Hooks called after jumping to a place in the buffer.
# Line 164  which case you might as well set this to Line 173  which case you might as well set this to
173    "*The replacement string for spaces in index names.    "*The replacement string for spaces in index names.
174  Used when presenting the index in a completion buffer to make the  Used when presenting the index in a completion buffer to make the
175  names work as tokens."  names work as tokens."
176    :type 'string    :type '(choice string (const nil))
177    :group 'imenu)    :group 'imenu)
178    
179  (defcustom imenu-level-separator ":"  (defcustom imenu-level-separator ":"
# Line 667  as a way for the user to ask to recalcul Line 676  as a way for the user to ask to recalcul
676    "Alist of syntax table modifiers to use while in `imenu--generic-function'.    "Alist of syntax table modifiers to use while in `imenu--generic-function'.
677    
678  The car of the assocs may be either a character or a string and the  The car of the assocs may be either a character or a string and the
679  cdr is a syntax description appropriate fo `modify-syntax-entry'.  For  cdr is a syntax description appropriate for `modify-syntax-entry'.  For
680  a string, all the characters in the string get the specified syntax.  a string, all the characters in the string get the specified syntax.
681    
682  This is typically used to give word syntax to characters which  This is typically used to give word syntax to characters which
# Line 779  PATTERNS." Line 788  PATTERNS."
788        ;; The character(s) to modify may be a single char or a string.        ;; The character(s) to modify may be a single char or a string.
789        (if (numberp (car syn))        (if (numberp (car syn))
790            (modify-syntax-entry (car syn) (cdr syn) table)            (modify-syntax-entry (car syn) (cdr syn) table)
791          (dolist (c (car syn))          (mapc (lambda (c)
792            (modify-syntax-entry c (cdr syn) table))))                  (modify-syntax-entry c (cdr syn) table))
793                  (car syn))))
794      (goto-char (point-max))      (goto-char (point-max))
795      (imenu-progress-message prev-pos 0 t)      (imenu-progress-message prev-pos 0 t)
796      (unwind-protect                     ; for syntax table      (unwind-protect                     ; for syntax table
# Line 857  Returns t for rescan and otherwise a pos Line 867  Returns t for rescan and otherwise a pos
867    (let ((name (thing-at-point 'symbol))    (let ((name (thing-at-point 'symbol))
868          choice          choice
869          (prepared-index-alist          (prepared-index-alist
870           (mapcar           (if (not imenu-space-replacement) index-alist
871            (lambda (item)             (mapcar
872              (cons (subst-char-in-string ?\ (aref imenu-space-replacement 0)              (lambda (item)
873                                          (car item))                (cons (subst-char-in-string ?\ (aref imenu-space-replacement 0)
874                    (cdr item)))                                            (car item))
875            index-alist)))                      (cdr item)))
876                index-alist))))
877      (when (stringp name)      (when (stringp name)
878        (setq name (or (imenu-find-default name prepared-index-alist) name)))        (setq name (or (imenu-find-default name prepared-index-alist) name)))
879      (cond (prompt)      (cond (prompt)
880            ((and name (imenu--in-alist name prepared-index-alist))            ((and name (imenu--in-alist name prepared-index-alist))
881             (setq prompt (format "Index item (default %s): " name)))             (setq prompt (format "Index item (default %s): " name)))
882            (t (setq prompt "Index item: ")))            (t (setq prompt "Index item: ")))
883      (if (eq imenu-always-use-completion-buffer-p 'never)      (let ((minibuffer-setup-hook minibuffer-setup-hook))
884          (setq name (completing-read prompt        ;; Display the completion buffer.
885                                      prepared-index-alist        (if (not imenu-eager-completion-buffer)
886                                      nil t nil 'imenu--history-list name))            (add-hook 'minibuffer-setup-hook 'minibuffer-completion-help))
887        (save-window-excursion        (setq name (completing-read prompt
888          ;; Display the completion buffer                                    prepared-index-alist
889          (with-output-to-temp-buffer "*Completions*"                                    nil t nil 'imenu--history-list name)))
           (display-completion-list  
            (all-completions "" prepared-index-alist )))  
         (let ((minibuffer-setup-hook  
                (function  
                 (lambda ()  
                   (let ((buffer (current-buffer)))  
                     (with-current-buffer "*Completions*"  
                       (setq completion-reference-buffer buffer)))))))  
           ;; Make a completion question  
           (setq name (completing-read prompt  
                                       prepared-index-alist  
                                       nil t nil 'imenu--history-list name)))))  
890      (cond ((not (stringp name)) nil)      (cond ((not (stringp name)) nil)
891            ((string= name (car imenu--rescan-item)) t)            ((string= name (car imenu--rescan-item)) t)
892            (t            (t
# Line 923  select from ALIST. Line 922  select from ALIST.
922  With no index alist ALIST, it calls `imenu--make-index-alist' to  With no index alist ALIST, it calls `imenu--make-index-alist' to
923  create the index alist.  create the index alist.
924    
925  If `imenu-always-use-completion-buffer-p' is non-nil, then the  If `imenu-use-popup-menu' is non-nil, then the
926  completion buffer is always used, no matter if the mouse was used or  completion buffer is always used, no matter if the mouse was used or
927  not.  not.
928    
# Line 941  The returned value is of the form (INDEX Line 940  The returned value is of the form (INDEX
940      (while (eq result t)      (while (eq result t)
941        (setq index-alist (if alist alist (imenu--make-index-alist)))        (setq index-alist (if alist alist (imenu--make-index-alist)))
942        (setq result        (setq result
943              (if (and mouse-triggered              (if (and imenu-use-popup-menu
944                       (not imenu-always-use-completion-buffer-p))                       (or (eq imenu-use-popup-menu t) mouse-triggered))
945                  (imenu--mouse-menu index-alist last-nonmenu-event)                  (imenu--mouse-menu index-alist last-nonmenu-event)
946                (imenu--completion-buffer index-alist prompt)))                (imenu--completion-buffer index-alist prompt)))
947        (and (eq result t)        (and (eq result t)

Legend:
Removed from v.1.89  
changed lines
  Added in v.1.89.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26