mirror of
https://github.com/protesilaos/denote.git
synced 2026-09-10 07:16:20 -04:00
Make the 'denote' command kill buffers after running denote-after-new-note-hook
Otherwise it kills the buffer too early. Thanks to hapst3r for reporting this problem and to Jean-Philippe Gagné Guay for contributing to the discussion about how best to approach this. Done in issue 460: <https://github.com/protesilaos/denote/issues/460>.
This commit is contained in:
parent
f86e3aaff0
commit
244472f506
|
|
@ -176,7 +176,12 @@ explained: [[#h:4e9c7512-84dc-4dfb-9fa9-e15d51178e5d][The file naming scheme]]
|
|||
|
||||
#+vindex: denote-after-new-note-hook
|
||||
The ~denote~ command runs the hook ~denote-after-new-note-hook~ after
|
||||
creating the new note.
|
||||
creating the new note. When called from Lisp, it returns the path it
|
||||
generates. Before returning the path, it decides what to do with the
|
||||
buffer of the note, in accordance with the user option
|
||||
~denote-kill-buffers~ ([[#h:c8fd826f-3ac9-4820-9709-4375603f8865][The ~denote-kill-buffers~ option]]). [ As part of
|
||||
{{{development-version}}}, the ~denote~ command runs the hook and then
|
||||
kills the buffer, whereas it was the other way around before. ]
|
||||
|
||||
The file type of the new note is determined by the user option
|
||||
~denote-file-type~ ([[#h:13218826-56a5-482a-9b91-5b6de4f14261][Front matter]]).
|
||||
|
|
|
|||
|
|
@ -2396,8 +2396,9 @@ instead of that of the parameter."
|
|||
(defun denote (&optional title keywords file-type directory date template signature)
|
||||
"Create a new note with the appropriate metadata and file name.
|
||||
|
||||
Run the `denote-after-new-note-hook' after creating the new note
|
||||
and return its path.
|
||||
Run the `denote-after-new-note-hook' after creating the new note and
|
||||
return its path. Before returning the path, determine what needs to be
|
||||
done to the buffer, in accordance with the user option `denote-kill-buffers'.
|
||||
|
||||
When called interactively, the metadata and file name are prompted
|
||||
according to the value of `denote-prompts'.
|
||||
|
|
@ -2432,9 +2433,9 @@ When called from Lisp, all arguments are optional.
|
|||
(denote--creation-prepare-note-data title keywords file-type directory date template signature))
|
||||
(id (denote--find-first-unused-id (denote-get-identifier date)))
|
||||
(note-path (denote--prepare-note title keywords date id directory file-type template signature)))
|
||||
(denote--handle-save-and-kill-buffer 'creation note-path nil)
|
||||
(denote--keywords-add-to-history keywords)
|
||||
(run-hooks 'denote-after-new-note-hook)
|
||||
(denote--handle-save-and-kill-buffer 'creation note-path nil)
|
||||
note-path))
|
||||
|
||||
(defvar denote-title-history nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue