~protesilaos/denote

42fcbd39a91d891b3f217fbd8ce93a982cfa54df — Protesilaos Stavrou 1 year, 21 days ago cd47e8b
Add command 'denote-link-after-creating-with-command' (also see cd47e8b)
2 files changed, 33 insertions(+), 0 deletions(-)

M README.org
M denote.el
M README.org => README.org +12 -0
@@ 1799,6 1799,14 @@ this end, Denote provides two convenience commands:
  the buffer in order to (i) establish valid links, and (ii) retrieve
  whatever front matter from the target file.

#+findex: denote-link-after-creating-with-command
+ ~denote-link-after-creating-with-command~ :: This command is like
  ~denote-link-after-creating~ except it prompts for a note-creating
  command ([[*Points of entry][Points of entry]]).  Use this to, for example, call
  ~denote-signature~ so that the newly created note has a signature as
  part of its file name.  Optional =ID-ONLY= has the same meaning as
  in the command ~denote-link-after-creating~.

#+findex: denote-link-or-create
+ ~denote-link-or-create~ :: Use ~denote-link~ on =TARGET= file,
  creating it if necessary.


@@ 2860,6 2868,10 @@ For templates, refer to `denote-templates'."
:CUSTOM_ID: h:b6056e6b-93df-4e6b-a778-eebd105bac46
:END:

[ As part of {{{development-version}}} we provide the command
  ~denote-link-after-creating-with-command~.  It supersedes what we
  document in this section. ]

#+findex: denote-link-or-create
The command ~denote-link-or-create~ uses ~denote-link~ on a =TARGET=
file, creating it if necessary.  The =TARGET= matches the user input at

M denote.el => denote.el +21 -0
@@ 3097,6 3097,8 @@ With optional ID-ONLY as a prefix argument create a link that
consists of just the identifier.  Else try to also include the
file's title.  This has the same meaning as in `denote-link'.

For a variant of this, see `denote-link-after-creating-with-command'.

IMPORTANT NOTE: Normally, `denote' does not save the buffer it
produces for the new note.  This is a safety precaution to not
write to disk unless the user wants it (e.g. the user may choose


@@ 3115,6 3117,25 @@ file."
    (denote-link path id-only)))

;;;###autoload
(defun denote-link-after-creating-with-command (command &optional id-only)
  "Like `denote-link-after-creating' but prompt for note-making COMMAND.
Use this to, for example, call `denote-signature' so that the
newly created note has a signature as part of its file name.

Optional ID-ONLY has the same meaning as in the command
`denote-link-after-creating'."
  (interactive
   (list
    (denote-command-prompt)
    current-prefix-arg))
  (let (path)
    (save-window-excursion
      (call-interactively command)
      (save-buffer)
      (setq path (buffer-file-name)))
    (denote-link path id-only)))

;;;###autoload
(defun denote-link-or-create (target &optional id-only)
  "Use `denote-link' on TARGET file, creating it if necessary.