0

I started to move my config file to an org-file just recently.

I wondered if it was possible to use the TODO state to activate or deactivate source blocks in the entry under the heading. This way it would be very easy to try out settings and customization.

Example: with #+TODO: ON | OFF

* ON use org-bullets
  #+BEGIN_SRC emacs-lisp
   (require 'org-bullets)
   (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
  #+END_SRC

and after state change it would be

* OFF use org-bullets
  #+BEGIN_SRC emacs-lisp
   ;;(require 'org-bullets)
   ;;(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
  #+END_SRC

I thought about using the org-after-todo-state-change-hook but I know too litte elisp to go beyond that. The setting should only work in the config.org file, not in other org files.

Any helpful idea is appreciated.

P.S.: my M-x emacs-version is

GNU Emacs 26.1 (build 2, arm-unknown-linux-gnueabihf, GTK+ Version 3.24.5) of 2019-09-23, modified by Debian
0

If you set the todo state to the special keyword COMMENT the entire heading will be treated as a comment and no source blocks under it will run.

| improve this answer | |
  • Thank you! This solves it. I found C-c ; (org-toggle-comment) to be very handy. – breathe_in_breathe_out Apr 8 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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