emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-eldoc error on shell src blocks


From: 甲斐常伸
Subject: Re: [O] org-eldoc error on shell src blocks
Date: Sun, 31 Mar 2019 17:53:36 +0900

Hello,

I encounted the same error and I found it happens because "org-eldoc.el" doesn't reflect a value of "org-src-lang-modes". When I redefine "org-eldoc-get-mode-local-documentation-function" to reflect a value of "org-src-lang-modes" as below, the error disappeared.

    (defun org-eldoc-get-mode-local-documentation-function (lang)
      "Check if LANG-mode sets eldoc-documentation-function and return its value."
      (let ((cached-func (gethash lang org-eldoc-local-functions-cache 'empty))
            (mode-func (org-src--get-lang-mode lang))
            doc-func)
        (if (eq 'empty cached-func)
            (when (fboundp mode-func)
              (with-temp-buffer
                (funcall mode-func)
                (setq doc-func (and eldoc-documentation-function
                                    (symbol-value 'eldoc-documentation-function)))
                (puthash lang doc-func org-eldoc-local-functions-cache))
              doc-func)
          cached-func)))

The practical change is a one line.

    diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el
    index 556b945..fca13c3 100644
    --- a/contrib/lisp/org-eldoc.el
    +++ b/contrib/lisp/org-eldoc.el
    @@ -110,7 +110,7 @@
     (defun org-eldoc-get-mode-local-documentation-function (lang)
       "Check if LANG-mode sets eldoc-documentation-function and return its value."
       (let ((cached-func (gethash lang org-eldoc-local-functions-cache 'empty))
    -        (mode-func (intern-soft (format "%s-mode" lang)))
    +        (mode-func (org-src--get-lang-mode lang))
             doc-func)
         (if (eq 'empty cached-func)
             (when (fboundp mode-func)


I confirmed this change works good on the following two environments.

- Emacs 26.1 on Windows 10
  - (emacs-version) ; GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-05-29
  - (org-version) ; Org mode version 9.2.2 (9.2.2-13-g0007df-elpaplus @ /home/kai2nenobu/.emacs.d/elpa/org-plus-contrib-20190318/)

- Emacs 26.1 on Ubuntu 18.04 on WSL (on above Windows 10)
  - (emacs-version) ; GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-31
  - (org-version) ; Org mode version 9.2.1 (9.2.1-8-g1b1797-elpaplus @ c:/Users/kai2nenobu/.emacs.d/elpa/org-plus-contrib-20190211/)


I'm ready to contribute this patch, but I don't know how to contribute to "org-eldoc.el". Please tell me how to do it.


Best Regards,


2018年2月4日(日) 16:56 Nicolas Goaziou <address@hidden>:
Hello,

"address@hidden" <address@hidden> writes:

> After some dive in deeper
>
> - [X] emacs minimal init test, confirmed issue in org-mode.
> - [X] from the error log, seems `org-eldoc` try to call `(progn (funcall
> mode-func) ...`. This caused `shell-mode()`.
> - [ ] check out `org-eldoc.el` source code, have not found any solution or
> options.

> Hope some org-mode hacker can help to fix this issue?

I'm Cc'ing Org Eldoc author about it.

> And this might be a unit test in Org-mode testing?

We don't test contrib packages. However, they can provide their own
tests.

Regards,

--
Nicolas Goaziou


reply via email to

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