[emacs] fix up org-roam writeroom config

This commit is contained in:
Correl Roush 2020-12-24 21:08:47 -05:00
parent 51998df6ee
commit 45e9e6439a

View file

@ -922,8 +922,14 @@ Adapted from https://org-roam.readthedocs.io/en/master/org_export/.
*** Use writeroom in org-roam buffers
#+begin_src emacs-lisp
(defun my/org-roam-writeroom ()
(when (f-child-of? (buffer-file-name) org-roam-directory)
(writeroom-mode t)))
;; Use a buffer-local local variables hook to ensure the org-roam-directory is
;; set properly
(add-hook 'hack-local-variables-hook
(lambda ()
(when (f-child-of? (or (buffer-file-name) default-directory)
(expand-file-name org-roam-directory))
(writeroom-mode t)))
nil t))
(add-hook! 'org-mode-hook #'my/org-roam-writeroom)
#+end_src