This pertains to the post-rename operation where relevant Dired buffers
are reverted. The previous check would sometimes compare incompatible
file paths and thus return nil when it shouldn't.
Thanks to Sven Seebeck for reporting the problem in issue 17 over at the
GitHub mirror: <https://github.com/protesilaos/denote/issues/17>.
Expands on commit 4041e43 with the benefit of 74962d1.
I wanted to make it operate on the front matter only when it makes
sense. For example, if we have a txt file which is empty, we want to
abort silently: just do the rename.
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).
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.
This is not limited to notes that were created with Denote: it works on
any file in any directory. The idea is to apply the Denote-style file
name in more contexts, such as for longer-term storage and attachments
to notes.
Also see commit 431124f, which is thematically aligned with this one.
Thanks to Ypot for giving me the idea in issue 1 over at the GitHub
mirror: <https://github.com/protesilaos/denote/issues/1>.
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>.