Link to an existing note or create a new one
In one’s note-taking workflow, there may come a point where they are expounding on a certain topic but have an idea about another subject they would like to link to (Linking notes). The user can always rely on the other linking facilities we have covered herein to target files that already exist. Though they may not know whether they already have notes covering the subject or whether they would need to write new ones. To this end, Denote provides two convenience commands:
denote-link-after-creating
Create new note in the background and link to it directly.
Use denote interactively to produce the new note. Its docstring or this manual explains which prompts will be used and under what conditions (Standard note creation).
With optional ‘ID-ONLY’ as a prefix argument (this is the ‘C-u’ key, by default) 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 (Adding a single link).
IMPORTANT NOTE: Normally, denote does not save the buffer it produces for the new note (The denote-save-buffer-after-creation option). 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.
denote-link-after-creating-with-command
This command is like denote-link-after-creating except it prompts for a note-creating command (Choose which commands to prompt for). 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.
denote-link-or-create
Use denote-link on ‘TARGET’ file, creating it if necessary.
If ‘TARGET’ file does not exist, call denote-link-after-creating which runs the denote command interactively to create the file. The established link will then be targeting that new file.
If ‘TARGET’ file does not exist, add the user input that was used to search for it to the history of the denote-file-prompt. The user can then retrieve and possibly further edit their last input, using it as the newly created note’s actual title. At the denote-file-prompt type ‘M-p’ with the default key bindings, which calls previous-history-element.
With optional ‘ID-ONLY’ as a prefix argument create a link with just the file’s identifier. This has the same meaning as in denote-link.
This command has the alias denote-link-to-existing-or-new-note, which helps with discoverability.
denote-link-or-create-with-command
This command is the same concept as denote-link-or-create except it prompts for the specific command for creating a new note (Choose which commands to prompt for).
In all of the above, an optional prefix argument (‘C-u’ by default) creates a link that consists of just the identifier. This has the same meaning as in the regular denote-link command.
Denote provides similar functionality for opening an existing note or creating a new one (Open an existing note or create it if missing).