This means that if you are renaming "sample.pdf" from 2000-11-31 you
will get an identifier that reflects that date, instead of CURRENT-TIME.
Note that there are other file attributes for time. Read the doc string
of 'file-attributes'. If there is demand for it, we can add a user
option, otherwise I feel 'file-attribute-modification-time' is a
reasonable default.
Thanks to Jack Baty for proposing the idea over at the mailing list:
<https://lists.sr.ht/~protesilaos/denote/%3Cm2v8t6b45f.fsf@baty.net%3E>.
It now preserves the identifier, if it exists. So if you want to change
the title/keywords in a note's front matter, this command can then be
called to also update the file name (maybe there is some way to automate
this, but let's leave it for now).
The pattern now is:
DATE--TITLE__KEYWORDS.EXTENSION
Multiple keywords are separated by underscores. A multi-word keyword is
separated by hyphens:
_two_keywords
one-keyword-many-words
Also see the enforcement of sluggified keywords in commit 6000313.
This makes it specific that the front matter is YAML-compliant. It also
gives us the option to support TOML.
Thanks to Kaushal Modi for the feedback in issue 4 over at the GitHub
mirror: <https://github.com/protesilaos/denote/issues/4>.
Putting the tags/keywords at the end of the file has several advantages:
1. It is consistent with how such interfaces are designed, such as with
the 'elfeed', 'notmuch', and 'mu4e' Emacs packages.
2. It makes it easier to read the title of the file even if it is
truncated.
3. Makes fontification look better, as the more intensely coloured
keywords are further apart from the date/identifier which is also
colourful.
One way to update existing file names in Dired:
* Switch to wdired (C-x C-q by default)
* M-x isearch-forward-regexp (bound to C-M-s by default)
* Search for (without the quotes) '--\(.*?\)--\(.*?\)\.org'
* While in isearch, type M-%
* For the replacement use (without the quotes) '--\2--\1.org'
* Verify the conversion as you go through the query-replace.
A similar series of steps can be followed for file contents (e.g. by
making the grep buffer editable with the wgrep package).
Before it was like 20220531_091625, but now it is 20220531T091625.
I also introduced a new face, in case someone wants to style the time
part separately.
Jack's contribution is below the ~15 line threshold that is required for
projects that are distributed via GNU ELPA (denote will be one of them
in the near future).
Contributions exceeding that limit require that the author assigns
copyright to the Free Software Foundation.
There is no need to limit it to the denote-directory. We ultimately
want to fontify all Denote-style file names, not just the notes created
by Denote.
For example, I have been recording all my longer-term storage using such
a naming scheme: this mode gives me the extra faces for .pdf, .mp3, and
other files.
Users of Denote may want this for attachments.
The upside of having this as a buffer-local mode is that the user can
write a wrapper function that applies the mode only in a given
directory (like we were doing before).
Thanks to Ypot for suggesting a kernel of this idea in issue 1 over at
the GitHub mirror: <https://github.com/protesilaos/denote/issues/1>.