Commit graph

37 commits

Author SHA1 Message Date
Protesilaos Stavrou 8182604ff3
Increase max-mini height for rename prompt
Just to be sure we fit in more text when prompting for the change to the
front matter.
2022-06-24 06:29:52 +03:00
Protesilaos Stavrou b25235e93e
Add header links to the mailing list 2022-06-23 08:35:41 +03:00
Protesilaos Stavrou ee4aed6376
Refine check for denote dir in dired revert
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>.
2022-06-21 13:22:38 +03:00
Damien Cassou 6b200b31ef
Simplify denote-dired--rename-buffer
The new code is basically what `dired-rename-file' does.
2022-06-20 18:37:06 +03:00
Protesilaos Stavrou f21a99775d
Improve rename prompt; only rename regular files
Thanks to Frank Ehmsen for the feedback on the mailing list:
<https://lists.sr.ht/~protesilaos/denote/%3C9deea16e-d0d0-91b0-2b6a-0b8276406c6c@eh-is.de%3E>.
2022-06-17 21:19:21 +03:00
Protesilaos Stavrou 8d504a3264
Check to operate on dired-rename window
Thanks to Frank Ehmsen for the feedback on the mailing list:
<https://lists.sr.ht/~protesilaos/denote/%3C9deea16e-d0d0-91b0-2b6a-0b8276406c6c@eh-is.de%3E>.
2022-06-17 20:33:59 +03:00
Protesilaos Stavrou c3feb9a0ec
Remove superfluous when
The diff is mostly indentation.  The very first 'when' was just moved
inside the subsequent 'when-let*'
2022-06-17 18:02:46 +03:00
Protesilaos Stavrou da32e7f7f9
Tweak denote-dired-rewrite-front-matter docstring 2022-06-17 18:02:03 +03:00
Protesilaos Stavrou 443c687f05
Update denote-dired--edit-front-matter-p docstring 2022-06-17 17:59:50 +03:00
Protesilaos Stavrou 995ef56415
Improve check in denote-dired--edit-front-matter-p 2022-06-17 17:58:26 +03:00
Protesilaos Stavrou 737c647957
Rename buffer post file rename 2022-06-17 17:58:19 +03:00
Protesilaos Stavrou 83d53afae4
Improve dired revert-buffer post rename 2022-06-17 17:52:08 +03:00
Protesilaos Stavrou a785de6760
Make sure minibuffer can be resized while renaming
We need it to display the echo are message about the potential change to
the file's front matter.
2022-06-17 11:26:32 +03:00
Protesilaos Stavrou 1b4dc74e3c
Update denote-dired.el Commentary section 2022-06-16 12:47:52 +03:00
Protesilaos Stavrou a436cdf07e
Tweak doc strings 2022-06-16 12:23:35 +03:00
Protesilaos Stavrou 3a63c763c5
Improve post-rename front matter rewrite
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.
2022-06-16 10:00:04 +03:00
Protesilaos Stavrou a0525a0154
Do not try front matter rewrite on non-notes 2022-06-16 09:08:01 +03:00
Protesilaos Stavrou 9be3cfab99
Relocate defcustom where it belongs 2022-06-16 09:01:12 +03:00
Protesilaos Stavrou 4041e437b2
Add PROTOTYPE of front matter rewrite post-rename 2022-06-16 08:58:25 +03:00
Protesilaos Stavrou f8b2d44508
Depend on Emacs 27.2, not 27.1 2022-06-16 05:49:29 +03:00
Protesilaos Stavrou fc9f909061
Change denote--id to denote--id-format
It is important for clarity, otherwise I keep getting confused.
2022-06-14 21:09:33 +03:00
Protesilaos Stavrou 890a335092
Add denote-dired-rename-expert user option 2022-06-12 17:17:25 +03:00
Protesilaos Stavrou e92137a548
Use file attribute for mod time while renaming
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>.
2022-06-12 16:54:22 +03:00
Protesilaos Stavrou 0e75e46b32
Improve denote-dired-rename-file
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).
2022-06-12 05:34:33 +03:00
Protesilaos Stavrou 112a12e6e5
Remove duplicate word from face names 2022-06-11 19:28:10 +03:00
Protesilaos Stavrou f91d2472c3
Make the field delimiter face a bit more subtle 2022-06-11 18:43:52 +03:00
Protesilaos Stavrou 142b628c2e
Apply distinct face to keyword delimiter
Thanks to svnsbck for suggesting the idea in issue 9 over at the GitHub
mirror: <https://github.com/protesilaos/denote/issues/9>.
2022-06-11 18:33:23 +03:00
Protesilaos Stavrou 8a35382067
Rename internal variable for clarity 2022-06-11 17:45:09 +03:00
Protesilaos Stavrou 3f9bfcb74e
Name the FSF as the copyright holder
This is for the eventual inclusion in the official GNU ELPA archive (as
with all my Emacs packages: <https://protesilaos.com/emacs>).
2022-06-10 16:01:46 +03:00
Protesilaos Stavrou e1bd4c9cb8
BREAKING Put keywords after the title
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).
2022-06-10 08:08:37 +03:00
Protesilaos Stavrou db9584f51d
BREAKING Change date/identifier pattern
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.
2022-06-10 07:46:52 +03:00
Protesilaos Stavrou 712e24465a
Update denote-dired.el Commentary 2022-06-08 12:02:33 +03:00
Protesilaos Stavrou d09b748c8d
Fix fontification; add denote-dired-directories 2022-06-08 11:50:35 +03:00
Protesilaos Stavrou eee100cc50
Add denote-dired-rename-file
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>.
2022-06-08 10:47:18 +03:00
Protesilaos Stavrou 431124fea1
Generalise dired fontification
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>.
2022-06-08 10:45:46 +03:00
Protesilaos Stavrou 418a21dccb
Tweak file and defgroup descriptions 2022-06-07 17:21:49 +03:00
Protesilaos Stavrou 0185f38dde
Add denote-dired.el for useful fontification 2022-06-07 10:41:19 +03:00