[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19338: [PATCH 1/3] eldoc: use default eldoc function if local one gi
From: |
Michal Nazarewicz |
Subject: |
bug#19338: [PATCH 1/3] eldoc: use default eldoc function if local one gives no results |
Date: |
Wed, 10 Dec 2014 18:49:43 +0100 |
From: Michal Nazarewicz <mina86@mina86.com>
* lisp/emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): If
local `eldoc-documentation-function' returns no docstring and the
variable has a non-nil default value, try it as well. This allows
setting up a global documentation function which will still be
used if given major mode has its own.
---
etc/NEWS | 6 ++++--
lisp/emacs-lisp/eldoc.el | 8 +++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 407df82..50338cf 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -199,8 +199,10 @@ typing RET.
result of the calculation into the current buffer.
** ElDoc
-*** New minor mode global-eldoc-mode
-*** eldoc-documentation-function now defaults to nil
+*** New minor mode `global-eldoc-mode'
+*** `eldoc-documentation-function' now defaults to nil
+*** Default value of `eldoc-documentation-function now' is consulted if
+local function does not return any documentation.
** eww
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 6dddf5b..06ee164 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -345,7 +345,13 @@ This variable is expected to be set buffer-locally by
modes that support ElDoc."
(when eldoc-last-message
(eldoc-message nil)
nil))
- (eldoc-message (funcall eldoc-documentation-function)))))
+ (eldoc-message
+ (or (funcall eldoc-documentation-function)
+ ;; If local documentation function did not return anything, try
+ ;; global one.
+ (when (local-variable-p 'eldoc-documentation-function)
+ (let ((func (default-value 'eldoc-documentation-function)))
+ (when func (funcall func)))))))))
;; When point is in a sexp, the function args are not reprinted in the echo
--
2.2.0.rc0.207.ga3a616c
- bug#19338: [PATCH 0/3] Implement an ElDoc function which describes char at point, Michal Nazarewicz, 2014/12/10
- bug#19338: [PATCH 1/3] eldoc: use default eldoc function if local one gives no results,
Michal Nazarewicz <=
- bug#19338: [PATCH 2/3] descr-text: add `describe-char-eldoc' describing character at point, Michal Nazarewicz, 2014/12/10
- bug#19338: [PATCH 3/3] eldoc: convert `eldoc-documentation-function' into a defcustom, Michal Nazarewicz, 2014/12/10
- bug#19338: [PATCH 1/3] eldoc: use default eldoc function if local one gives no results, Stefan Monnier, 2014/12/10
- bug#19338: [PATCH 1/3] eldoc: use default eldoc function if local one gives no results, Michal Nazarewicz, 2014/12/10
- bug#19338: [PATCH 1/3] eldoc: use default eldoc function if local one gives no results, Stefan Monnier, 2014/12/10
- bug#19338: [PATCHv2 1/2] descr-text: add `describe-char-eldoc' describing character at point, Michal Nazarewicz, 2014/12/11
- bug#19338: [PATCHv2 2/2] eldoc: convert `eldoc-documentation-function' into a defcustom, Michal Nazarewicz, 2014/12/11
- bug#19338: [PATCHv2 1/2] descr-text: add `describe-char-eldoc' describing character at point, Leo Liu, 2014/12/11
- bug#19338: [PATCHv2 1/2] descr-text: add `describe-char-eldoc' describing character at point, Michal Nazarewicz, 2014/12/11