Skip to content

Commit

Permalink
Merge pull request #74 from localauthor/zk-tag-insert-function
Browse files Browse the repository at this point in the history
Add zk-tag-insert-function
  • Loading branch information
localauthor authored Aug 21, 2023
2 parents 5be59ca + e7821ac commit 05b253b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion zk.el
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ insertion. See `zk-new-note-header' for an example."
Must take an optional prompt and a list of files"
:type 'function)

(defcustom zk-tag-insert-function nil
"Function for inserting tag.
Function must take a single argument TAG, as a string.
If nil, tag will be inserted at point."
:type 'function)

(defcustom zk-search-function #'zk-grep
"Function used by `zk-search'.
Must take a single STRING argument."
Expand Down Expand Up @@ -995,7 +1001,10 @@ Defaults to `zk-grep'."
"Insert TAG at point.
Select TAG, with completion, from list of all tags in zk notes."
(interactive (list (completing-read "Insert tag: " (zk--grep-tag-list))))
(insert tag))
(if (eq zk-tag-insert-function nil)
(insert tag)
(save-excursion
(funcall zk-tag-insert-function tag))))

;;; Find Dead Links and Unlinked Notes

Expand Down

0 comments on commit 05b253b

Please sign in to comment.