Skip to content

Extend zk--id-list to query IDs as well as titles #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions zk.el
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,17 @@ The ID is created using `zk-id-time-string-format'."

(defun zk--id-list (&optional str zk-alist)
"Return a list of zk IDs for notes in `zk-directory'.
Optional search for STR in note title, case-insenstive. Takes an
optional ZK-ALIST, for efficiency if `zk--id-list' is called in
an internal loop."
Optional search for STR in note ID and title,
case-insenstive. Takes an optional ZK-ALIST, for efficiency
if `zk--id-list' is called in an internal loop."
(if str
(let ((zk-alist (or zk-alist (zk--alist)))
(case-fold-search t)
(ids))
(dolist (item zk-alist)
(if str
(when (string-match str (cadr item))
(when (or (string-match str (car item))
(string-match str (cadr item)))
(push (car item) ids))
(push (car item) ids)))
ids)
Expand Down