From: Richard M. Stallman Date: Thu, 2 Apr 1998 04:36:00 +0000 (+0000) Subject: (info-lookup->topic-cache): Use defun, not defsubst. X-Git-Tag: emacs-20.3~1740 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0c10ee28b4e045d513d80f61c2ce70d9410d14bc;p=emacs.git (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. --- 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)