Mercurial > emacs
changeset 21334:66b3b9fe3e3c
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 02 Apr 1998 04:36:00 +0000 |
parents | a6119c0748e9 |
children | 8f9e7600c250 |
files | lisp/info-look.el |
diffstat | 1 files changed, 36 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/info-look.el Thu Apr 02 03:37:18 1998 +0000 +++ b/lisp/info-look.el Thu Apr 02 04:36:00 1998 +0000 @@ -208,28 +208,31 @@ (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 @@ (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 @@ (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 @@ :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)