summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--attic/elisp/misc.el12
-rw-r--r--init.el2
-rw-r--r--lib/doc/jao-org-notes.el12
3 files changed, 16 insertions, 10 deletions
diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el
index 59a3c60..482f68a 100644
--- a/attic/elisp/misc.el
+++ b/attic/elisp/misc.el
@@ -808,6 +808,18 @@
(pulsar-global-mode 1)
;;; snippets
+(defun jao-org-notes-open-tags ()
+ "Search for a note file, matching all tags with completion."
+ (let* ((tags (jao-org-notes--read-tags))
+ (fn (lambda ()
+ (prog1 (jao-org-notes--find-tag (car tags))
+ (setq tags (cdr tags)))))
+ (res (funcall fn)))
+ (while (and res tags) (setq res (seq-intersection res (funcall fn))))
+ (unless res (user-error "No notes found"))
+ (when-let (f (completing-read "Select file: " (mapcar #'car res)))
+ (find-file (cadr (assoc f res))))))
+
(defun jao-sway-run-or-focus-tidal ()
(interactive)
(if (jao-shell-running-p "tidal-hifi")
diff --git a/init.el b/init.el
index 5d84480..0dcfd24 100644
--- a/init.el
+++ b/init.el
@@ -3216,7 +3216,7 @@
[["Notes"
("n" "create new note" jao-org-notes-create)
("/" "open note" jao-org-notes-open)
- ("\\" "open note by tags" jao-org-notes-open-tags)
+ ("\\" "open note by tags" jao-org-notes-consult-tags)
("d" "go to doc" jao-select-pdf :if display-graphic-p)
("d" "search docs" jao-recoll-consult-docs :if-not display-graphic-p)
("D" "open doc" jao-open-doc)]
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index a91971e..2a166e9 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -141,18 +141,12 @@
(when-let (f (jao-org-notes--consult-rg "Search notes: "))
(find-file f)))
-(defun jao-org-notes-open-tags ()
+(defun jao-org-notes-consult-tags ()
"Search for a note file, matching all tags with completion."
(interactive)
(let* ((tags (jao-org-notes--read-tags))
- (fn (lambda ()
- (prog1 (jao-org-notes--find-tag (car tags))
- (setq tags (cdr tags)))))
- (res (funcall fn)))
- (while (and res tags) (setq res (seq-intersection res (funcall fn))))
- (unless res (user-error "No notes found"))
- (when-let (f (completing-read "Select file: " (mapcar #'car res)))
- (find-file (cadr (assoc f res))))))
+ (init (concat "^..tags: " (mapconcat #'identity tags " "))))
+ (consult-ripgrep jao-org-notes-dir init)))
(defun jao-org-notes-create ()
"Create a new note file, matching tags and titles with completion."