0

I have this on top of the org file #+property: header-args :results silent, so this applies to the whole file. I can't override this within the source block:

#+begin_src emacs-lisp :results value :tangle no
(print org-attach-directory)
#+end_src

This just prints to the minibuffer. It works if I set the results to value in the properties drawer of the current heading but not as above.

1 Answer 1

1

You can override the :results silent header by using :results replace on the source code block (replace is the default):

#+PROPERTY: header-args :results silent

#+begin_src elisp :results replace value
  (+ 3 4)

#+end_src

#+RESULTS:
: 7

As you can see, the :results header may have multiple values attached. See Results of Evaluation in the manual. You can supply one value for each class of options: the classes are Collection, Type, Format, Handling, so you can have up to four values, e.g. you can say :results value table drawer replace where value is one of the allowed Collection values, table is one of the allowed Typevalues, etc. There are additional wrinkles described in the manual, e.g. if theTypevalue isfile, you may provide an additional file: foo.ext` header to specify the file name where the results are going to be saved.

Or you can deactivate the property by adding a space after the #+

#+ PROPERTY: header-args :results silent

but you need to let Org mode know that you have done that. If you have another keyword (e.g. #+TITLE: foo) in the file, you can press C-c C-c on that: Org will reinitialize the mode and, in the process, deactivate the property. If the property is the only keyword in the file and you don't want to add another one, I know of nothing simpler than reinitializing the mode manually: M-x normal-mode is one way, closing and reopening the file is another.

2
  • 1
    Thank you so much. I didn't realise that the results keyword has two parts in it; just re-read the docs. So, in the source block it should be :results value replace.
    – Arktik
    Feb 24, 2023 at 8:43
  • 1
    That's right: I added a paragraph with a link to the manual and some additional explanations.
    – NickD
    Feb 24, 2023 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.