Browse Source

Insert sections when turning the mode on if the buffer file exists.

* nroam.el (nroam-mode): Conditionally insert sections when turning enabling
`nroam-mode'.
(nroam--maybe-insert-immediately): New function.
master
Nicolas Petton 1 month ago
parent
commit
b909ccd800
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      nroam.el

+ 6
- 1
nroam.el View File

@ -99,11 +99,16 @@ Make the region inserted by BODY read-only, and marked with
(nroam--init-work-buffer)
(add-hook 'before-save-hook #'nroam--prune nil t)
(add-hook 'after-save-hook #'nroam--update-maybe nil t)
(nroam-update))
(nroam--maybe-insert-immediately))
(remove-hook 'before-save-hook #'nroam--prune t)
(remove-hook 'after-save-hook #'nroam--update-maybe t)
(nroam--prune)))
(defun nroam--maybe-insert-immediately ()
"Insert nroam sections iff the buffer file exists."
(when (file-exists-p buffer-file-name)
(nroam-update)))
;;;###autoload
(defun nroam-ctrl-c-ctrl-c ()
"Update the sections for the current buffer, or fallback to `org-ctrl-c-ctrl-c'."


Loading…
Cancel
Save