From: Tobias Zawada <i_inbox@tn-home.de>
To: emacs-orgmode@gnu.org
Subject: Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation!
Date: Tue, 4 Dec 2018 17:45:34 +0100 (CET) [thread overview]
Message-ID: <93868713.269034.1543941934831@email.ionos.de> (raw)
I mostly cite here from https://emacs.stackexchange.com/q/41208/2370:
The following example causes an infinite recursion in ~org-babel-get-src-block-info~.
#+BEGIN_SRC org
,#+BEGIN_SRC org
,#+NAME: add3
,#+BEGIN_SRC elisp :var num=0
(+ 3 num)
,#+END_SRC
,* Use function drawer header arg
:PROPERTIES:
:header-args: :var n=add3(5)
:END:
,#+NAME: whatIsN
,#+BEGIN_SRC sh
echo $n
,#+END_SRC
,#+RESULTS: whatIsN
: 8
,#+BEGIN_SRC sh :var a=whatIsN
echo $a
,#+END_SRC
#+END_SRC
The problem is located in org-babel-get-src-block-info.
The function org-babel-params-from-properties is used there. Its doc-string is:
Retrieve parameters specified as properties. Return a list of association lists of source block params specified in the properties of the current outline entry.
But they do not say what the current outline entry is. In org-babel-get-src-block-info they assumed that the current outline entry would be that one at point but org-babel-params-from-properties uses also org-babel-current-src-block-location to retrieve parameters from there.
Even if (point) is 1 for the first source block add3 the variable org-babel-current-src-block-location in org-babel-params-from-properties points to the source block whatIsN.
So not the header-args for add3 are collected by org-babel-params-from-properties but those of whatIsN.
The consequence is that add3 gets the header arg n=add3(5) from the drawer. Naturally, that leads to infinite recursion.
The funny thing is that they already tried to make sure that org-babel-params-from-properties gets the right header args from the location of datum. I cite a small section of org-babel-get-src-block-info:
;; If DATUM is provided, make sure we get node
;; properties applicable to its location within
;; the document.
(org-with-point-at (org-element-property :begin datum)
(org-babel-params-from-properties lang))
You can avoid the error if you additionally let-bind org-babel-current-src-block-location to the location of datum:
;; If DATUM is provided, make sure we get node
;; properties applicable to its location within
;; the document.
(let ((org-babel-current-src-block-location (org-element-property :begin datum)))
(org-with-point-at org-babel-current-src-block-location
(org-babel-params-from-properties lang)))
I am not sure about the full consequences of that change through.
next reply other threads:[~2018-12-04 16:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 16:45 Tobias Zawada [this message]
2018-12-04 17:33 ` Bug: Infinite recursion in org-babel-get-src-block-info [9.1.13 (9.1.13-elpaplus @ mixed installation! Berry, Charles
2018-12-05 0:01 ` Tobias Zawada
2018-12-05 15:59 ` Tobias Zawada
2018-12-05 17:44 ` Berry, Charles
2018-12-05 23:07 ` Tobias Zawada
2018-12-05 23:35 ` Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=93868713.269034.1543941934831@email.ionos.de \
--to=i_inbox@tn-home.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).