]> code.delx.au - gnu-emacs/commitdiff
eldoc: modify `eldoc-documentation-function' using `add-function'
authorMichal Nazarewicz <mina86@mina86.com>
Fri, 5 Dec 2014 18:34:42 +0000 (19:34 +0100)
committerMichal Nazarewicz <mina86@mina86.com>
Tue, 20 Jan 2015 14:04:15 +0000 (15:04 +0100)
* 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/ChangeLog
lisp/emacs-lisp/eldoc.el
lisp/hexl.el
lisp/ielm.el
lisp/progmodes/cfengine.el
lisp/progmodes/elisp-mode.el
lisp/progmodes/octave.el
lisp/progmodes/python.el
lisp/simple.el

index ab338f8ed88ebac4b9068d5d977cf21fcd10d96f..c34b7ea8a345930284eb1bbc74a3d7afeed4e3c5 100644 (file)
@@ -1,5 +1,28 @@
 2015-01-20  Michal Nazarewicz  <mina86@mina86.com>
 
+       * emacs-lisp/eldoc.el (eldoc-documentation-function): Describe how
+       major modes should use `add-function' to alter value of the variable.
+
+       * hexl.el (hexl-mode): Set `eldoc-documentation-function' using
+       `add-function' so the default value is always used.
+       * ielm.el (inferior-emacs-lisp-mode): Set
+       `eldoc-documentation-function' using `add-function' so the default
+       value is always used.
+       * progmodes/cfengine.el (cfengine3-mode): Set
+       `eldoc-documentation-function' using `add-function' so the default
+       value is always used.
+       * progmodes/elisp-mode (emacs-lisp-mode): Set
+       `eldoc-documentation-function' using `add-function' so the default
+       value is always used.
+       * progmodes/octave.el (octave-mode): Set
+       `eldoc-documentation-function' using `add-function' so the default
+       value is always used.
+       * progmodes/python.el (python-mode): Set
+       `eldoc-documentation-function' using `add-function' so the default
+       value is always used.
+       * simple.el (read--expression): Set `eldoc-documentation-function'
+       using `add-function' so the default value is always used.
+
        * descr-text.el (describe-char-eldoc): New function returning
        basic Unicode codepoint information (e.g. name) about character
        at point.  It is meant to be used as a default value of the
index 0c74f3fedc01c63f7a89109daf745ba79296d3cb..d527d676d5192a8dca5294dce23e301d001ff8bf 100644 (file)
@@ -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,
index 3751bcf4bb31ae65795c6a4f297e5a02b45cb5d9..27d465926989e6f5e4e8d4ffaec076fd394c1db3 100644 (file)
@@ -395,8 +395,8 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
     (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t)
 
     ;; Set a callback function for eldoc.
-    (hexl-mode--setq-local 'eldoc-documentation-function
-                           #'hexl-print-current-point-info)
+    (add-function :before-until (local 'eldoc-documentation-function)
+                  #'hexl-print-current-point-info)
     (eldoc-add-command-completions "hexl-")
     (eldoc-remove-command "hexl-save-buffer"
                          "hexl-current-address")
index d7bf60fe074249a7633c328ad6c9bfe27a1f1b6b..be877eb250ab0f420dff51826fd88ff52a1d4b66 100644 (file)
@@ -380,7 +380,7 @@ nonempty, then flushes the buffer."
                      (*3 ***)
                      (active-process (ielm-process))
                      (old-standard-output standard-output)
-                     new-standard-output 
+                     new-standard-output
                      ielm-temp-buffer)
                 (set-match-data ielm-match-data)
                 (save-excursion
@@ -542,8 +542,8 @@ Customized bindings may be defined in `ielm-map', which currently contains:
   (set (make-local-variable 'completion-at-point-functions)
        '(comint-replace-by-expanded-history
          ielm-complete-filename elisp-completion-at-point))
-  (setq-local eldoc-documentation-function
-              #'elisp-eldoc-documentation-function)
+  (add-function :before-until (local 'eldoc-documentation-function)
+                #'elisp-eldoc-documentation-function)
   (set (make-local-variable 'ielm-prompt-internal) ielm-prompt)
   (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only)
   (setq comint-get-old-input 'ielm-get-old-input)
index b485a5d269b1a6af4b0c7233d00280cc9a58c263..aec7d20802203f831a88e699229067cd6087a036 100644 (file)
@@ -1350,7 +1350,8 @@ to the action header."
                  (when buffer-file-name
                    (shell-quote-argument buffer-file-name)))))
 
-  (setq-local eldoc-documentation-function #'cfengine3-documentation-function)
+  (add-function :before-until (local 'eldoc-documentation-function)
+                #'cfengine3-documentation-function)
 
   (add-hook 'completion-at-point-functions
             #'cfengine3-completion-function nil t)
index 4de40eff538cfcb03cd8158a86e3901c6d86a746..b2c5fbfe60ee3f0fbf038411dbbd11ad49db084c 100644 (file)
@@ -231,8 +231,8 @@ Blank lines separate paragraphs.  Semicolons start comments.
   (defvar xref-identifier-completion-table-function)
   (lisp-mode-variables nil nil 'elisp)
   (setq imenu-case-fold-search nil)
-  (setq-local eldoc-documentation-function
-              #'elisp-eldoc-documentation-function)
+  (add-function :before-until (local 'eldoc-documentation-function)
+                #'elisp-eldoc-documentation-function)
   (setq-local xref-find-function #'elisp-xref-find)
   (setq-local xref-identifier-completion-table-function
               #'elisp--xref-identifier-completion-table)
index cbdaae6fa71ca600d3d13abe9b978357d5ce4c49..8541cced3a53665e6549faf740439f6d573603f4 100644 (file)
@@ -601,7 +601,8 @@ Key bindings:
   (add-hook 'before-save-hook 'octave-sync-function-file-names nil t)
   (setq-local beginning-of-defun-function 'octave-beginning-of-defun)
   (and octave-font-lock-texinfo-comment (octave-font-lock-texinfo-comment))
-  (setq-local eldoc-documentation-function 'octave-eldoc-function)
+  (add-function :before-until (local 'eldoc-documentation-function)
+                'octave-eldoc-function)
 
   (easy-menu-add octave-mode-menu))
 
index 1e8623dd90141849f8fc416a212dacf04a20729d..d298f96bc81eb3614594193c163b2229323e92ab 100644 (file)
@@ -4662,8 +4662,8 @@ Arguments START and END narrow the buffer region to work on."
                                                  (current-column))))
          (^ '(- (1+ (current-indentation))))))
 
-  (set (make-local-variable 'eldoc-documentation-function)
-       #'python-eldoc-function)
+  (add-function :before-until (local 'eldoc-documentation-function)
+                #'python-eldoc-function)
 
   (add-to-list 'hs-special-modes-alist
                `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
index 25293edf88fe68e4c941bec7ff9dc6cee86d2370..967fbc69cbc41fb787662edaefcc7f2851bc57a3 100644 (file)
@@ -1407,8 +1407,8 @@ display the result of expression evaluation."
     (minibuffer-with-setup-hook
         (lambda ()
           ;; FIXME: call emacs-lisp-mode?
-          (setq-local eldoc-documentation-function
-                      #'elisp-eldoc-documentation-function)
+          (add-function :before-until (local 'eldoc-documentation-function)
+                        #'elisp-eldoc-documentation-function)
           (add-hook 'completion-at-point-functions
                     #'elisp-completion-at-point nil t)
           (run-hooks 'eval-expression-minibuffer-setup-hook))