Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions Emacs.org
Original file line number Diff line number Diff line change
Expand Up @@ -612,15 +612,11 @@ This snippet adds a hook to =org-mode= buffers so that =efs/org-babel-tangle-con

#+begin_src emacs-lisp

;; Automatically tangle our Emacs.org config file when we save it
(defun efs/org-babel-tangle-config ()
(when (string-equal (file-name-directory (buffer-file-name))
(expand-file-name user-emacs-directory))
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))

(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config)))
;; Automatically tangle any org file in our emacs directory when we save it.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it I updated the comment to reflect the changes you at some point did to the code (before it was just Emacs.org, now it is all org files in user emacs directory).

(add-hook 'org-mode-hook (lambda ()
(when (string-equal (file-name-directory (buffer-file-name)) (expand-file-name user-emacs-directory))
(add-hook 'after-save-hook (lambda ()
(let ((org-confirm-babel-evaluate nil)) (org-babel-tangle)))))))

#+end_src

Expand Down