-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
denote-rename-file and associated commands (denote-rename-file-keywords) replace formatting of the title with sluggified title #439
Comments
This is not desirable. What version of Denote are you using? I cannot reproduce this on my end. Can you give the steps you are doing to get this behavior? For example, here is one of my tests: 1- Call Also, can you evaluate this while inside the problematic note (using (denote-retrieve-front-matter-title-value buffer-file-name 'org) |
From: Jean-Philippe Gagné Guay ***@***.***>
Date: Tue, 17 Sep 2024 17:22:50 -0700
This is not desirable.
What version of Denote are you using? I cannot reproduce this on my end.
I cannot reproduce it on my end either.
…--
Protesilaos Stavrou
https://protesilaos.com
|
I had this issue as well, but with the latest update I cannot reproduce it either. |
I made a new note with title However, as soon as I add a keyword to the note using The value of (denote-retrieve-front-matter-title-value buffer-file-name 'org) is EDIT:
Again, it is my impression that this change in behaviour is recent, as in, appearing at some point in the last two weeks. |
Thank you! I can reproduce the issue if I have these files:
Here are the steps:
Do you have symbolic links involved as well? It seems like the issue is when checking that the file is in the current directory. I am not sure what is the best way to handle this. Maybe fix Making |
Yes I do. It has become second nature to me which is why I didn't mention it 🤦 I also have set |
[... 27 lines elided]
Thank you!
@protesilaos
I am not sure what is the best way to handle this. Maybe fix
`denote-filename-is-note-p` and `denote--dir-in-denote-directory-p` to
use `file-truename` to do the comparison?
We do use 'file-truename' to get the subdirectories. I think we have not
had any issues with this approach.
Making `(denote-directory)` return the file truename may not be a good
idea as I think we display it in some of the prompts and the symlink
probably looks better.
If it is only about the prompt, then we can work around that. But let's
first do the other functions and keep this for last.
…--
Protesilaos Stavrou
https://protesilaos.com
|
From: hapst3r ***@***.***>
Date: Thu, 19 Sep 2024 22:59:34 -0700
[... 19 lines elided]
> Do you have symbolic links involved as well?
>
> It seems like the issue is when checking that the file is in the current directory.
Yes I do. It has become second nature to me which is why I didn't mention it :facepalm:
Can you tell me more about your workflow? I am curious what the use-case
is. This can help anticipate future bugs.
…--
Protesilaos Stavrou
https://protesilaos.com
|
ok, I can confirm this issue: it happens when I am in dired and add keywords, then the titles are all "messed up" |
You also have symbolic links? |
Yeah sure. Essentially I have one folder that is supposed to store all state data (config, music, savegames, notes, ...). This folder is synchronized using git and a personal cloud to facilitate backups and re-deployment on new machines. On a new machine, using stow, I redeploy all data to the correct locations. If I want my notes at Since denote notes are very long by nature (mine are, anyway), I wanted the short version to be displayed (omitting the |
Use file-truename to handle symbolic links (issue #439)
Thank you @hapst3r for the explanation! I just merged the changes done by @jeanphilippegg to account for symlinks. Please give it a try. |
Protesilaos Stavrou ***@***.***> writes:
Thank you @hapst3r for the explanation!
I just merged the changes done by @jeanphilippegg to account for symlinks. Please give it a try.
I've just tested it on an existing and a new note, both with (find-file-visit-truename
nil) and (find-file-visit-truename t). It works :-)
|
yes, my emacs/denote-folder is also within a path with symbolic links. |
I just tested with the latest update and in my use-case (being in dired and adding/removing keywords I noticed two things:
|
Can you share the details of your tests? These elements would be useful:
|
This issue is tricky. I have reverted my last pull request. Though, it fixed Let's say
When visiting This is technically doable. However, this scanning of So I think we will just have to include this warning somewhere:
This is not ideal, but if you visit "~/some-dir/some-note.org" (directly or |
Directory Structure
and within
commands I usedI am in dired in the folder value of variable
|
I cannot reproduce the issue with a similar structure.
|
it says:
I ran
|
Ok, thank you! I will try experimenting with this. One other question:
If I understand correctly, the real file is |
In Edit: @jeanphilippegg
|
Thank you! I could reproduce the issue, but not with the latest code. Are you sure you have the latest code? Can you evaluate this and try again: (defun denote-filename-is-note-p (filename)
(and (string-prefix-p (file-truename (denote-directory))
(file-truename (expand-file-name filename)))
(denote-file-has-identifier-p filename)
(denote-file-has-supported-extension-p filename))) If you want to do a quick test, you can just open your problematic note and evalute |
@jeanphilippegg With the snippet everythings seems to work and I didnt see any issue of sluggified titles anymore.
|
Ok, thank you! This makes the situation clear. The latest code creates other issues and should be reverted though. We need to think of a way to handle symlinks. With your setup, you could set |
btw, I am running denote with my denote-directy is set to Do you suggest to set explicitly |
I cannot find this commit in Denote repo. Maybe this is a Doom repo.
Yes, I suggest changing it. It is logically the same thing, but that is what Denote does not handle well as the moment. For now, I think it would be better if you set |
From: Jean-Philippe Gagné Guay ***@***.***>
Date: Sat, 21 Sep 2024 06:14:43 -0700
[... 16 lines elided]
This is technically doable. However, this scanning of `denote-directory` is
a costly operation. We probably don't want to introduce this in
`denote-filename-is-note-p`, as it is used in many places and it intended to
be a quick check.
So I think we will just have to include this warning somewhere:
```
If your `denote-directory` or its subdirectories involve symbolic links, make
sure that you access them using those links (and that
`find-file-visit-truename` is nil). Otherwise, Denote features will not work.
```
This is not ideal, but if you visit "~/some-dir/some-note.org" (directly or
with `find-file-visit-truename` t), we cannot know that this file is in
`denote-directory` without the costly operation of scanning the whole
`denote-directory`.
How about we introduce a user option which will do this costly
operation? It will be an opt-in feature, so that not everyone has to
incur this performance penalty.
…--
Protesilaos Stavrou
https://protesilaos.com
|
From: Jean-Philippe Gagné Guay ***@***.***>
Date: Sat, 21 Sep 2024 14:30:23 -0700
Ok, thank you! This makes the situation clear.
The latest code creates other issues and should be reverted though. We
need to think of a way to handle symlinks.
Fine, I will do it now.
…--
Protesilaos Stavrou
https://protesilaos.com
|
It could be a good solution. And also warn users of its cost. |
From: Jean-Philippe Gagné Guay ***@***.***>
Date: Sun, 22 Sep 2024 20:42:47 -0700
> How about we introduce a user option which will do this costly
> operation? It will be an opt-in feature, so that not everyone has to
> incur this performance penalty.
It could be a good solution. And also warn users of its cost.
Do you want to do it, or shall I give it a try?
…--
Protesilaos Stavrou
https://protesilaos.com
|
Go ahead! |
From: Jean-Philippe Gagné Guay ***@***.***>
Date: Mon, 23 Sep 2024 20:41:00 -0700
> Do you want to do it, or shall I give it a try?
Go ahead!
Thank you! I will keep you posted.
…--
Protesilaos Stavrou
https://protesilaos.com
|
Hej prot,
as a new phenomenon, I noticed that when I rename a filebuffer I am currently working on by adding keywords with
denote-rename-file-keywords
, my formatting gets overwritten with the sluggified title. I tried searching if this is intended behaviour (functions/variables, release notes) but couldn't find anything related.This is what my front matter is supposed to look like:
This is what my front matter looks like after adding a keyword using
denote-rename-file-keyword
:Since I use
denote-rename-buffer-mode
, I find this sluggification undesirable, because it takes away from the readability afforded by automatic buffer renaming.Have a good day :)
The text was updated successfully, but these errors were encountered: