emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-eldoc inf-loops when point is in an org src block
@ 2022-04-24  3:04 Kaushal Modi
  0 siblings, 0 replies; only message in thread
From: Kaushal Modi @ 2022-04-24  3:04 UTC (permalink / raw)
  To: emacs-org list

Hello all,

For quite some time, this small issue had been bugging me. I enable
org-eldoc by default and each time I put the point in an org src
block, I would see this error:

eldoc error: (error Lisp nesting exceeds ‘max-lisp-eval-depth’)

Here's a snippet of the full backtrace where we see the
`org-eldoc-documentation-function` being entered repeatedly until we
hit the max-lisp-eval-depth:

=====
Debugger entered--Lisp error: (error "Lisp nesting exceeds
‘max-lisp-eval-depth’")
  (if (looking-at org-complex-heading-regexp) (progn (setq cur
(match-string 4)) (org-format-outline-path (append
(org-get-outline-path) (list cur)) (frame-width) ""
org-eldoc-breadcrumb-separator)))
  (progn (if (looking-at org-complex-heading-regexp) (progn (setq cur
(match-string 4)) (org-format-outline-path (append
(org-get-outline-path) (list cur)) (frame-width) ""
org-eldoc-breadcrumb-separator))))
  (unwind-protect (progn (if (looking-at org-complex-heading-regexp)
(progn (setq cur (match-string 4)) (org-format-outline-path (append
(org-get-outline-path) (list cur)) (frame-width) ""
org-eldoc-breadcrumb-separator)))) (set-match-data
save-match-data-internal 'evaporate))
  (let ((save-match-data-internal (match-data))) (unwind-protect
(progn (if (looking-at org-complex-heading-regexp) (progn (setq cur
(match-string 4)) (org-format-outline-path (append
(org-get-outline-path) (list cur)) (frame-width) ""
org-eldoc-breadcrumb-separator)))) (set-match-data
save-match-data-internal 'evaporate)))
  (save-excursion (beginning-of-line) (let ((save-match-data-internal
(match-data))) (unwind-protect (progn (if (looking-at
org-complex-heading-regexp) (progn (setq cur (match-string 4))
(org-format-outline-path (append ... ...) (frame-width) ""
org-eldoc-breadcrumb-separator)))) (set-match-data
save-match-data-internal 'evaporate))))
  (let ((case-fold-search t) cur) (save-excursion (beginning-of-line)
(let ((save-match-data-internal (match-data))) (unwind-protect (progn
(if (looking-at org-complex-heading-regexp) (progn (setq cur ...)
(org-format-outline-path ... ... "" org-eldoc-breadcrumb-separator))))
(set-match-data save-match-data-internal 'evaporate)))))
  org-eldoc-get-breadcrumb()
  (or (org-eldoc-get-breadcrumb) (org-eldoc-get-src-header) (let
((lang (org-eldoc-get-src-lang))) (cond ((or (string= lang
"emacs-lisp") (string= lang "elisp")) (cond ((and (boundp ...)
(fboundp ...) (fboundp ...)) (let (...)
(eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if ... ... ...))))))))
  org-eldoc-documentation-function(#f(compiled-function (string &rest
plist) #<bytecode 0x2cb3448e18d688a>))
  run-hook-with-args-until-success(org-eldoc-documentation-function
#f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  (let ((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback))
  (closure ((doc-funs org-eldoc-documentation-function t) (temp-buffer
. #<killed buffer>) (doc-func . #0) (mode-func . org-mode)
(cached-func . empty) (lang . "org") t) (callback) (let
((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback)))(#f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  funcall((closure ((doc-funs org-eldoc-documentation-function t)
(temp-buffer . #<killed buffer>) (doc-func . #1) (mode-func .
org-mode) (cached-func . empty) (lang . "org") t) (callback) (let
((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback))) #f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  (if (functionp callback) (funcall doc-fun callback) (funcall doc-fun))
  (progn (if (functionp callback) (funcall doc-fun callback) (funcall doc-fun)))
  (if (functionp doc-fun) (progn (if (functionp callback) (funcall
doc-fun callback) (funcall doc-fun))))
  (let ((doc-fun (org-eldoc-get-mode-local-documentation-function
lang)) (callback (car args))) (if (functionp doc-fun) (progn (if
(functionp callback) (funcall doc-fun callback) (funcall doc-fun)))))
  (cond ((or (string= lang "emacs-lisp") (string= lang "elisp")) (cond
((and (boundp 'eldoc-documentation-functions) (fboundp
'elisp-eldoc-var-docstring) (fboundp 'elisp-eldoc-funcall)) (let
((eldoc-documentation-functions '...))
(eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if (functionp callback)
(funcall doc-fun callback) (funcall doc-fun)))))))
  (let ((lang (org-eldoc-get-src-lang))) (cond ((or (string= lang
"emacs-lisp") (string= lang "elisp")) (cond ((and (boundp
'eldoc-documentation-functions) (fboundp 'elisp-eldoc-var-docstring)
(fboundp 'elisp-eldoc-funcall)) (let ((eldoc-documentation-functions
...)) (eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if (functionp callback)
(funcall doc-fun callback) (funcall doc-fun))))))))
  (or (org-eldoc-get-breadcrumb) (org-eldoc-get-src-header) (let
((lang (org-eldoc-get-src-lang))) (cond ((or (string= lang
"emacs-lisp") (string= lang "elisp")) (cond ((and (boundp ...)
(fboundp ...) (fboundp ...)) (let (...)
(eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if ... ... ...))))))))
  org-eldoc-documentation-function(#f(compiled-function (string &rest
plist) #<bytecode 0x2cb3448e18d688a>))
  run-hook-with-args-until-success(org-eldoc-documentation-function
#f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  (let ((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback))
  (closure ((doc-funs org-eldoc-documentation-function t) (temp-buffer
. #<killed buffer>) (doc-func . #0) (mode-func . org-mode)
(cached-func . empty) (lang . "org") t) (callback) (let
((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback)))(#f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  funcall((closure ((doc-funs org-eldoc-documentation-function t)
(temp-buffer . #<killed buffer>) (doc-func . #1) (mode-func .
org-mode) (cached-func . empty) (lang . "org") t) (callback) (let
((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback))) #f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  (if (functionp callback) (funcall doc-fun callback) (funcall doc-fun))
  (progn (if (functionp callback) (funcall doc-fun callback) (funcall doc-fun)))
  (if (functionp doc-fun) (progn (if (functionp callback) (funcall
doc-fun callback) (funcall doc-fun))))
  (let ((doc-fun (org-eldoc-get-mode-local-documentation-function
lang)) (callback (car args))) (if (functionp doc-fun) (progn (if
(functionp callback) (funcall doc-fun callback) (funcall doc-fun)))))
  (cond ((or (string= lang "emacs-lisp") (string= lang "elisp")) (cond
((and (boundp 'eldoc-documentation-functions) (fboundp
'elisp-eldoc-var-docstring) (fboundp 'elisp-eldoc-funcall)) (let
((eldoc-documentation-functions '...))
(eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if (functionp callback)
(funcall doc-fun callback) (funcall doc-fun)))))))
  (let ((lang (org-eldoc-get-src-lang))) (cond ((or (string= lang
"emacs-lisp") (string= lang "elisp")) (cond ((and (boundp
'eldoc-documentation-functions) (fboundp 'elisp-eldoc-var-docstring)
(fboundp 'elisp-eldoc-funcall)) (let ((eldoc-documentation-functions
...)) (eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if (functionp callback)
(funcall doc-fun callback) (funcall doc-fun))))))))
  (or (org-eldoc-get-breadcrumb) (org-eldoc-get-src-header) (let
((lang (org-eldoc-get-src-lang))) (cond ((or (string= lang
"emacs-lisp") (string= lang "elisp")) (cond ((and (boundp ...)
(fboundp ...) (fboundp ...)) (let (...)
(eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if ... ... ...))))))))
  org-eldoc-documentation-function(#f(compiled-function (string &rest
plist) #<bytecode 0x2cb3448e18d688a>))
  run-hook-with-args-until-success(org-eldoc-documentation-function
#f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  (let ((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback))
  (closure ((doc-funs org-eldoc-documentation-function t) (temp-buffer
. #<killed buffer>) (doc-func . #0) (mode-func . org-mode)
(cached-func . empty) (lang . "org") t) (callback) (let
((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback)))(#f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  funcall((closure ((doc-funs org-eldoc-documentation-function t)
(temp-buffer . #<killed buffer>) (doc-func . #1) (mode-func .
org-mode) (cached-func . empty) (lang . "org") t) (callback) (let
((eldoc-documentation-functions doc-funs))
(run-hook-with-args-until-success 'eldoc-documentation-functions
callback))) #f(compiled-function (string &rest plist) #<bytecode
0x2cb3448e18d688a>))
  (if (functionp callback) (funcall doc-fun callback) (funcall doc-fun))
  (progn (if (functionp callback) (funcall doc-fun callback) (funcall doc-fun)))
  (if (functionp doc-fun) (progn (if (functionp callback) (funcall
doc-fun callback) (funcall doc-fun))))
  (let ((doc-fun (org-eldoc-get-mode-local-documentation-function
lang)) (callback (car args))) (if (functionp doc-fun) (progn (if
(functionp callback) (funcall doc-fun callback) (funcall doc-fun)))))
  (cond ((or (string= lang "emacs-lisp") (string= lang "elisp")) (cond
((and (boundp 'eldoc-documentation-functions) (fboundp
'elisp-eldoc-var-docstring) (fboundp 'elisp-eldoc-funcall)) (let
((eldoc-documentation-functions '...))
(eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if (functionp callback)
(funcall doc-fun callback) (funcall doc-fun)))))))
  (let ((lang (org-eldoc-get-src-lang))) (cond ((or (string= lang
"emacs-lisp") (string= lang "elisp")) (cond ((and (boundp
'eldoc-documentation-functions) (fboundp 'elisp-eldoc-var-docstring)
(fboundp 'elisp-eldoc-funcall)) (let ((eldoc-documentation-functions
...)) (eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if (functionp callback)
(funcall doc-fun callback) (funcall doc-fun))))))))
  (or (org-eldoc-get-breadcrumb) (org-eldoc-get-src-header) (let
((lang (org-eldoc-get-src-lang))) (cond ((or (string= lang
"emacs-lisp") (string= lang "elisp")) (cond ((and (boundp ...)
(fboundp ...) (fboundp ...)) (let (...)
(eldoc-print-current-symbol-info))) ((fboundp
'elisp-eldoc-documentation-function)
(elisp-eldoc-documentation-function)) (t (let
(eldoc-documentation-function) (eldoc-print-current-symbol-info)))))
((or (string= lang "c") (string= lang "C")) (if (require 'c-eldoc nil
t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang "css")
(if (require 'css-eldoc nil t) (progn (css-eldoc-function))))
((string= lang "php") (if (require 'php-eldoc nil t) (progn
(php-eldoc-function)))) ((or (string= lang "go") (string= lang
"golang")) (if (require 'go-eldoc nil t) (progn
(go-eldoc--documentation-function)))) (t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)) (callback (car
args))) (if (functionp doc-fun) (progn (if ... ... ...))))))))
  org-eldoc-documentation-function(#f(compiled-function (string &rest
plist) #<bytecode 0x2cb3448e18d688a>))
=====


Recipe to create this error:
1. Create a file test.org with these contents:

#+begin_src org
,#+html: foo
#+end_src

2. emacs -Q
3. Load/evaluate org-eldoc.el from
https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/org-eldoc.el
4. Open the test.org file and place the point *inside* the org src block
5. eldoc error: (error Lisp nesting exceeds ‘max-lisp-eval-depth’)

-----

Upon inspecting the `org-eldoc-documentation-function` function, I
don't see a reason why the control should enter the default of `t'
case if the src lang is "org". Just returning with nil works for me if
the lang is "org". I will send a patch for this in a follow-up email.

--
Kaushal Modi


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-24  3:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24  3:04 [BUG] org-eldoc inf-loops when point is in an org src block Kaushal Modi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).