protesilaos / denote

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

Dynamic block backlinks to this-heading-only doesn't work? #428

Open novakwh opened 2 months ago

novakwh commented 2 months ago

Hello, when I include :this-heading-only t into the denote-org-extras-dblock-insert-backlinks section, it continues to list all backlinks, not only those notes with a link to the heading in which the block is located. Am I doing something wrong?

+BEGIN: denote-backlinks :sort-by-component nil :reverse-sort nil :id-only nil :this-heading-only t

+END:

I have confirmed that one note is linked correctly to the org-heading (using denote-org-extras-backlinks-for-heading) and none of the other notes are linked to anything but the note itself. But they all show up inside this block.

Thanks for your help!

protesilaos commented 2 months ago

Hello @novakwh! Can you please produce two files that exhibit the problem? I cannot reproduce it on my end.

Also, please make sure you are on the latest version of Denote.

novakwh commented 2 months ago

Embarrassingly, this was totally my fault for not checking, and after updating the package everything works as expected. I will close and say thank you for this amazing package, which has been such a blessing and so useful in my life.

protesilaos commented 2 months ago

From: novakwh @.***> Date: Wed, 11 Sep 2024 06:17:58 -0700

Embarrassingly, this was totally my fault for not checking, and after updating the package everything works as expected. I will close and say thank you for this amazing package, which has been such a blessing and so useful in my life.

That's fine. Thank you!

-- Protesilaos Stavrou https://protesilaos.com

novakwh commented 2 months ago

Hello Prot, re-opening this just because there is something else weird going on with :this-heading-only and I hope you can help. Now, it works fine when I have :this-heading-only marked as t in the dynamic org block backlinks, except that the files listed within the block are no longer displayed in the renamed buffer format.

In other words, instead of displaying the file's title in friendly format from the #+title property (like "This Is a File Name"), the link is displayed in the Denote filename shorthand (like "this-is-a-file-name"). Remove :this-heading-only and you see "This Is a File Name" but put it back in and you see "this-is-a-file-name".

Any help appreciated!

protesilaos commented 2 months ago

From: novakwh @.***> Date: Fri, 13 Sep 2024 14:01:29 -0700

[... 7 lines elided]

In other words, instead of displaying the file's title in friendly format from the #+title property (like "This Is a File Name"), the link is displayed in the Denote filename shorthand (like "this-is-a-file-name"). Remove :this-heading-only and you see "This Is a File Name" but put it back in and you see "this-is-a-file-name".

Any help appreciated!

This is strange... I have no answer for it. It seems to work fine on my end. Looking at the code, starting from 'org-dblock-write:denote-backlinks', we should be returning full file paths in both cases, which we then convert into the prettier titles.

-- Protesilaos Stavrou https://protesilaos.com

protesilaos commented 2 months ago

Screenshot of the file I just tested.

Screenshot_2024-09-16_10-26-13

novakwh commented 2 months ago

Hi Prot,

Ok, this is really weird! When I create a sample file along the lines of your screenshot, it works fine. But in my actual journal file, it doesn't work. See both attached screenshots -- the first, a sample where everything works correctly no matter if this-heading-only is t or not; the second, taken from one of my journal notes where the backlinks don't display correctly when this-heading-only is t.

The only difference I can see between these two files is that the journal file was created by a Denote template (it is created with the command denote-journal-extras-new-or-existing-entry). I manually created the sample file as an exact duplicate of the journal file and everything works fine. But the file that is inserted as a journal template doesn't work.

working-backlinks not-working-backlinks

protesilaos commented 2 months ago

Could this be related to issue 439 which is about how symblinks change the value of the title we get out of the file?

If you are using symlinks, then this would be the case. Otherwise, something else is going on.

novakwh commented 1 month ago

Hi Prot, sorry for delay, I was away. I just tried to read through issue 439; it seems (and correct me if I'm wrong) that the issue there occurs when the notes folder is within a symbolic linked folder.

However, my notes folder is in a folder that is in my home folder, and there are no symbolic links in the path. Also, the title of the note file itself doesn't change; it shows up correctly "prettified" as a backlink in a denote file that is created manually, but shows up as the slug if the denote file is created with denote-journal-extras-new-or-existing-entry.

protesilaos commented 1 month ago

From: novakwh @.***> Date: Tue, 1 Oct 2024 07:18:51 -0700

Hi Prot, sorry for delay, I was away.

No problem!

I just tried to read through issue 439; it seems (and correct me if I'm wrong) that the issue there occurs when the notes folder is within a symbolic linked folder.

Yes, this is the gist of it. I to plan work on an optional way to deal with this, though I have not had the time to do it.

However, my notes folder is in a folder that is in my home folder, and there are no symbolic links in the path.

Okay, this is good to know.

Also, the title of the note file itself doesn't change; it shows up correctly "prettified" as a backlink in a denote file that is created manually, but shows up as the slug if the denote file is created with denote-journal-extras-new-or-existing-entry.

I think that if we have a problem here it is not specific to the command denote-journal-extras-new-or-existing-entry. The reason is that the final output is indistinguishable from, say, M-x denote.

As I wrote in a previous message, I cannot reproduce the problem on my end. Is it possible to prepare a small sample with files that contain the faulty behaviour? If so, please send to me (via email, if you prefer) and I will try to find the problem.

-- Protesilaos Stavrou https://protesilaos.com