summaryrefslogtreecommitdiff
path: root/lisp/info-look.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-04-02 04:36:00 +0000
committerRichard M. Stallman <rms@gnu.org>1998-04-02 04:36:00 +0000
commit0c10ee28b4e045d513d80f61c2ce70d9410d14bc (patch)
tree86ba2ca7476029422cfe5e0f32e00325858096d9 /lisp/info-look.el
parentff7534387622b01af5bcb5a07b09d17accbf1d24 (diff)
downloademacs-0c10ee28b4e045d513d80f61c2ce70d9410d14bc.tar.gz
emacs-0c10ee28b4e045d513d80f61c2ce70d9410d14bc.tar.bz2
emacs-0c10ee28b4e045d513d80f61c2ce70d9410d14bc.zip
(info-lookup->topic-cache): Use defun, not defsubst.
(info-lookup->mode-cache, info-lookup->initialized): Likewise. (info-lookup->completions, info-lookup->refer-modes): Likewise. (info-lookup->all-modes): Likewise. (info-lookup-quick-all-modes): New function. (info-complete): Find the symbol to complete first, then compute list of completions. (lisp-mode): Add info-lookup-maybe-add-help for it.
Diffstat (limited to 'lisp/info-look.el')
-rw-r--r--lisp/info-look.el60
1 files changed, 36 insertions, 24 deletions
diff --git a/lisp/info-look.el b/lisp/info-look.el
index 8a8faffa5a9..d223cb64c8b 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -208,28 +208,31 @@ REFER-MODES is a list of other help modes to use.")
(cons (cons topic nil)
info-lookup-cache)))))
-(defsubst info-lookup->topic-cache (topic)
+(defun info-lookup->topic-cache (topic)
(cdr (info-lookup->cache topic)))
-(defsubst info-lookup->mode-cache (topic mode)
+(defun info-lookup->mode-cache (topic mode)
(assoc mode (info-lookup->topic-cache topic)))
-(defsubst info-lookup->initialized (topic mode)
+(defun info-lookup->initialized (topic mode)
(nth 1 (info-lookup->mode-cache topic mode)))
-(defsubst info-lookup->completions (topic mode)
+(defun info-lookup->completions (topic mode)
(or (info-lookup->initialized topic mode)
(info-lookup-setup-mode topic mode))
(nth 2 (info-lookup->mode-cache topic mode)))
-(defsubst info-lookup->refer-modes (topic mode)
+(defun info-lookup->refer-modes (topic mode)
(or (info-lookup->initialized topic mode)
(info-lookup-setup-mode topic mode))
(nth 3 (info-lookup->mode-cache topic mode)))
-(defsubst info-lookup->all-modes (topic mode)
+(defun info-lookup->all-modes (topic mode)
(cons mode (info-lookup->refer-modes topic mode)))
+(defun info-lookup-quick-all-modes (topic mode)
+ (cons mode (info-lookup->other-modes topic mode)))
+
;;;###autoload
(defun info-lookup-reset ()
"Throw away all cached data.
@@ -541,10 +544,9 @@ Return nil if there is nothing appropriate."
(setq mode (or info-lookup-mode major-mode)))
(or (info-lookup->mode-value topic mode)
(error "No %s completion available for `%s'" topic mode))
- (let ((modes (info-lookup->all-modes topic mode))
- (completions (info-lookup->completions topic mode))
- (completion-ignore-case (info-lookup->ignore-case topic mode))
- (start (point)) try completion)
+ (let ((modes (info-lookup-quick-all-modes topic mode))
+ (start (point))
+ try)
(while (and (not try) modes)
(setq mode (car modes)
modes (cdr modes)
@@ -552,20 +554,24 @@ Return nil if there is nothing appropriate."
(goto-char start))
(and (not try)
(error "Found no %S to complete" topic))
- (setq completion (try-completion try completions))
- (cond ((not completion)
- (ding)
- (message "No match"))
- ((stringp completion)
- (or (assoc completion completions)
- (setq completion (completing-read
- (format "Complete %S: " topic)
- completions nil t completion
- info-lookup-history)))
- (delete-region (- start (length try)) start)
- (insert completion))
- (t
- (message "%s is complete" (capitalize (prin1-to-string topic)))))))
+ (let ((completions (info-lookup->completions topic mode))
+ (completion-ignore-case (info-lookup->ignore-case topic mode))
+ completion)
+ (setq completion (try-completion try completions))
+ (cond ((not completion)
+ (ding)
+ (message "No match"))
+ ((stringp completion)
+ (or (assoc completion completions)
+ (setq completion (completing-read
+ (format "Complete %S: " topic)
+ completions nil t completion
+ info-lookup-history)))
+ (delete-region (- start (length try)) start)
+ (insert completion))
+ (t
+ (message "%s is complete"
+ (capitalize (prin1-to-string topic))))))))
;;; Info-lookup minor mode.
@@ -760,6 +766,12 @@ Special commands:
:parse-rule 'ignore
:other-modes '(emacs-lisp-mode))
+(info-lookup-maybe-add-help
+ :mode 'lisp-mode
+ :regexp "[^()' \t\n]+"
+ :parse-rule 'ignore
+ :other-modes '(emacs-lisp-mode))
+
(provide 'info-look)