mirror of https://github.com/djcb/mu.git
mu4e: tweak query-items refreshing
Try to make it a bit less confusing. The baseline becomes a bit more implicit, and a `g` in the main view refreshes / resets.
This commit is contained in:
parent
eb691f8f31
commit
22b2d44b96
|
@ -1541,7 +1541,6 @@ region if there is a region, then move to the next message."
|
||||||
(interactive)
|
(interactive)
|
||||||
(mu4e-mark-handle-when-leaving)
|
(mu4e-mark-handle-when-leaving)
|
||||||
(quit-window t)
|
(quit-window t)
|
||||||
(mu4e--query-items-reset-baseline)
|
|
||||||
(mu4e--main-view))
|
(mu4e--main-view))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -105,12 +105,6 @@ the personal addresses."
|
||||||
(current-time-string baseline-t)
|
(current-time-string baseline-t)
|
||||||
"Never"))))
|
"Never"))))
|
||||||
|
|
||||||
(defun mu4e--main-reset-baseline()
|
|
||||||
"Reset the query baseline."
|
|
||||||
(interactive)
|
|
||||||
(mu4e--query-items-reset-baseline)
|
|
||||||
(revert-buffer))
|
|
||||||
|
|
||||||
(defvar mu4e-main-mode-map
|
(defvar mu4e-main-mode-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
|
|
||||||
|
@ -121,7 +115,6 @@ the personal addresses."
|
||||||
(define-key map "f" #'smtpmail-send-queued-mail)
|
(define-key map "f" #'smtpmail-send-queued-mail)
|
||||||
;;
|
;;
|
||||||
(define-key map "U" #'mu4e-update-mail-and-index)
|
(define-key map "U" #'mu4e-update-mail-and-index)
|
||||||
(define-key map "R" #'mu4e--main-reset-baseline)
|
|
||||||
(define-key map (kbd "C-S-u") #'mu4e-update-mail-and-index)
|
(define-key map (kbd "C-S-u") #'mu4e-update-mail-and-index)
|
||||||
;; for terminal users
|
;; for terminal users
|
||||||
(define-key map (kbd "C-c C-u") #'mu4e-update-mail-and-index)
|
(define-key map (kbd "C-c C-u") #'mu4e-update-mail-and-index)
|
||||||
|
@ -168,8 +161,8 @@ the personal addresses."
|
||||||
(mu4e-update-minor-mode)
|
(mu4e-update-minor-mode)
|
||||||
(setq-local revert-buffer-function
|
(setq-local revert-buffer-function
|
||||||
(lambda (_ignore-auto _noconfirm)
|
(lambda (_ignore-auto _noconfirm)
|
||||||
;; the query results will trigger a redraw
|
;; reset the baseline and get updated results.
|
||||||
(mu4e--query-items-refresh)))
|
(mu4e--query-items-refresh 'reset-baseline)))
|
||||||
(add-hook 'mu4e-query-items-updated-hook
|
(add-hook 'mu4e-query-items-updated-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(when (get-buffer mu4e-main-buffer-name)
|
(when (get-buffer mu4e-main-buffer-name)
|
||||||
|
@ -291,12 +284,6 @@ character of the keyboard shortcut
|
||||||
|
|
||||||
(mu4e--main-action-str "\t* [U]pdate email & database\n"
|
(mu4e--main-action-str "\t* [U]pdate email & database\n"
|
||||||
#'mu4e-update-mail-and-index)
|
#'mu4e-update-mail-and-index)
|
||||||
(mu4e--main-action-str (propertize
|
|
||||||
"\t* [R]eset baseline\n"
|
|
||||||
'help-echo
|
|
||||||
(mu4e--baseline-time-string))
|
|
||||||
#'mu4e--main-reset-baseline)
|
|
||||||
|
|
||||||
;; show the queue functions if `smtpmail-queue-dir' is defined
|
;; show the queue functions if `smtpmail-queue-dir' is defined
|
||||||
(if (file-directory-p smtpmail-queue-dir)
|
(if (file-directory-p smtpmail-queue-dir)
|
||||||
(mu4e--main-view-queue)
|
(mu4e--main-view-queue)
|
||||||
|
@ -359,9 +346,11 @@ character of the keyboard shortcut
|
||||||
|
|
||||||
(declare-function mu4e--start "mu4e")
|
(declare-function mu4e--start "mu4e")
|
||||||
|
|
||||||
(defun mu4e--main-view ()
|
(defun mu4e--main-view (&optional refresh)
|
||||||
"(Re)create the mu4e main-view, and switch to it.
|
"(Re)create the mu4e main-view, and switch to it.
|
||||||
|
|
||||||
|
With non-nil REFRESH, refresh queries and baseline first.
|
||||||
|
|
||||||
If `mu4e-split-view' equals \='single-window, show a mu4e menu
|
If `mu4e-split-view' equals \='single-window, show a mu4e menu
|
||||||
instead."
|
instead."
|
||||||
(if (eq mu4e-split-view 'single-window)
|
(if (eq mu4e-split-view 'single-window)
|
||||||
|
@ -371,6 +360,8 @@ instead."
|
||||||
;; `mu4e--main-view' is called from `mu4e--start', so don't call it a
|
;; `mu4e--main-view' is called from `mu4e--start', so don't call it a
|
||||||
;; second time here i.e. do not refresh unless specified explicitly with
|
;; second time here i.e. do not refresh unless specified explicitly with
|
||||||
;; REFRESH arg.
|
;; REFRESH arg.
|
||||||
|
(when refresh
|
||||||
|
(mu4e--query-items-refresh 'reset-baseline))
|
||||||
(with-current-buffer buf
|
(with-current-buffer buf
|
||||||
(mu4e--main-redraw-buffer))
|
(mu4e--main-redraw-buffer))
|
||||||
(mu4e-display-buffer buf t)))
|
(mu4e-display-buffer buf t)))
|
||||||
|
@ -390,8 +381,7 @@ instead."
|
||||||
(if smtpmail-queue-mail "queued" "sent directly")))
|
(if smtpmail-queue-mail "queued" "sent directly")))
|
||||||
(unless (or (eq mu4e-split-view 'single-window)
|
(unless (or (eq mu4e-split-view 'single-window)
|
||||||
(not (buffer-live-p (get-buffer mu4e-main-buffer-name))))
|
(not (buffer-live-p (get-buffer mu4e-main-buffer-name))))
|
||||||
(with-current-buffer mu4e-main-buffer-name
|
(mu4e--main-redraw-buffer)))
|
||||||
(revert-buffer))))
|
|
||||||
|
|
||||||
(defun mu4e--main-menu ()
|
(defun mu4e--main-menu ()
|
||||||
"The mu4e main menu in the mini-buffer."
|
"The mu4e main menu in the mini-buffer."
|
||||||
|
|
|
@ -128,8 +128,11 @@ If ITEMS does not yet have a favorite item, pick the first."
|
||||||
(propertize (number-to-string count)
|
(propertize (number-to-string count)
|
||||||
'help-echo "Total number")))))
|
'help-echo "Total number")))))
|
||||||
|
|
||||||
(defun mu4e--query-items-refresh()
|
(defun mu4e--query-items-refresh (&optional reset-baseline)
|
||||||
"Get the latest query data from the mu4e server."
|
"Get the latest query data from the mu4e server.
|
||||||
|
With RESET-BASELINE, reset the baseline first."
|
||||||
|
(when reset-baseline
|
||||||
|
(mu4e--query-items-reset-baseline))
|
||||||
(mu4e--server-queries
|
(mu4e--server-queries
|
||||||
;; note: we must apply the rewrite function here, since the query does not go
|
;; note: we must apply the rewrite function here, since the query does not go
|
||||||
;; through mu4e-search.
|
;; through mu4e-search.
|
||||||
|
|
|
@ -268,7 +268,8 @@ chance."
|
||||||
(mu4e-setq-if-nil mu4e-contacts-func #'mu4e--update-contacts)
|
(mu4e-setq-if-nil mu4e-contacts-func #'mu4e--update-contacts)
|
||||||
(mu4e-setq-if-nil mu4e-info-func #'mu4e--info-handler)
|
(mu4e-setq-if-nil mu4e-info-func #'mu4e--info-handler)
|
||||||
(mu4e-setq-if-nil mu4e-pong-func #'mu4e--default-handler)
|
(mu4e-setq-if-nil mu4e-pong-func #'mu4e--default-handler)
|
||||||
(mu4e-setq-if-nil mu4e-queries-func #'mu4e--query-items-queries-handler))
|
|
||||||
|
(mu4e-setq-if-nil mu4e-queries-func #'mu4e--query-items-queries-handler))
|
||||||
|
|
||||||
(defun mu4e-clear-caches ()
|
(defun mu4e-clear-caches ()
|
||||||
"Clear any cached resources."
|
"Clear any cached resources."
|
||||||
|
|
|
@ -735,7 +735,6 @@ The main view looks something like the following:
|
||||||
|
|
||||||
* [;]Switch context
|
* [;]Switch context
|
||||||
* [U]pdate email & database
|
* [U]pdate email & database
|
||||||
* [R]eset query-results baseline
|
|
||||||
* toggle [m]ail sending mode (currently direct)
|
* toggle [m]ail sending mode (currently direct)
|
||||||
* [f]lush 1 queued mail
|
* [f]lush 1 queued mail
|
||||||
|
|
||||||
|
@ -1012,7 +1011,6 @@ a execute some custom action on a header
|
||||||
| pipe message through shell command
|
| pipe message through shell command
|
||||||
C-+,C-- increase / decrease the number of headers shown
|
C-+,C-- increase / decrease the number of headers shown
|
||||||
H get help
|
H get help
|
||||||
C-c C-r reset query results baseline
|
|
||||||
C-S-u update mail & reindex
|
C-S-u update mail & reindex
|
||||||
C-c C-u update mail & reindex
|
C-c C-u update mail & reindex
|
||||||
q leave the headers buffer
|
q leave the headers buffer
|
||||||
|
|
Loading…
Reference in New Issue