Merge branch 'maint' into master

This commit is contained in:
Kyle Meyer 2020-09-20 21:31:59 -04:00
commit aea1109ef7
1 changed files with 20 additions and 9 deletions

View File

@ -1,4 +1,4 @@
;;; org-eldoc.el --- display org header and src block info using eldoc ;;; org-eldoc.el --- display org header and src block info using eldoc -*- lexical-binding: t; -*-
;; Copyright (c) 2014-2020 Free Software Foundation, Inc. ;; Copyright (c) 2014-2020 Free Software Foundation, Inc.
@ -114,11 +114,18 @@
doc-func) doc-func)
(if (eq 'empty cached-func) (if (eq 'empty cached-func)
(when (fboundp mode-func) (when (fboundp mode-func)
(with-temp-buffer (with-temp-buffer
(funcall mode-func) (funcall mode-func)
(setq doc-func (and eldoc-documentation-function (setq doc-func (if (boundp 'eldoc-documentation-functions)
(symbol-value 'eldoc-documentation-function))) (let ((doc-funs eldoc-documentation-functions))
(puthash lang doc-func org-eldoc-local-functions-cache)) (lambda (callback)
(let ((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success
'eldoc-documentation-functions
callback))))
(and eldoc-documentation-function
(symbol-value 'eldoc-documentation-function))))
(puthash lang doc-func org-eldoc-local-functions-cache))
doc-func) doc-func)
cached-func))) cached-func)))
@ -127,7 +134,7 @@
(declare-function php-eldoc-function "php-eldoc" ()) (declare-function php-eldoc-function "php-eldoc" ())
(declare-function go-eldoc--documentation-function "go-eldoc" ()) (declare-function go-eldoc--documentation-function "go-eldoc" ())
(defun org-eldoc-documentation-function (&rest _ignored) (defun org-eldoc-documentation-function (&rest args)
"Return breadcrumbs when on a headline, args for src block header-line, "Return breadcrumbs when on a headline, args for src block header-line,
calls other documentation functions depending on lang when inside src body." calls other documentation functions depending on lang when inside src body."
(or (or
@ -160,8 +167,12 @@
(string= lang "go") (string= lang "go")
(string= lang "golang")) (when (require 'go-eldoc nil t) (string= lang "golang")) (when (require 'go-eldoc nil t)
(go-eldoc--documentation-function))) (go-eldoc--documentation-function)))
(t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang))) (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang))
(when (functionp doc-fun) (funcall doc-fun)))))))) (callback (car args)))
(when (functionp doc-fun)
(if (functionp callback)
(funcall doc-fun callback)
(funcall doc-fun)))))))))
;;;###autoload ;;;###autoload
(defun org-eldoc-load () (defun org-eldoc-load ()