summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-11-14 05:02:27 +0000
committerjao <jao@gnu.org>2021-11-14 05:02:27 +0000
commit657a272347e96dcd4fcd825178b0f86124da32a1 (patch)
tree6da43a9958bf376d5207f8b841e8e5f3a52b3618
parente447a14ede71f022f8f2af329bd79c74b1c128ba (diff)
downloadelibs-657a272347e96dcd4fcd825178b0f86124da32a1.tar.gz
elibs-657a272347e96dcd4fcd825178b0f86124da32a1.tar.bz2
searching notes with consult-{rgrep, recoll}
-rw-r--r--exwm.org2
-rw-r--r--lib/doc/jao-org-notes.el9
-rw-r--r--org.org15
3 files changed, 22 insertions, 4 deletions
diff --git a/exwm.org b/exwm.org
index 93bddcb..9abeea1 100644
--- a/exwm.org
+++ b/exwm.org
@@ -496,6 +496,8 @@
[["Notes"
("n" "capture note" jao-org-notes-open-or-create)
("/" "search notes" jao-org-notes-open)
+ ("\\" "grep notes" jao-org-notes-grep)]
+ ["Documents"
("d" "go to doc" jao-exwm-select-pdf)
("D" "open to doc" jao-open-doc)]
["Packages"
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index 5b81ceb..75066c5 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -139,11 +139,16 @@
(buffer-file-name))
;;;###autoload
+(defun jao-org-notes-grep (&optional initial)
+ "Perform a grep search on all org notes body, via consult-ripgrep."
+ (interactive)
+ (consult-ripgrep jao-org-notes-dir initial))
+
+;;;###autoload
(defun jao-org-notes-backlinks ()
"Show a list of note files linking to the current one."
(interactive)
- (consult-ripgrep jao-org-notes-dir
- (concat "\\[\\[file:(.*/)?" (regexp-quote (buffer-name)))))
+ (jao-org-notes-search (concat "\\[\\[file:\\(.*/\\)?" (buffer-name))))
;;;###autoload
(defun jao-org-notes-insert-tags ()
diff --git a/org.org b/org.org
index 19a265a..d59ad91 100644
--- a/org.org
+++ b/org.org
@@ -204,12 +204,23 @@
(use-package jao-org-notes
:commands (jao-org-notes-setup)
:config
+ (defun jao-org-notes-note-p ()
+ (string-prefix-p jao-org-notes-dir (buffer-file-name)))
+
+ (defun jao-org-notes-recoll ()
+ "Use consult-recoll to search notes."
+ (interactive)
+ (consult-recoll (format "dir:%s" jao-org-notes-dir)))
+
(jao-transient-major-mode+ org
["Notes"
- ("i" "insert link" jao-org-notes-insert-link)
- ("t" "insert tags" jao-org-notes-insert-tags)
("o" "find and open note" jao-org-notes-open)
("c" "open or create note" jao-org-notes-open-or-create)
+ ("\\" "grep notes" jao-org-notes-grep)
+ ("r" "recoll notes" jao-org-notes-recoll)]
+ ["Current note" :if jao-org-notes-note-p
+ ("i" "insert link" jao-org-notes-insert-link)
+ ("t" "insert tags" jao-org-notes-insert-tags)
("v" "show backlinks" jao-org-notes-backlinks)]))
(jao-org-notes-setup "n")