aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-10-09 14:44:21 +0200
committerLars Ingebrigtsen2021-10-09 14:44:21 +0200
commitf839c7f2c00d95a96994adbcd862cc58d761ea69 (patch)
treed1aaf275cdfd5d01d148b708389895dbcba1503d
parent72a959c132fb0e9338c70688d6e85da0f81ae2ae (diff)
downloademacs-f839c7f2c00d95a96994adbcd862cc58d761ea69.tar.gz
emacs-f839c7f2c00d95a96994adbcd862cc58d761ea69.zip
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).
-rw-r--r--lisp/info-look.el74
1 files changed, 73 insertions, 1 deletions
diff --git a/lisp/info-look.el b/lisp/info-look.el
index 309f2e8d631..881f63c140c 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -358,9 +358,19 @@ If optional argument QUERY is non-nil, query for the help mode."
358 (error "No %s help available for `%s'" topic mode)) 358 (error "No %s help available for `%s'" topic mode))
359 (setq info-lookup-mode mode))) 359 (setq info-lookup-mode mode)))
360 360
361(defun info-lookup--item-to-mode (item mode)
362 (let ((spec (cons mode (car (split-string (if (stringp item)
363 item
364 (symbol-name item))
365 "-")))))
366 (if (assoc spec (cdr (assq 'symbol info-lookup-alist)))
367 spec
368 mode)))
369
361(defun info-lookup (topic item mode) 370(defun info-lookup (topic item mode)
362 "Display the documentation of a help item." 371 "Display the documentation of a help item."
363 (or mode (setq mode (info-lookup-select-mode))) 372 (or mode (setq mode (info-lookup-select-mode)))
373 (setq mode (info-lookup--item-to-mode item mode))
364 (if-let ((info (info-lookup->mode-value topic mode))) 374 (if-let ((info (info-lookup->mode-value topic mode)))
365 (info-lookup--expand-info info) 375 (info-lookup--expand-info info)
366 (error "No %s help available for `%s'" topic mode)) 376 (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."
969 ;; sort of fallback match scheme existed. 979 ;; sort of fallback match scheme existed.
970 ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)") 980 ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)")
971 ("(cl)Function Index" nil "^ -+ .*: " "\\( \\|$\\)") 981 ("(cl)Function Index" nil "^ -+ .*: " "\\( \\|$\\)")
972 ("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)"))) 982 ("(cl)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)")
983 ("(dired-x)Index" nil "^ -+ .*: " "\\( \\|$\\)")))
984
985(mapc
986 (lambda (elem)
987 (let* ((prefix (car elem)))
988 (info-lookup-add-help
989 :mode (cons 'emacs-lisp-mode prefix)
990 :regexp (concat "\\b" prefix "-[^][()`'‘’,\" \t\n]+")
991 :doc-spec (cl-loop for node in (cdr elem)
992 collect
993 (list (if (string-match-p "^(" node)
994 node
995 (format "(%s)%s" prefix node))
996 nil "^ -+ .*: " "\\( \\|$\\)")))))
997 ;; Below we have a list of prefixes (used to match on symbols in
998 ;; `emacs-lisp-mode') and the nodes where the function/variable
999 ;; indices live. If the prefix is different than the name of the
1000 ;; manual, then the full "(manual)Node" name has to be used.
1001 '(("auth" "Function Index" "Variable Index")
1002 ("autotype" "Command Index" "Variable Index")
1003 ("calc" "Lisp Function Index" "Variable Index")
1004 ;;("cc-mode" "Variable Index" "Command and Function Index")
1005 ("dbus" "Index")
1006 ("ediff" "Index")
1007 ("eieio" "Function Index")
1008 ("gnutls" "(emacs-gnutls)Variable Index" "(emacs-gnutls)Function Index")
1009 ("mm" "(emacs-mime)Index")
1010 ("epa" "Variable Index" "Function Index")
1011 ("ert" "Index")
1012 ("eshell" "Function and Variable Index")
1013 ("eudc" "Index")
1014 ("eww" "Variable Index" "Lisp Function Index")
1015 ("flymake" "Index")
1016 ("forms" "Index")
1017 ("gnus" "Index")
1018 ("htmlfontify" "Functions" "Variables & Customization")
1019 ("idlwave" "Index")
1020 ("ido" "Variable Index" "Function Index")
1021 ("info" "Index")
1022 ("mairix" "(mairix-el)Variable Index" "(mairix-el)Function Index")
1023 ("message" "Index")
1024 ("mh" "(mh-e)Option Index" "(mh-e)Command Index")
1025 ("newsticker" "Index")
1026 ("octave" "(octave-mode)Variable Index" "(octave-mode)Lisp Function Index")
1027 ("org" "Variable Index" "Command and Function Index")
1028 ("pgg" "Variable Index" "Function Index")
1029 ("rcirc" "Variable Index" "Index")
1030 ("reftex" "Index")
1031 ("sasl" "Variable Index" "Function Index")
1032 ("sc" "Variable Index")
1033 ("semantic" "Index")
1034 ("ses" "Index")
1035 ("sieve" "Index")
1036 ("smtpmail" "Function and Variable Index")
1037 ("srecode" "Index")
1038 ("tramp" "Variable Index" "Function Index")
1039 ("url" "Variable Index" "Function Index")
1040 ("vhdl" "(vhdl-mode)Variable Index" "(vhdl-mode)Command Index")
1041 ("viper" "Variable Index" "Function Index")
1042 ("widget" "Index")
1043 ("wisent" "Index")
1044 ("woman" "Variable Index" "Command Index")))
973 1045
974;; docstrings talk about elisp, so have apropos-mode follow emacs-lisp-mode 1046;; docstrings talk about elisp, so have apropos-mode follow emacs-lisp-mode
975(info-lookup-maybe-add-help 1047(info-lookup-maybe-add-help