From 0b0a7680a6f77404542c0de1037b7da74cd60d4e Mon Sep 17 00:00:00 2001 From: Richard Boyechko Date: Sun, 16 Jul 2023 15:01:31 -0700 Subject: [PATCH] Extend zk--id-list to query IDs as well as titles This is a very minor change that does not effect performance, but allows focusing on parts of IDs as well as titles. So I can focus on only the notes I made in 2014, for example, by querying for `^2014`, or notes I've made in July of any year with `^20..07`. --- zk.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zk.el b/zk.el index de26758..97f1dba 100644 --- a/zk.el +++ b/zk.el @@ -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)