Browse Source

Remove advice before before org-capture-place template

Now that nroam inserts a non read-only \n after the sections so that text can be
inserted after nroam sections at the end of the buffer, remove the extra
read-only \n so that org-capture can insert templates.

* nroam.el (nroam--handle-org-capture): Remove function and advice.
* nroam-unlinked.el (nroam-unlinked--insert-toggle-button): Do not insert a
read-only newline as it prevents org-capture from inserting the template as it
tries to delete empty lines at the end of the buffer.
master
Nicolas Petton 2 years ago
parent
commit
72bc00f3ec
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
2 changed files with 1 additions and 14 deletions
  1. +1
    -2
      nroam-unlinked.el
  2. +0
    -12
      nroam.el

+ 1
- 2
nroam-unlinked.el View File

@ -62,8 +62,7 @@
"Insert a button to show unlinked references."
(let ((beg (point)))
(insert "[Show unlinked references]")
(make-text-button beg (point) 'action #'nroam-unlinked--show-references)
(insert "\n")))
(make-text-button beg (point) 'action #'nroam-unlinked--show-references)))
(defun nroam-unlinked--show-references (&rest _)
"Search for and show unlinked references."


+ 0
- 12
nroam.el View File

@ -56,18 +56,6 @@
(defvar-local nroam-start-marker nil)
(defvar-local nroam-end-marker nil)
(defun nroam--handle-org-capture (&rest _)
"Setup the `org-capture' buffer.
Nroam sections need to be pruned as they are in read-only,
otherwise `org-capture' will fail to insert the capture
template."
(when-let ((buf (org-capture-get :buffer)))
(with-current-buffer buf
(nroam--prune))))
(advice-add 'org-capture-place-template :before #'nroam--handle-org-capture)
(defmacro with-nroam-markers (&rest body)
"Evaluate BODY.
Make the region inserted by BODY read-only, and marked with


Loading…
Cancel
Save