Skip to content

Define a completely custom identifier scheme

[ DEVELOPER NOTE: This is for advanced users. If you really need custom identifiers but are not sure how to proceed, please ask and I will help you. ]

By default, the Denote identifier consists of the date and time in a compact format (The file-naming scheme). Denote, however, can work with identifiers of an arbitrary format, provided each identifier is unique. Any string will do.

The variable denote-get-identifier-function specifies the function that Denote uses to derive a new identifier. The return value is a string. This function is called while creating new files and when renaming an existing file:

The function assigned to denote-get-identifier-function takes two arguments: an initial identifier and a date. The initial identifier is used as a reference to derive a unique variant of it (e.g. to keep incrementing seconds while keeping the rest of the date+time the same). Existing identifiers are stored in the variable denote-used-identifiers. If the initial identifier is nil or an identifier cannot be derived from it, then the date can be used instead. The date has the same format as ‘current-time’. When it is nil, the ‘current-time’ is used.

In the following code block, we provide an example of an identifier scheme that encodes information related to publications: the year, the edition, the author or authors, the format (e.g. book or paper), and the publisher. For users who maintain a library of academic works, for example, this kind of identifier is more useful than the default date+time scheme.