Function: denote-link-after-creating
denote-link-after-creating is an autoloaded, interactive and
byte-compiled function defined in denote.el.
Signature
(denote-link-after-creating &optional ID-ONLY)
Documentation
Create new note in the background and link to it directly.
Use denote interactively to produce the new note. Its doc
string explains which prompts will be used and under what
conditions.
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
to kill the buffer, thus cancelling the creation of the note).
However, for this command the creation of the note happens in the
background and the user may miss the step of saving their buffer.
We thus have to save the buffer in order to (i) establish valid
links, and (ii) retrieve whatever front matter from the target
file. Though see denote-save-buffer-after-creation.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
;;;###autoload
(defun denote-link-after-creating (&optional id-only)
"Create new note in the background and link to it directly.
Use `denote' interactively to produce the new note. Its doc
string explains which prompts will be used and under what
conditions.
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
to kill the buffer, thus cancelling the creation of the note).
However, for this command the creation of the note happens in the
background and the user may miss the step of saving their buffer.
We thus have to save the buffer in order to (i) establish valid
links, and (ii) retrieve whatever front matter from the target
file. Though see `denote-save-buffer-after-creation'."
(interactive "P")
(unless (or (denote--file-type-org-extra-p)
(and buffer-file-name (denote-file-has-supported-extension-p buffer-file-name)))
(user-error "The current file type is not recognized by Denote"))
(let* ((type (denote-filetype-heuristics (buffer-file-name)))
(path (denote--command-with-features #'denote nil nil :save :in-background))
(description (denote-get-link-description path)))
(denote-link path type description id-only)))