protesilaos / denote

Simple notes for Emacs with an efficient file-naming scheme
https://protesilaos.com/emacs/denote
GNU General Public License v3.0
455 stars 49 forks source link

Add `denote-file-name-components-order` to allow reordering #360

Closed jeanphilippegg closed 1 month ago

jeanphilippegg commented 1 month ago

This is a small pull request, but the whole feature is there!

I made denote-file-name-components-order a defvar because I do not know how to make it a defcustom. All file name components must be present.

This closes #332. (The delimiter of identifiers is @@.)

protesilaos commented 1 month ago

Merged, thank you! I just made a small comment about the double dash in titles, but it is not a blocking issue.

protesilaos commented 1 month ago

I just noticed that the fontification does not work in one case:

Screenshot_2024-05-19_08-22-53

jeanphilippegg commented 1 month ago

This is strange. It seems I can reproduce the issue, but it only happens when it is the first line of the Dired buffer, for example. I'll check it out.

jeanphilippegg commented 1 month ago

Merged, thank you! I just made a small comment about the double dash in titles, but it is not a blocking issue.

That is fine! I made pull request #362 to clarify this comment.

We already had this discussion in #331. Sorry if I left some misunderstandings. I will try to clear it with a better explanation.

In Denote, we have the "hard rules" of file names as well as the "sluggification".

The "hard rules"

The hard rules of file names are as permissive as possible. There are not many such rules, but there is no way for the user to opt-out of those rules. We enforce them unconditionally. They are:

As you can see from the above, these "hard rules" really are minimal and users will probably never notice them. In particular, these rules allow capital letters, spaces, underscores, punctuation, consecutive hyphens in titles, etc. We don't want to limit these here unless it is absolutely necessary. Imposing further rules is the job of the sluggification, for which we provide a sensible default.

The sluggification

On top of those "hard rules", we have the sluggification for which we provide a sensible default. They are an opinionated set of additional rules that we apply on file names through the user option denote-file-name-slug-functions. They are:

The default sluggification enforce these additional rules. However, the user is able to opt-out of them by configuring denote-file-name-slug-functions.

Conclusion

-- is allowed in titles only when the user decides to opt-out of the default sluggification. The same applies to capital letters, special characters, etc. In a sense, this is already hidden behind an "opt-in" mechanism.

The comment you are refering to in the code was made in denote--replace-consecutive-token-characters which is used to enforce the "hard rules", which are as permissive as possible (but not the default).

Hope things are clearer!

jeanphilippegg commented 1 month ago

I may have double-posted the previous comment! Sorry

protesilaos commented 1 month ago

From: Jean-Philippe Gagné Guay @.***> Date: Sun, 19 May 2024 07:06:26 -0700

[... 54 lines elided]

The comment you are refering to in the code was made in denote--replace-consecutive-token-characters which is used to enforce the "hard rules", which are as permissive as possible (but not the default).

Hope things are clearer!

This is clear, thank you!

-- Protesilaos Stavrou https://protesilaos.com

protesilaos commented 1 month ago

From: Jean-Philippe Gagné Guay @.***> Date: Sun, 19 May 2024 07:13:17 -0700

I may have double-posted the previous comment! Sorry

No worries!

-- Protesilaos Stavrou https://protesilaos.com

jeanphilippegg commented 1 month ago

I just noticed that the fontification does not work in one case:

Just commenting to let you know that I am still investigating the issue. This is a problem with the first item in a Dired buffer. Generally, there is a .git/ or some folder there.


After my currently open pull request, there will only be one more big pull request to make denote-directory accept a list of directories. After that, I think we will have all the features for Denote 3.0.0. But now, I intend to take a small pause to see if any issues arise from the latest changes that were made. I will investigate the current issue in that time.

I think you can close these issues: #277, #279, #287.

protesilaos commented 1 month ago

From: Jean-Philippe Gagné Guay @.***> Date: Sun, 19 May 2024 21:49:16 -0700

I just noticed that the fontification does not work in one case:

Just commenting to let you know that I am still investigating the issue. This is a problem with the first item in a Dired buffer.

Sure, no problem!

Generally, there is a .git/ or some folder there.

True for flat listings, though users can have subdirectories.


After my currently open pull request, there will only be one more big pull request to make denote-directory accept a list of directories. After that, I think we will have all the features for Denote 3.0.0.

Very well!

But now, I intend to take a small pause to see if any issues arise from the latest changes that were made. I will investigate the current issue in that time.

Yes, I think it is good practice to have 1-2 weeks of no major changes before we make a new version.

I think you can close these issues: #277, #279, #287.

Okay!

-- Protesilaos Stavrou https://protesilaos.com