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)))

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)))

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

1 Answer 1


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.

  • Thank you! This solves it. I found C-c ; (org-toggle-comment) to be very handy. Commented Apr 8, 2020 at 15:45

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.