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
This commit is contained in:
João Távora 2020-07-27 22:07:38 +01:00
parent 688c03f412
commit 9d751aa822

View file

@ -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