From fd020a29316e573e96501dfc1c87d05085160b2c Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Fri, 5 Dec 2014 19:34:42 +0100 Subject: eldoc: modify `eldoc-documentation-function' using `add-function' * lisp/emacs-lisp/eldoc.el (eldoc-documentation-function): Describe how major modes should use `add-function' to alter value of the variable. * lisp/hexl.el (hexl-mode): Set `eldoc-documentation-function' using `add-function' so the default value is always used. * lisp/ielm.el (inferior-emacs-lisp-mode): Set `eldoc-documentation-function' using `add-function' so the default value is always used. * lisp/progmodes/cfengine.el (cfengine3-mode): Set `eldoc-documentation-function' using `add-function' so the default value is always used. * lisp/progmodes/elisp-mode (emacs-lisp-mode): Set `eldoc-documentation-function' using `add-function' so the default value is always used. * lisp/progmodes/octave.el (octave-mode): Set `eldoc-documentation-function' using `add-function' so the default value is always used. * lisp/progmodes/python.el (python-mode): Set `eldoc-documentation-function' using `add-function' so the default value is always used. * lisp/simple.el (read--expression): Set `eldoc-documentation-function' using `add-function' so the default value is always used. --- lisp/emacs-lisp/eldoc.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/eldoc.el') diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 0c74f3fedc..d527d676d5 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -336,7 +336,12 @@ the variables `eldoc-argument-case' and `eldoc-echo-area-use-multiline-p', and the face `eldoc-highlight-function-argument', if they are to have any effect. -This variable is expected to be set buffer-locally by modes that support ElDoc.") +Major modes should modify this variable using `add-function', for example: + (add-function :before-until (local 'eldoc-documentation-function) + #'foo-mode-eldoc-function) +so that the global documentation function (i.e. the default value of the +variable) is taken into account if the major mode specific function does not +return any documentation.") (defun eldoc-print-current-symbol-info () ;; This is run from post-command-hook or some idle timer thing, -- cgit v1.2.3