Skip to content

Instantly share code, notes, and snippets.

Created May 12, 2020 10:33
What would you like to do?
Remove all #+RESULTS: blocks including from #+CALL: blocks in an org-babel file (Spacemacs)
(defun dotspacemacs/user-config ()
(defconst help/org-special-pre "^\s*#[+]")
(defun help/org-2every-src-block (fn)
"Visit every Source-Block and evaluate `FN’."
(goto-char (point-min))
(let ((case-fold-search t))
(while (re-search-forward (concat help/org-special-pre "\\(BEGIN_SRC\\|CALL\\)") nil t)
(let ((element (org-element-at-point)))
(when (or (eq (org-element-type element) 'src-block) (eq (org-element-type element) 'babel-call))
(funcall fn element)))))
(defun org-babel-remove-results()
"Remove all #+RESULTS: blocks from org-babel files"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment