aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1998-04-02 04:36:00 +0000
committerRichard M. Stallman1998-04-02 04:36:00 +0000
commit0c10ee28b4e045d513d80f61c2ce70d9410d14bc (patch)
tree86ba2ca7476029422cfe5e0f32e00325858096d9 /lisp
parentff7534387622b01af5bcb5a07b09d17accbf1d24 (diff)
downloademacs-0c10ee28b4e045d513d80f61c2ce70d9410d14bc.tar.gz
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')
-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.")
208 (cons (cons topic nil) 208 (cons (cons topic nil)
209 info-lookup-cache))))) 209 info-lookup-cache)))))
210 210
211(defsubst info-lookup->topic-cache (topic) 211(defun info-lookup->topic-cache (topic)
212 (cdr (info-lookup->cache topic))) 212 (cdr (info-lookup->cache topic)))
213 213
214(defsubst info-lookup->mode-cache (topic mode) 214(defun info-lookup->mode-cache (topic mode)
215 (assoc mode (info-lookup->topic-cache topic))) 215 (assoc mode (info-lookup->topic-cache topic)))
216 216
217(defsubst info-lookup->initialized (topic mode) 217(defun info-lookup->initialized (topic mode)
218 (nth 1 (info-lookup->mode-cache topic mode))) 218 (nth 1 (info-lookup->mode-cache topic mode)))
219 219
220(defsubst info-lookup->completions (topic mode) 220(defun info-lookup->completions (topic mode)
221 (or (info-lookup->initialized topic mode) 221 (or (info-lookup->initialized topic mode)
222 (info-lookup-setup-mode topic mode)) 222 (info-lookup-setup-mode topic mode))
223 (nth 2 (info-lookup->mode-cache topic mode))) 223 (nth 2 (info-lookup->mode-cache topic mode)))
224 224
225(defsubst info-lookup->refer-modes (topic mode) 225(defun info-lookup->refer-modes (topic mode)
226 (or (info-lookup->initialized topic mode) 226 (or (info-lookup->initialized topic mode)
227 (info-lookup-setup-mode topic mode)) 227 (info-lookup-setup-mode topic mode))
228 (nth 3 (info-lookup->mode-cache topic mode))) 228 (nth 3 (info-lookup->mode-cache topic mode)))
229 229
230(defsubst info-lookup->all-modes (topic mode) 230(defun info-lookup->all-modes (topic mode)
231 (cons mode (info-lookup->refer-modes topic mode))) 231 (cons mode (info-lookup->refer-modes topic mode)))
232 232
233(defun info-lookup-quick-all-modes (topic mode)
234 (cons mode (info-lookup->other-modes topic mode)))
235
233;;;###autoload 236;;;###autoload
234(defun info-lookup-reset () 237(defun info-lookup-reset ()
235 "Throw away all cached data. 238 "Throw away all cached data.
@@ -541,10 +544,9 @@ Return nil if there is nothing appropriate."
541 (setq mode (or info-lookup-mode major-mode))) 544 (setq mode (or info-lookup-mode major-mode)))
542 (or (info-lookup->mode-value topic mode) 545 (or (info-lookup->mode-value topic mode)
543 (error "No %s completion available for `%s'" topic mode)) 546 (error "No %s completion available for `%s'" topic mode))
544 (let ((modes (info-lookup->all-modes topic mode)) 547 (let ((modes (info-lookup-quick-all-modes topic mode))
545 (completions (info-lookup->completions topic mode)) 548 (start (point))
546 (completion-ignore-case (info-lookup->ignore-case topic mode)) 549 try)
547 (start (point)) try completion)
548 (while (and (not try) modes) 550 (while (and (not try) modes)
549 (setq mode (car modes) 551 (setq mode (car modes)
550 modes (cdr modes) 552 modes (cdr modes)
@@ -552,20 +554,24 @@ Return nil if there is nothing appropriate."
552 (goto-char start)) 554 (goto-char start))
553 (and (not try) 555 (and (not try)
554 (error "Found no %S to complete" topic)) 556 (error "Found no %S to complete" topic))
555 (setq completion (try-completion try completions)) 557 (let ((completions (info-lookup->completions topic mode))
556 (cond ((not completion) 558 (completion-ignore-case (info-lookup->ignore-case topic mode))
557 (ding) 559 completion)
558 (message "No match")) 560 (setq completion (try-completion try completions))
559 ((stringp completion) 561 (cond ((not completion)
560 (or (assoc completion completions) 562 (ding)
561 (setq completion (completing-read 563 (message "No match"))
562 (format "Complete %S: " topic) 564 ((stringp completion)
563 completions nil t completion 565 (or (assoc completion completions)
564 info-lookup-history))) 566 (setq completion (completing-read
565 (delete-region (- start (length try)) start) 567 (format "Complete %S: " topic)
566 (insert completion)) 568 completions nil t completion
567 (t 569 info-lookup-history)))
568 (message "%s is complete" (capitalize (prin1-to-string topic))))))) 570 (delete-region (- start (length try)) start)
571 (insert completion))
572 (t
573 (message "%s is complete"
574 (capitalize (prin1-to-string topic))))))))
569 575
570 576
571;;; Info-lookup minor mode. 577;;; Info-lookup minor mode.
@@ -760,6 +766,12 @@ Special commands:
760 :parse-rule 'ignore 766 :parse-rule 'ignore
761 :other-modes '(emacs-lisp-mode)) 767 :other-modes '(emacs-lisp-mode))
762 768
769(info-lookup-maybe-add-help
770 :mode 'lisp-mode
771 :regexp "[^()' \t\n]+"
772 :parse-rule 'ignore
773 :other-modes '(emacs-lisp-mode))
774
763 775
764(provide 'info-look) 776(provide 'info-look)
765 777