From 9c3a255f906be0a4dd4695fc4e68e52c6d58c977 Mon Sep 17 00:00:00 2001 From: AChavali Date: Mon, 30 Dec 2019 23:30:55 +0000 Subject: ~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 --- doom.d/modules/literate.org | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'doom.d/modules/literate.org') 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 -- cgit v1.2.3-13-gbd6f