From 8c71aff19ebf41103b367a367f5fd75bd014957f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 18 Nov 2023 23:22:26 -0500 Subject: denote: Add custom command for inserting denote ID --- lisp/km-denote.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lisp') diff --git a/lisp/km-denote.el b/lisp/km-denote.el index eade820..24e98d2 100644 --- a/lisp/km-denote.el +++ b/lisp/km-denote.el @@ -53,5 +53,18 @@ The file must be tracked in Git." (process-lines "git" "ls-files" "--" (concat "**/" id "--*")) (user-error "No tracked file found for %s" id)))))) +(defun km/denote-insert-id (&optional with-prefix) + "Insert ID of tracked file in `denote-directory'. +When WITH-PREFIX is non-nil, prepend \"denote:\" to the inserted +ID." + (interactive "P") + (let* ((default-directory denote-directory) + (id (or (denote-extract-id-from-string + (completing-read + "Note: " + (process-lines "git" "ls-files" "--" "*--*"))) + (error "Could not determine ID")))) + (insert (concat (and with-prefix "denote:") id)))) + (provide 'km-denote) ;;; km-denote.el ends here -- cgit v1.2.3