0

Is there a variable in org I can use to specify the number of empty lines before the results block; it defaults to 1, but I want to set it to 0.

2
  • 1
    No such variable. The insertion of the newline is hard-coded in the function org-babel-where-is-src-block-result
    – NickD
    Commented Dec 13, 2022 at 17:23
  • Ah, OK. Thank you very much for answering the question.
    – Arktik
    Commented Dec 13, 2022 at 18:38

1 Answer 1

1

While it is true that the newline is hard-coded, you can still remove it by advising org-babel--insert-results-keyword:

(defun my-remove-line (_a _b)
  (save-excursion 
    (previous-line)
    (beginning-of-line)
    (when (looking-at-p "\n")
      (kill-line))))

(advice-add 'org-babel--insert-results-keyword :before #'my-remove-line)

This might break things elsewhere though. If it does, maybe you can adjust the advice to prevent that, or you can remove the advice again using (advice-remove 'org-babel--insert-results-keyword #'my-remove-line).

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.