1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Make `C-h S' work on symbols from most of the manuals in Emacs

* lisp/info-look.el (lambda): Add `C-h S' lookup for all the
"misc" manuals in Emacs (bug#42753).
This commit is contained in:
Lars Ingebrigtsen 2021-10-09 14:44:21 +02:00
parent 72a959c132
commit f839c7f2c0

View file

@ -358,9 +358,19 @@ If optional argument QUERY is non-nil, query for the help mode."
(error "No %s help available for `%s'" topic mode))
(setq info-lookup-mode mode)))
(defun info-lookup--item-to-mode (item mode)
(let ((spec (cons mode (car (split-string (if (stringp item)
item
(symbol-name item))
"-")))))
(if (assoc spec (cdr (assq 'symbol info-lookup-alist)))
spec
mode)))
(defun info-lookup (topic item mode)
"Display the documentation of a help item."
(or mode (setq mode (info-lookup-select-mode)))
(setq mode (info-lookup--item-to-mode item mode))
(if-let ((info (info-lookup->mode-value topic mode)))
(info-lookup--expand-info info)
(error "No %s help available for `%s'" topic mode))
@ -969,7 +979,69 @@ Return nil if there is nothing appropriate in the buffer near point."
;; sort of fallback match scheme existed.
("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)")
("(cl)Function Index" nil "^ -+ .*: " "\\( \\|$\\)")
("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)")))
("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)")
("(dired-x)Index" nil "^ -+ .*: " "\\( \\|$\\)")))
(mapc
(lambda (elem)
(let* ((prefix (car elem)))
(info-lookup-add-help
:mode (cons 'emacs-lisp-mode prefix)
:regexp (concat "\\b" prefix "-[^][()`',\" \t\n]+")
:doc-spec (cl-loop for node in (cdr elem)
collect
(list (if (string-match-p "^(" node)
node
(format "(%s)%s" prefix node))
nil "^ -+ .*: " "\\( \\|$\\)")))))
;; Below we have a list of prefixes (used to match on symbols in
;; `emacs-lisp-mode') and the nodes where the function/variable
;; indices live. If the prefix is different than the name of the
;; manual, then the full "(manual)Node" name has to be used.
'(("auth" "Function Index" "Variable Index")
("autotype" "Command Index" "Variable Index")
("calc" "Lisp Function Index" "Variable Index")
;;("cc-mode" "Variable Index" "Command and Function Index")
("dbus" "Index")
("ediff" "Index")
("eieio" "Function Index")
("gnutls" "(emacs-gnutls)Variable Index" "(emacs-gnutls)Function Index")
("mm" "(emacs-mime)Index")
("epa" "Variable Index" "Function Index")
("ert" "Index")
("eshell" "Function and Variable Index")
("eudc" "Index")
("eww" "Variable Index" "Lisp Function Index")
("flymake" "Index")
("forms" "Index")
("gnus" "Index")
("htmlfontify" "Functions" "Variables & Customization")
("idlwave" "Index")
("ido" "Variable Index" "Function Index")
("info" "Index")
("mairix" "(mairix-el)Variable Index" "(mairix-el)Function Index")
("message" "Index")
("mh" "(mh-e)Option Index" "(mh-e)Command Index")
("newsticker" "Index")
("octave" "(octave-mode)Variable Index" "(octave-mode)Lisp Function Index")
("org" "Variable Index" "Command and Function Index")
("pgg" "Variable Index" "Function Index")
("rcirc" "Variable Index" "Index")
("reftex" "Index")
("sasl" "Variable Index" "Function Index")
("sc" "Variable Index")
("semantic" "Index")
("ses" "Index")
("sieve" "Index")
("smtpmail" "Function and Variable Index")
("srecode" "Index")
("tramp" "Variable Index" "Function Index")
("url" "Variable Index" "Function Index")
("vhdl" "(vhdl-mode)Variable Index" "(vhdl-mode)Command Index")
("viper" "Variable Index" "Function Index")
("widget" "Index")
("wisent" "Index")
("woman" "Variable Index" "Command Index")))
;; docstrings talk about elisp, so have apropos-mode follow emacs-lisp-mode
(info-lookup-maybe-add-help