Skip to content

Rename a file by adding or removing keywords interactively

The command denote-rename-file-keywords streamlines the process of interactively adding or removing keywords to a file, while changing its file name and front matter accordingly. It asks for keywords using the familiar minibuffer prompt (Standard note creation). It then renames the file (Rename a single file based on its front matter). The command respect the values of denote-rename-confirmations and denote-save-buffers:

Technically, denote-rename-file-keywords is a wrapper for denote-rename-file, doing all the things that does (Rename a single file).

Concretely, this command can add or remove keywords in one go. It does it by prepopulating the minibuffer prompt with the existing keywords. Users can then use the crm-separator (normally a comma), to write new keywords or edit what is in the prompt to rewrite them accordingly. An empty input means to remove all keywords (The file-naming scheme).

[ NOTE: Please check with your minibuffer user interface how to provide an empty input. The Emacs default setup accepts the empty minibuffer contents as they are, though popular packages like vertico use the first available completion candidate instead. For vertico, the user must either move one up to select the prompt and then type ‘RET’ there with empty contents, or use the command vertico-exit-input with empty contents. That Vertico command is bound to ‘M-RET’ as of this writing on 2024-06-30 10:37 +0300. ]