diff options
author | JSDurand <mmemmew@gmail.com> | 2021-12-27 15:23:54 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-12-27 15:23:54 +0800 |
commit | 4db37dc85a6e4acf7a1b76337fe095d1f7c59d36 (patch) | |
tree | 37017e369f2b273d78964300a99110f1a8e046ec /gnus-conf.el | |
parent | 20193e10b12e7009e0c0eccf45976723e5939548 (diff) |
gnus: bind a key for general searches
* gnus-conf.el (durand-gnus-notmuch-query-history): A dedicated
history variable is better than some buttons, I guess.
(durand-gnus-notmuch-query, gnus-group-mode-map): Bind to a key for
easy interactive uses.
Diffstat (limited to 'gnus-conf.el')
-rw-r--r-- | gnus-conf.el | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/gnus-conf.el b/gnus-conf.el index ffc1f08..31cad4e 100644 --- a/gnus-conf.el +++ b/gnus-conf.el @@ -188,18 +188,42 @@ groups, so that is a generalization I do not need, at present." ;;;; Query function +(defvar durand-gnus-notmuch-query-history nil + "History of the queries.") + (defalias 'durand-gnunque #'durand-gnus-notmuch-query) -(defun durand-gnus-notmuch-query (query) - "Search mails by QUERY." - (interactive "MSearch mails by: ") +(defun durand-gnus-notmuch-query (query &optional partial-p) + "Search mails by QUERY. +If PARTIAL-P is non-nil, only return matching mails; otherwise, +all mails in the same thread as some matching mails are +returned. + +If called interactively, PARTIAL-P is non-nil if and only if +called with a universal argument \\[universal-argument]." + (interactive + (list + (read-string + "Query: " + nil + 'durand-gnus-notmuch-query-history + durand-gnus-notmuch-query-history t) + current-prefix-arg)) (let ((query (split-string query " ")) results) - ;; split and join back as a form of normalizatoin - (setq query (mapconcat #'identity query " ")) - (setq - results - (process-lines "dnw" query)) + (cond + (partial-p + (setq + results + (apply + #'process-lines + "notmuch" "search" "--format=text" + "--output=files" query))) + ;; split and join back as a form of normalizatoin + ((setq query (mapconcat #'identity query " ")) + (setq + results + (process-lines "dnw" query)))) ;; convert message file names to "article numbers" that Gnus uses ;; internally (setq @@ -262,6 +286,7 @@ or from:u1991123* or to:u1991123*") (define-key gnus-group-mode-map (vector ?v ?m) #'durand-gnus-view-minglung) (define-key gnus-group-mode-map (vector ?v ?t) #'durand-gnus-view-tan) (define-key gnus-group-mode-map (vector ?v ?f) #'durand-gnus-view-friends) +(define-key gnus-group-mode-map (vector ?v ?q) #'durand-gnunque) ;;; user settings |