forked from mirrors/org-mode
org-eldoc: Fix compatibility with Emacs 28
* contrib/lisp/org-eldoc.el (org-eldoc-documentation-function): Accept and ignore additional arguments for compatibility with Emacs 28. (org-eldoc-load): Use add-function to register org-eldoc-documentation-function for Emacs versions 25 through 27, as documented in eldoc-documentation-function. See Emacs's fd020a2931 (eldoc: modify `eldoc-documentation-function' using `add-function', 2014-12-05) and c0fcbd2c11 (Expose ElDoc functions in a hook (Bug#28257), 2020-02-25) for more information on the Emacs 25 and Emacs 28 changes, respectively.
This commit is contained in:
parent
e62ca4a1bf
commit
b2b587387e
|
@ -127,7 +127,7 @@
|
|||
(declare-function php-eldoc-function "php-eldoc" ())
|
||||
(declare-function go-eldoc--documentation-function "go-eldoc" ())
|
||||
|
||||
(defun org-eldoc-documentation-function ()
|
||||
(defun org-eldoc-documentation-function (&rest _ignored)
|
||||
"Return breadcrumbs when on a headline, args for src block header-line,
|
||||
calls other documentation functions depending on lang when inside src body."
|
||||
(or
|
||||
|
@ -161,11 +161,18 @@
|
|||
(defun org-eldoc-load ()
|
||||
"Set up org-eldoc documentation function."
|
||||
(interactive)
|
||||
(if (boundp 'eldoc-documentation-functions)
|
||||
(add-hook 'eldoc-documentation-functions
|
||||
#'org-eldoc-documentation-function nil t)
|
||||
;; This approach is taken from python.el.
|
||||
(with-no-warnings
|
||||
(cond
|
||||
((null eldoc-documentation-function) ; Emacs<25
|
||||
(setq-local eldoc-documentation-function
|
||||
#'org-eldoc-documentation-function)))
|
||||
#'org-eldoc-documentation-function))
|
||||
((boundp 'eldoc-documentation-functions) ; Emacs>=28
|
||||
(add-hook 'eldoc-documentation-functions
|
||||
#'org-eldoc-documentation-function nil t))
|
||||
(t
|
||||
(add-function :before-until (local 'eldoc-documentation-function)
|
||||
#'org-eldoc-documentation-function)))))
|
||||
|
||||
;;;###autoload
|
||||
(add-hook 'org-mode-hook #'org-eldoc-load)
|
||||
|
|
Loading…
Reference in New Issue