diff options
author | AChavali <aryadevchavali1@gmail.com> | 2019-12-30 23:30:55 +0000 |
---|---|---|
committer | AChavali <aryadevchavali1@gmail.com> | 2019-12-30 23:30:55 +0000 |
commit | 9c3a255f906be0a4dd4695fc4e68e52c6d58c977 (patch) | |
tree | 84a773f2e04ff07a14df7b02478e80f7d10844d5 /doom.d/modules | |
parent | abfb93bb3779799a773ffc4def4cd8bfb2c83d62 (diff) | |
download | dotfiles-9c3a255f906be0a4dd4695fc4e68e52c6d58c977.tar.gz dotfiles-9c3a255f906be0a4dd4695fc4e68e52c6d58c977.tar.bz2 dotfiles-9c3a255f906be0a4dd4695fc4e68e52c6d58c977.zip |
~moved add-hook to inside the hook function decl
Hook function is in tandem with the add-hook declaration.
~README.org is to be ignored when coding the config, it's not a literate component
Diffstat (limited to 'doom.d/modules')
-rw-r--r-- | doom.d/modules/literate.org | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/doom.d/modules/literate.org b/doom.d/modules/literate.org index 59ab9cf..a1a3bf0 100644 --- a/doom.d/modules/literate.org +++ b/doom.d/modules/literate.org @@ -68,16 +68,18 @@ directory contribute to the config. The location is not set because this function could be easily programmed to use multiple /differing/ sources to produce the config. * Hook on save -Now we need to make a hook that, when the current buffer is an org file in the -doom directory, will run the literate config procedure from above. +Now we need to make a hook function that, when the current buffer is an org file +in the doom directory, will run the literate config procedure from above. Use +this hook function and add it to the after-save-hook once org mode has been +loaded. README.org has been added as an exception because it doesn't contain +literate contents. #+BEGIN_SRC elisp (defun oreodave/literate/compile-hook () (when (and (eq major-mode 'org-mode) - (or (file-in-directory-p buffer-file-name doom-private-dir))) - (oreodave/literate/tangle-all))) -#+END_SRC -* Add hook to org-mode -#+BEGIN_SRC elisp + (file-in-directory-p buffer-file-name doom-private-dir) + (not (string= buffer-file-name (expand-file-name (concat doom-private-dir "README.org"))))) + (oreodave/literate/tangle buffer-file-name (oreodave/literate/destination buffer-file-name)))) + (after! org (add-hook 'after-save-hook #'oreodave/literate/compile-hook)) #+END_SRC |