From: João Távora Date: Mon, 27 Jul 2020 21:07:38 +0000 (+0100) Subject: Make newer ElDoc versions are compatible with Emacs < 28 X-Git-Tag: emacs-28.0.90~6925 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9d751aa82202a2e081531f004c1bb0c0dbd9a0d3;p=emacs.git 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 --- 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 ;; 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