Hello.

I have:

GNU Emacs 29.4 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.43,
cairo version 1.18.2) of 2025-01-03 Org mode version 9.6.15 (release_9.6.15
@ /usr/share/emacs/29.4/lisp/org/)

In section "16.4 Environment of a Code Block" of the manual (from Info), I
read:

The following example shows how to reliably query and pass the file name of
the Org mode buffer to a code block using headers.  [...]

     #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
       wc -w $filename
     #+END_SRC

I have a subtree containing just this code block:

#+BEGIN_SRC shell :var filename=("/tmp/test.r") :exports both
       wc -w $filename
#+END_SRC

Upon 'C-c C-c', it gives

#+RESULTS:
: 1 /tmp/test.r

which is what I expect.

However, upon latex export of the subtree (C-c e l p), I get:

org-babel-read: Invalid function: "/tmp/test.r"

Now, if I remove the parentheses, i.e., if I just use
filename="/tmp/test.r" above, then it works as I expect in both cases, that
is, there is no error during export and I do see

  wc -w $filename

1 /tmp/test.r

in the exported pdf file.

Are the parentheses in the manual correct?  If so, what is the rationale?
Thanks.


-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.coch...@unistra.fr
5 rue René Descartes                 | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | bureau 110, ancien bât.

Reply via email to