summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/km-denote.el13
1 files changed, 13 insertions, 0 deletions
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