protesilaos / denote

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

Issue in creating/renaming files in denote format #345

Closed Kolmas225 closed 4 months ago

Kolmas225 commented 4 months ago

If there isn't at least 1 file in denote naming format in the denote-directory, then calling denote functions (e.g. denote, denote-rename-file) anywhere will error with denote-directory-files: The ‘denote-directory’ has no files and blocking the creation/renaming process.

Possibly introduced by 3badc7f2e873ad5b683ec79036363c2450c598f3

protesilaos commented 4 months ago

Mea culpa! I fixed it now. We still need some way to handle this case, but not for file-creating notes. Perhaps by adding a new parameter to the denote-directory-files...

jeanphilippegg commented 4 months ago

I am not sure what case you want to handle here? I see you made developments to denote-org-extras-link-to-heading. Is this related to this?

In any case, I don't think it is a good idea to add a parameter to denote-directory-files. The function returns the files that it finds. If there are none, then an empty list is returned. This is as expected and it is not wrong. Now, if some caller (maybe denote-org-extras-link-to-heading?) wants to do something special in this case, then it is probably there that it should be handled.

protesilaos commented 4 months ago

From: Jean-Philippe Gagné Guay @.***> Date: Sat, 11 May 2024 08:28:40 -0700

In any case, I don't think it is a good idea to add a parameter to denote-directory-files. The function returns the files that it finds. If there are none, then an empty list is returned. This is as expected and it is not wrong. Now, if some caller (maybe denote-org-extras-link-to-heading?) wants to do something special in this case, then it is probably there that it should be handled.

Yes, this was my follow-up thought. Indeed, the caller has to handle this.

-- Protesilaos Stavrou https://protesilaos.com