diff --git a/emacs.d/org-roam-templates/main.el b/emacs.d/org-roam-templates/main.el index f5c2db4..add0b9b 100644 --- a/emacs.d/org-roam-templates/main.el +++ b/emacs.d/org-roam-templates/main.el @@ -1,6 +1,17 @@ ;; -*- mode: emacs-lisp; buffer-read-only: t; -*- +;; be paranoid, only open org files in read-only mode. +;; +(defun myorg-open-read-only-mode () + "Enable `read-only-mode' for Org mode files." + (when (and buffer-file-name + (string-match "\\.org\\'" buffer-file-name)) + (read-only-mode 1))) + +(add-hook 'org-mode-hook 'myorg-open-read-only-mode) + + ;;;; add inactive timestamp to every org-item ;; https://stackoverflow.com/a/52815573/5115219 ;; https://emacs.stackexchange.com/a/45369/29404