summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-10-23 04:09:46 +0300
committerThanos Apollo <[email protected]>2024-10-23 04:11:19 +0300
commit51a70b95455d95967a514918e7021359e54c7c2b (patch)
tree884348c387bf2579d5ad5a2492dbf325c92b50f3
parent17d93aee78d93bd47bd6e9e29f4e798fad297754 (diff)
new function: Add dashboard-search-note.
New function to make searching for notes that contain STR easier & faster from within the dashboard.
-rw-r--r--gnosis.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/gnosis.el b/gnosis.el
index ec97107..599bf04 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -2717,10 +2717,17 @@ Skips days where no note was reviewed."
(gnosis-dashboard-output-notes gnosis-dashboard-note-ids)
(revert-buffer t t t)))
+(defun gnosis-dashboard-search-note (&optional str)
+ "Search for notes with STR."
+ (interactive)
+ (gnosis-dashboard-output-notes
+ (gnosis-collect-note-ids :query (or str (read-string "Search for note: ")))))
+
(defvar-keymap gnosis-dashboard-notes-mode-map
:doc "Keymap for notes dashboard."
"e" #'gnosis-dashboard-edit-note
"s" #'gnosis-dashboard-suspend-note
+ "C-s" #'gnosis-dashboard-search-note
"a" #'gnosis-add-note
"r" #'gnosis-dashboard-return
"g" #'gnosis-dashboard-return
@@ -2946,8 +2953,7 @@ DASHBOARD-TYPE: either 'Notes' or 'Decks' to display the respective dashboard."
("notes" (gnosis-dashboard-output-notes (gnosis-collect-note-ids)))
("decks" (gnosis-dashboard-output-decks))
("tags" (gnosis-dashboard-output-notes (gnosis-collect-note-ids :tags t)))
- ("search" (gnosis-dashboard-output-notes
- (gnosis-collect-note-ids :query (read-string "Search for note: "))))))
+ ("search" (gnosis-dashboard-search-note))))
(tabulated-list-print t)))
(defun gnosis-dashboard-mark-toggle ()
@@ -2964,16 +2970,13 @@ DASHBOARD-TYPE: either 'Notes' or 'Decks' to display the respective dashboard."
(if (cl-some (lambda (ov) (overlay-get ov 'gnosis-mark)) overlays)
(progn
(remove-overlays beg end 'gnosis-mark t)
- (setq gnosis-dashboard--selected-ids (remove id gnosis-dashboard--selected-ids))
- ;; (message "Unmarked: %s" (aref entry 0))
- )
+ (setq gnosis-dashboard--selected-ids
+ (remove id gnosis-dashboard--selected-ids)))
(let ((ov (make-overlay beg end)))
(setf gnosis-dashboard--selected-ids
(append gnosis-dashboard--selected-ids (list id)))
(overlay-put ov 'face 'highlight)
- (overlay-put ov 'gnosis-mark t)
- ;; (message "Marked: %s" (aref entry 0))
- )))
+ (overlay-put ov 'gnosis-mark t))))
(message "No entry at point"))
(message "Not in a tabulated-list-mode"))))