Commit c4fcaf5e authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Make `C-h v' list all aliases a variable has

* lisp/help-fns.el (help-fns--var-aliases): New function (bug#15179).
parent 9aa13cd4
......@@ -1228,6 +1228,30 @@ variable.\n")))
" This variable is an alias for `%s'.\n"
alias)))))
(add-hook 'help-fns-describe-variable-functions #'help-fns--var-aliases)
(defun help-fns--var-aliases (variable)
;; Mention if it has any aliases.
(let (aliases)
(mapatoms
(lambda (sym)
(when (and (boundp sym)
(setq alias (indirect-variable sym))
(eq alias variable)
(not (eq alias sym)))
(push sym aliases)))
obarray)
(when aliases
(princ
(if (= (length aliases) 1)
(format-message
" This variable has an alias: `%s'.\n" (car aliases))
(format-message
" This variable has the following aliases: %s.\n"
(mapconcat
(lambda (sym)
(format "`%s'" sym))
aliases ",\n ")))))))
(add-hook 'help-fns-describe-variable-functions #'help-fns--var-bufferlocal)
(defun help-fns--var-bufferlocal (variable)
(let ((permanent-local (get variable 'permanent-local))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment