branch: externals/denote commit 56c39531669c75ca1b076c80f82f65ee66ca4b78 Author: EFLS <> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Add denote-link-find-backlink command Variation on denote-link-find-file, but for visiting backlinks to the current note via the minibuffer. --- README.org | 4 ++++ denote.el | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/README.org b/README.org index b136642e13..1bbbd89d10 100644 --- a/README.org +++ b/README.org @@ -1407,6 +1407,10 @@ the =embark= package will be able to work its magic such as in exporting the list into a filtered Dired buffer (i.e. a familiar Dired listing with only the files of the current minibuffer session). +#+findex: denote-link-find-backlink +To visit backlinks to the current note via the minibuffer, use +~denote-link-find-backlink~. + ** Miscellaneous information about links :PROPERTIES: :CUSTOM_ID: h:dd8f2231-8d77-49b9-acc4-af525c68b271 diff --git a/denote.el b/denote.el index fb7d3a694b..a8734d1be2 100644 --- a/denote.el +++ b/denote.el @@ -2268,6 +2268,20 @@ format is always [[denote:IDENTIFIER]]." (denote-link--find-file-prompt files)))) (user-error "No links found in the current buffer"))) +;;;###autoload +(defun denote-link-find-backlink () + "Use minibuffer completion to visit backlink to current file. + +Like `denote-link-find-file', but select backlink to follow." + (interactive) + (when-let* ((file (buffer-file-name)) + (id (denote-retrieve-filename-identifier file)) + (files (denote--retrieve-process-grep id))) + (find-file + (denote-get-path-by-id + (denote-extract-id-from-string + (denote-link--find-file-prompt files)))))) + ;;;###autoload (defun denote-link-after-creating (&optional id-only) "Create new note in the background and link to it directly.