Remove all #+RESULTS: blocks including from #+CALL: blocks in an org-babel file (Spacemacs)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun dotspacemacs/user-config () | |
(defconst help/org-special-pre "^\s*#[+]") | |
(defun help/org-2every-src-block (fn) | |
"Visit every Source-Block and evaluate `FN’." | |
(interactive) | |
(save-excursion | |
(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))))) | |
(save-buffer))) | |
(defun org-babel-remove-results() | |
"Remove all #+RESULTS: blocks from org-babel files" | |
(interactive) | |
(help/org-2every-src-block | |
'org-babel-remove-result)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment