summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/eldoc.el
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2020-07-27 22:07:38 +0100
committerJoão Távora <joaotavora@gmail.com>2020-07-27 22:18:57 +0100
commit9d751aa82202a2e081531f004c1bb0c0dbd9a0d3 (patch)
tree0fd2f90665d59e1552fa0e4de75e2faa55a2ad68 /lisp/emacs-lisp/eldoc.el
parent688c03f41278a33f580b56c2122d7f52c9a3ed67 (diff)
downloademacs-9d751aa82202a2e081531f004c1bb0c0dbd9a0d3.tar.gz
Make newer ElDoc versions are compatible with Emacs < 28
Fixes: bug#42563 For some time, Eldoc has has some Elisp-specific code that shouldn't live there, but in elisp-mode.el. This can be fixed in Emacs master, but since ElDoc is distributed in GNU Elpa and is meant to work with Emacs 26 and 27, this means that that elisp-specific code must still be distributed with eldoc.el and kept up to date. * lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Ensure implementation is compatible with Emacs < 28. (Version): Bump to 1.8
Diffstat (limited to 'lisp/emacs-lisp/eldoc.el')
-rw-r--r--lisp/emacs-lisp/eldoc.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index b30836cc0bd..19b3bd78aea 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -5,7 +5,7 @@
;; Author: Noah Friedman <friedman@splode.com>
;; Keywords: extensions
;; Created: 1995-10-06
-;; Version: 1.7.0
+;; Version: 1.8.0
;; Package-Requires: ((emacs "26.3"))
;; This is a GNU ELPA :core package. Avoid functionality that is not
@@ -229,11 +229,15 @@ expression point is on." :lighter eldoc-minor-mode-string
(defun eldoc--eval-expression-setup ()
;; Setup `eldoc', similar to `emacs-lisp-mode'. FIXME: Call
;; `emacs-lisp-mode' itself?
- (add-hook 'eldoc-documentation-functions
- #'elisp-eldoc-var-docstring nil t)
- (add-hook 'eldoc-documentation-functions
- #'elisp-eldoc-funcall nil t)
- (setq eldoc-documentation-strategy 'eldoc-documentation-default)
+ (cond ((<= emacs-major-version 27)
+ (declare-function elisp-eldoc-documentation-function "elisp-mode")
+ (add-function :before-until (local 'eldoc-documentation-function)
+ #'elisp-eldoc-documentation-function))
+ (t (add-hook 'eldoc-documentation-functions
+ #'elisp-eldoc-var-docstring nil t)
+ (add-hook 'eldoc-documentation-functions
+ #'elisp-eldoc-funcall nil t)
+ (setq eldoc-documentation-strategy 'eldoc-documentation-default)))
(eldoc-mode +1))
;;;###autoload