Make sure backlinks get correct 'denote-directory' path

The backlinks buffer will now get the correct path when it is
generated inside a silo.  This is related to issue 129 reported by
hapst3r on the GitHub mirror:
<https://github.com/protesilaos/denote/issues/129>.

This change is necessary because .dir-locals do not work for buffers,
so we must get the value from the file that calls 'denote-link-backlinks'.
This commit is contained in:
Protesilaos Stavrou 2023-02-12 09:22:29 +02:00
parent 0c79c1a699
commit 828af23060
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -2851,9 +2851,10 @@ ALIST is not used in favour of using
(file-type (denote-filetype-heuristics file))
(id (denote-retrieve-filename-identifier file))
(buf (format "*denote-backlinks to %s*" id))
(xref-alist (xref--analyze (funcall fetcher))))
(xref-alist (xref--analyze (funcall fetcher)))
(dir (denote-directory)))
(with-current-buffer (get-buffer-create buf)
(setq-local default-directory (denote-directory))
(setq-local default-directory dir)
(erase-buffer)
(setq overlay-arrow-position nil)
(denote-backlinks-mode)