protesilaos / denote

Simple notes for Emacs with an efficient file-naming scheme
https://protesilaos.com/emacs/denote
GNU General Public License v3.0
499 stars 53 forks source link

`denote-create-note` silently #413

Closed kvineet closed 1 week ago

kvineet commented 3 weeks ago

Thanks for your excellent package.

I wanted to do org-capture directly to the today's journal file. While this works when the file already exists, it does not work correctly when today's journal does not exist.

Is there a way for denote-create-note to create file silently in background? and not open buffer for it.

Essentially on similar lines of denote-save-buffers but to kill buffer after saving.

jeanphilippegg commented 2 weeks ago

The current denote command does not have this functionality. Here is how you can get this (interactive) command for now:

(defun denote-create-note-silently ()
  (interactive)
  (when-let ((denote-save-buffers t)
             (new-note (call-interactively #'denote))
             (buffer (find-buffer-visiting new-note)))
    (kill-buffer buffer)))

or this may work:

(setq denote-save-buffers t)
(add-hook denote-after-new-note-hook #'kill-buffer)

I think having an option to kill a buffer automatically is a good idea. It has already been suggested for renaming commands in #273. It would be good to consider creation commands when/if we get to implementing this feature.

protesilaos commented 2 weeks ago

From: Jean-Philippe Gagné Guay @.***> Date: Sun, 25 Aug 2024 19:35:31 -0700

[... 19 lines elided]

I think having an option to kill a buffer automatically is a good idea. It has already been suggested for renaming commands in #273. It would be good to consider creation commands when/if we get to implementing this feature.

Yes, I think this is a nice feature to have.

-- Protesilaos Stavrou https://protesilaos.com

protesilaos commented 1 week ago

Closing now that we have the new user option denote-kill-buffers by @jeanphilippegg.