Skip to content

The denote-rename-buffer-format option

The user option denote-rename-buffer-format controls how the function denote-rename-buffer chooses the name of the buffer-to-be-renamed. It also affects the denote-rename-buffer-mode (Automatically rename Denote file buffers).

The value of this user option is a string that gets combined with the denote-buffer-name-prefix (Set the prefix of all Denote buffers). The following specifiers are placeholders for Denote file name components (The file-naming scheme):

  • The ‘%t’ is the Denote ‘TITLE’ in the front matter or the file name.
  • The ‘%T’ is the Denote ‘TITLE’ in the file name.
  • The ‘%i’ is the Denote ‘IDENTIFIER’ of the file.
  • The ‘%I’ is the identifier converted to ‘DAYNAME, DAYNUM MONTHNUM YEAR’.
  • The ‘%d’ is the same as ‘%i’ (‘DATE’ mnemonic).
  • The ‘%D’ is a “do what I mean” which behaves the same as ‘%t’ and if that returns nothing, it falls back to ‘%I’, then ‘%i’.
  • The ‘%s’ is the Denote ‘SIGNATURE’ of the file.
  • The ‘%k’ is the Denote ‘KEYWORDS’ of the file.
  • The ‘%b’ is an indicator of whether or not the file has backlinks pointing to it. The indicator string is defined in the user option denote-rename-buffer-backlinks-indicator, alias denote-buffer-has-backlinks-string.
  • The ‘%%’ is a literal percent sign.

In addition, the following flags are available for each of the specifiers:

0

Pad to the width, if given, with zeros instead of spaces.

-

Pad to the width, if given, on the right instead of the left.

<

Truncate to the width and precision, if given, on the left.

>

Truncate to the width and precision, if given, on the right.

^

Convert to upper case.

_

Convert to lower case.

When combined all together, the above are written thus:

%<flags><width><precision>SPECIFIER-CHARACTER

Any other string it taken as-is.

Users who need yet more flexibility are best served by writing their own function and assigning it to the denote-rename-buffer-function.