From: Douglas Perrin <doug2024@gmail.com> To: emacs-orgmode@gnu.org Subject: Re: Import Reusable org-babel snippet using #+SETUPFILE Date: Thu, 18 Jun 2020 12:03:30 -0400 [thread overview] Message-ID: <CAFw+bXFgCSFYhHVu0sxiSv1WjKpkbLNwdYTgDgjeaNGXhMPKrA@mail.gmail.com> (raw) [-- Attachment #1: Type: text/plain, Size: 1468 bytes --] Hi Salomon, Babel definitions, in this case, lots of elsip blocks to add behaviors like this example to clear bloc results on save to avoid polluting commits that can be turned on and off per section with properties. #+name: Clear-Results-On-Save #+begin_src emacs-lisp :results none ;;; code to clean up org-file results on save (defun CHAI-ClearResultsOnSave () (when (eq major-mode 'org-mode) (org-babel-map-executables nil (cond ((equal "true" (org-entry-get nil "ClearOnSave" t t)) (org-babel-remove-result)) )) )) ;;; interactive version that ignores PROPERTIES and clears all results (defun CHAI-ClearResultsNow () (interactive) (when (eq major-mode 'org-mode) (org-babel-map-executables nil (org-babel-remove-result)) )) ;;; add the hook before saving a file (add-hook 'before-save-hook 'CHAI-ClearResultsOnSave nil t) #+end_src In this case, the init block in the template.org file would have an org-sbe call to "Clear-Results-On-Save" after ingesting GeneralORGTools.org if I wanted that behavior. By convention, I always have an init bloc but in this case it is not very interesting: #+name:GeneralORGTools_Init #+BEGIN_SRC elisp ;; nice org-mode setting to remove newlines from the outline (setq org-cycle-separator-lines 0) #+end_src **correction from my previous post**: (org-sbe "GeneralORGTools.org") ' should have been a call to the init (org-sbe ":GeneralORGTools_Init") Regards Doug [-- Attachment #2: Type: text/html, Size: 2266 bytes --]
next reply other threads:[~2020-06-18 16:05 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-18 16:03 Douglas Perrin [this message] -- strict thread matches above, loose matches on Subject: below -- 2020-06-15 19:52 Douglas Perrin 2020-06-16 15:21 ` Salomon Turgman 2020-06-17 14:23 ` Salomon Turgman 2020-06-09 17:28 Salomon Turgman 2020-06-09 23:09 ` Nicolas Goaziou
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CAFw+bXFgCSFYhHVu0sxiSv1WjKpkbLNwdYTgDgjeaNGXhMPKrA@mail.gmail.com \ --to=doug2024@gmail.com \ --cc=emacs-orgmode@gnu.org \ --subject='Re: Import Reusable org-babel snippet using #+SETUPFILE' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).