mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 10:28:09 +01:00
emacs: add notmuch-search-edit-search and notmuch-tree-edit-search
...and bind these to "E" in their respective keymaps. Expected to be called interactively, then using read-from-minibuffer with current search string as initial contents for editing. (Noninteractive use makes little sense, but is supported.) With this one can expand (as an opposite to limit) their query and have e.g. (some of their) saved searches as search "templates". While at it, removed `(defvar notmuch-search-query-string)` from notmuch-tree.el; it is unused (`notmuch-tree-basic-query` is used instead). Thanks to Jose Antonio Ortega Ruiz for his example for notmuch-tree code, and better interactive use.
This commit is contained in:
parent
48d6b31485
commit
3db892f43b
2 changed files with 23 additions and 3 deletions
|
@ -45,9 +45,6 @@
|
|||
(declare-function notmuch-search-previous-thread "notmuch" ())
|
||||
(declare-function notmuch-tree-from-search-thread "notmuch" ())
|
||||
|
||||
;; the following variable is defined in notmuch.el
|
||||
(defvar notmuch-search-query-string)
|
||||
|
||||
;; this variable distinguishes the unthreaded display from the normal tree display
|
||||
(defvar-local notmuch-tree-unthreaded nil
|
||||
"A buffer local copy of argument unthreaded to the function notmuch-tree.")
|
||||
|
@ -399,6 +396,7 @@ then NAME behaves like CMD."
|
|||
(define-key map "V" 'notmuch-tree-view-raw-message)
|
||||
(define-key map "l" 'notmuch-tree-filter)
|
||||
(define-key map "t" 'notmuch-tree-filter-by-tag)
|
||||
(define-key map "E" 'notmuch-tree-edit-search)
|
||||
|
||||
;; The main tree view bindings
|
||||
(define-key map (kbd "RET") 'notmuch-tree-show-message)
|
||||
|
@ -1265,6 +1263,21 @@ search results and that are also tagged with the given TAG."
|
|||
nil
|
||||
notmuch-search-oldest-first)))
|
||||
|
||||
(defun notmuch-tree-edit-search (query)
|
||||
"Edit the current search"
|
||||
(interactive (list (read-from-minibuffer "Edit search: "
|
||||
notmuch-tree-basic-query)))
|
||||
(let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto)))
|
||||
(notmuch-tree-close-message-window)
|
||||
(notmuch-tree query
|
||||
notmuch-tree-query-context
|
||||
nil
|
||||
nil
|
||||
nil
|
||||
notmuch-tree-unthreaded
|
||||
nil
|
||||
notmuch-search-oldest-first)))
|
||||
|
||||
;;; _
|
||||
|
||||
(provide 'notmuch-tree)
|
||||
|
|
|
@ -190,6 +190,7 @@ there will be called at other points of notmuch execution."
|
|||
(define-key map "c" 'notmuch-search-stash-map)
|
||||
(define-key map "t" 'notmuch-search-filter-by-tag)
|
||||
(define-key map "l" 'notmuch-search-filter)
|
||||
(define-key map "E" 'notmuch-search-edit-search)
|
||||
(define-key map [mouse-1] 'notmuch-search-show-thread)
|
||||
(define-key map "k" 'notmuch-tag-jump)
|
||||
(define-key map "*" 'notmuch-search-tag-all)
|
||||
|
@ -1156,6 +1157,12 @@ search results and that are also tagged with the given TAG."
|
|||
(list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
|
||||
(notmuch-search (concat "tag:" tag)))
|
||||
|
||||
(defun notmuch-search-edit-search (query)
|
||||
"Edit the current search"
|
||||
(interactive (list (read-from-minibuffer "Edit search: "
|
||||
notmuch-search-query-string)))
|
||||
(notmuch-search query notmuch-search-oldest-first))
|
||||
|
||||
;;;###autoload
|
||||
(defun notmuch ()
|
||||
"Run notmuch and display saved searches, known tags, etc."
|
||||
|
|
Loading…
Reference in a new issue