emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9d751aa: Make newer ElDoc versions are compatible with Emacs < 28


From: Joo Tvora
Subject: master 9d751aa: Make newer ElDoc versions are compatible with Emacs < 28
Date: Mon, 27 Jul 2020 17:24:16 -0400 (EDT)

branch: master
commit 9d751aa82202a2e081531f004c1bb0c0dbd9a0d3
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    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
---
 lisp/emacs-lisp/eldoc.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index b30836c..19b3bd7 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]