protesilaos / denote

Simple notes for Emacs with an efficient file-naming scheme

Home Page:https://protesilaos.com/emacs/denote

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Path in `denote-backlinks` buffer is wrong (extra directory in the link)

brabalan opened this issue · comments

When I run denote-backlinks on a note, I get a listing of the form

Backlinks to "Marine Ludo" (20240209T154753)
--------------------------------------------

notes/20210323T111850--mot-malin__boardgame.org
notes/20230605T171758--trio__boardgame.org
notes/20230609T161606--phantom-ink__boardgame.org
notes/20230929T171050--lets-summon-demons__boardgame.org
notes/20240209T154425--6-qui-prend__boardgame.org

The problem is the extra notes/ at the beginning of each link, as denote-directory already includes it.

I don’t understand how xref works, so I don’t know how to debug this…

If it matters, my notes live in ~/Document/Org/notes, ~/Documents/Org is under version control, and I use projectile (so the path to the current projectile project is ~/Documents/Org when looking at the notes).

@protesilaos This is caused by commit ac0c361. When removing the modules, we also removed project.el integration (and xref integration). The function that we need back is denote-project-find.

You can see the differences when you evaluate this :

(xref--analyze (xref-matches-in-files "20240309T105635" (denote-directory-files nil t t)))

vs

(let ((project-find-functions #'denote-project-find)) (xref--analyze (xref-matches-in-files "20240309T105635" (denote-directory-files nil t t))))

The group names are relative to the project's root, which may not be denote-directory.

The solution is to bring back denote-project-find from this commit (or the section on project.el integration).

@brabalan Until it is fixed, you can evaluate (setq xref-file-name-display 'abs). Your results will be in absolute form, but they will work.

Thank you very much for the explanation and for the workaround.

Hello folks! I just pushed this commit:

commit 3e7273953aed79bb8fc6c10652ebd4a8d8ae4f4c
Author: Protesilaos Stavrou <info@protesilaos.com>
Date:   Wed Mar 13 09:18:34 2024 +0200

  Reinstate denote-project-find function for project/xref to work properly
  
  We had removed this in commit ac0c361, thinking it was not necessary,
  though Alan Schmitt reported a case where we actually needed this
  functionality. This was reported in issue 283:
  <https://github.com/protesilaos/denote/issues/283>.
  
  Thanks to Jean-Philippe Gagné Guay for identifying the regression and
  for taking the initiative to bring back the feature in pull request
  286: <https://github.com/protesilaos/denote/pull/286>. We cannot merge
  that one because it includes other in-development snippets.

 denote.el | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

@brabalan Please check if this works for you.

Thanks again @jeanphilippegg for identifying the problem!

I confirm all is well now. Thanks a lot for the quick fix!