summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-10-01 16:45:24 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-10-01 16:45:24 +0200
commitbc95fc78bbf9c91ce5c3adb7d199c84c0c5032ca (patch)
treec1aed75ee2cd25d183a3fae7dc6328ba4bbc9c54 /lisp
parent28b7dd4ee4bb0c9d93435b88fed30fa20c317031 (diff)
downloademacs-bc95fc78bbf9c91ce5c3adb7d199c84c0c5032ca.tar.gz
emacs-bc95fc78bbf9c91ce5c3adb7d199c84c0c5032ca.tar.bz2
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).
Diffstat (limited to 'lisp')
-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.
`(progn
(progn
+ (put ',global-mode 'globalized-minor-mode t)
:autoload-end
(defvar ,MODE-major-mode nil)
(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."
(t "."))
"\n"))))
+(add-hook 'help-fns-describe-function-functions
+ #'help-fns--globalized-minor-mode)
+(defun help-fns--globalized-minor-mode (function)
+ (when (get function 'globalized-minor-mode)
+ (help-fns--customize-variable function " the global mode variable.")
+ (terpri)))
+
;; We could use `symbol-file' but this is a wee bit more efficient.
(defun help-fns--autoloaded-p (function file)
"Return non-nil if FUNCTION has previously been autoloaded.
@@ -1092,28 +1099,29 @@ it is displayed along with the global value."
(with-current-buffer standard-output
(insert (or doc "Not documented as a variable."))))
- ;; Make a link to customize if this variable can be customized.
- (when (custom-variable-p variable)
- (let ((customize-label "customize"))
- (terpri)
- (terpri)
- (princ (concat "You can " customize-label " this variable."))
- (with-current-buffer standard-output
- (save-excursion
- (re-search-backward
- (concat "\\(" customize-label "\\)") nil t)
- (help-xref-button 1 'help-customize-variable variable))))
- ;; Note variable's version or package version.
- (let ((output (describe-variable-custom-version-info variable)))
- (when output
- (terpri)
- (terpri)
- (princ output))))
-
(with-current-buffer standard-output
;; Return the text we displayed.
(buffer-string))))))))
+(add-hook 'help-fns-describe-variable-functions #'help-fns--customize-variable)
+(defun help-fns--customize-variable (variable &optional text)
+ ;; Make a link to customize if this variable can be customized.
+ (when (custom-variable-p variable)
+ (let ((customize-label "customize"))
+ (princ (concat " You can " customize-label (or text " this variable.")))
+ (with-current-buffer standard-output
+ (save-excursion
+ (re-search-backward
+ (concat "\\(" customize-label "\\)") nil t)
+ (help-xref-button 1 'help-customize-variable variable)))
+ (terpri))
+ ;; Note variable's version or package version.
+ (let ((output (describe-variable-custom-version-info variable)))
+ (when output
+ (terpri)
+ (terpri)
+ (princ output)))))
+
(add-hook 'help-fns-describe-variable-functions #'help-fns--var-safe-local)
(defun help-fns--var-safe-local (variable)
(let ((safe-var (get variable 'safe-local-variable)))