aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-01 16:45:24 +0200
committerLars Ingebrigtsen2019-10-01 16:45:24 +0200
commitbc95fc78bbf9c91ce5c3adb7d199c84c0c5032ca (patch)
treec1aed75ee2cd25d183a3fae7dc6328ba4bbc9c54
parent28b7dd4ee4bb0c9d93435b88fed30fa20c317031 (diff)
downloademacs-bc95fc78bbf9c91ce5c3adb7d199c84c0c5032ca.tar.gz
emacs-bc95fc78bbf9c91ce5c3adb7d199c84c0c5032ca.zip
Make the help page mention the customizeable global mode variable
* lisp/help-fns.el (help-fns--customize-variable): Factor out into own function for reuse. (help-fns--globalized-minor-mode): Use it to mention the equivalent variable. * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Mark globalized minor modes as such (bug#7177).
-rw-r--r--lisp/emacs-lisp/easy-mmode.el1
-rw-r--r--lisp/help-fns.el44
2 files changed, 27 insertions, 18 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index bbc3a27504c..5e7b29eddf8 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -418,6 +418,7 @@ on if the hook has explicitly disabled it.
418 418
419 `(progn 419 `(progn
420 (progn 420 (progn
421 (put ',global-mode 'globalized-minor-mode t)
421 :autoload-end 422 :autoload-end
422 (defvar ,MODE-major-mode nil) 423 (defvar ,MODE-major-mode nil)
423 (make-variable-buffer-local ',MODE-major-mode)) 424 (make-variable-buffer-local ',MODE-major-mode))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index d6b4e763bbc..e9e2818d98a 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -556,6 +556,13 @@ suitable file is found, return nil."
556 (t ".")) 556 (t "."))
557 "\n")))) 557 "\n"))))
558 558
559(add-hook 'help-fns-describe-function-functions
560 #'help-fns--globalized-minor-mode)
561(defun help-fns--globalized-minor-mode (function)
562 (when (get function 'globalized-minor-mode)
563 (help-fns--customize-variable function " the global mode variable.")
564 (terpri)))
565
559;; We could use `symbol-file' but this is a wee bit more efficient. 566;; We could use `symbol-file' but this is a wee bit more efficient.
560(defun help-fns--autoloaded-p (function file) 567(defun help-fns--autoloaded-p (function file)
561 "Return non-nil if FUNCTION has previously been autoloaded. 568 "Return non-nil if FUNCTION has previously been autoloaded.
@@ -1092,28 +1099,29 @@ it is displayed along with the global value."
1092 (with-current-buffer standard-output 1099 (with-current-buffer standard-output
1093 (insert (or doc "Not documented as a variable.")))) 1100 (insert (or doc "Not documented as a variable."))))
1094 1101
1095 ;; Make a link to customize if this variable can be customized.
1096 (when (custom-variable-p variable)
1097 (let ((customize-label "customize"))
1098 (terpri)
1099 (terpri)
1100 (princ (concat "You can " customize-label " this variable."))
1101 (with-current-buffer standard-output
1102 (save-excursion
1103 (re-search-backward
1104 (concat "\\(" customize-label "\\)") nil t)
1105 (help-xref-button 1 'help-customize-variable variable))))
1106 ;; Note variable's version or package version.
1107 (let ((output (describe-variable-custom-version-info variable)))
1108 (when output
1109 (terpri)
1110 (terpri)
1111 (princ output))))
1112
1113 (with-current-buffer standard-output 1102 (with-current-buffer standard-output
1114 ;; Return the text we displayed. 1103 ;; Return the text we displayed.
1115 (buffer-string)))))))) 1104 (buffer-string))))))))
1116 1105
1106(add-hook 'help-fns-describe-variable-functions #'help-fns--customize-variable)
1107(defun help-fns--customize-variable (variable &optional text)
1108 ;; Make a link to customize if this variable can be customized.
1109 (when (custom-variable-p variable)
1110 (let ((customize-label "customize"))
1111 (princ (concat " You can " customize-label (or text " this variable.")))
1112 (with-current-buffer standard-output
1113 (save-excursion
1114 (re-search-backward
1115 (concat "\\(" customize-label "\\)") nil t)
1116 (help-xref-button 1 'help-customize-variable variable)))
1117 (terpri))
1118 ;; Note variable's version or package version.
1119 (let ((output (describe-variable-custom-version-info variable)))
1120 (when output
1121 (terpri)
1122 (terpri)
1123 (princ output)))))
1124
1117(add-hook 'help-fns-describe-variable-functions #'help-fns--var-safe-local) 1125(add-hook 'help-fns-describe-variable-functions #'help-fns--var-safe-local)
1118(defun help-fns--var-safe-local (variable) 1126(defun help-fns--var-safe-local (variable)
1119 (let ((safe-var (get variable 'safe-local-variable))) 1127 (let ((safe-var (get variable 'safe-local-variable)))