mu4e: handle marks outside headers-view
Ensure we the marks get counted correctly outside the headers view. This avoids mu4e trying to refresh the headers buffer when we're reading a message.
This commit is contained in:
@ -253,7 +253,7 @@ The following marks are available, and the corresponding props:
|
|||||||
(show-fct (plist-get markdesc :show-target))
|
(show-fct (plist-get markdesc :show-target))
|
||||||
(shown-target (if show-fct
|
(shown-target (if show-fct
|
||||||
(funcall show-fct target)
|
(funcall show-fct target)
|
||||||
(if target (format "%S" target)))))
|
(if target (format "%S" target)))))
|
||||||
(unless docid (mu4e-warn "No message on this line"))
|
(unless docid (mu4e-warn "No message on this line"))
|
||||||
(unless (eq major-mode 'mu4e-headers-mode) (mu4e-error "Not in headers-mode"))
|
(unless (eq major-mode 'mu4e-headers-mode) (mu4e-error "Not in headers-mode"))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
@ -391,28 +391,28 @@ If NO-CONFIRMATION is non-nil, don't ask user for confirmation."
|
|||||||
(mu4e~mark-in-context
|
(mu4e~mark-in-context
|
||||||
(let ((marknum (hash-table-count mu4e~mark-map)))
|
(let ((marknum (hash-table-count mu4e~mark-map)))
|
||||||
(if (zerop marknum)
|
(if (zerop marknum)
|
||||||
(message "Nothing is marked")
|
(message "Nothing is marked")
|
||||||
(mu4e-mark-resolve-deferred-marks)
|
(mu4e-mark-resolve-deferred-marks)
|
||||||
(when (or no-confirmation
|
(when (or no-confirmation
|
||||||
(y-or-n-p
|
(y-or-n-p
|
||||||
(format "Are you sure you want to execute %d mark%s?"
|
(format "Are you sure you want to execute %d mark%s?"
|
||||||
marknum (if (> marknum 1) "s" ""))))
|
marknum (if (> marknum 1) "s" ""))))
|
||||||
(maphash
|
(maphash
|
||||||
(lambda (docid val)
|
(lambda (docid val)
|
||||||
(let* ((mark (car val)) (target (cdr val))
|
(let* ((mark (car val)) (target (cdr val))
|
||||||
(markdescr (assq mark mu4e-marks))
|
(markdescr (assq mark mu4e-marks))
|
||||||
(msg (save-excursion
|
(msg (save-excursion
|
||||||
(mu4e~headers-goto-docid docid)
|
(mu4e~headers-goto-docid docid)
|
||||||
(mu4e-message-at-point))))
|
(mu4e-message-at-point))))
|
||||||
;; note: whenever you do something with the message,
|
;; note: whenever you do something with the message,
|
||||||
;; it looses its N (new) flag
|
;; it looses its N (new) flag
|
||||||
(if markdescr
|
(if markdescr
|
||||||
(progn
|
(progn
|
||||||
(run-hook-with-args
|
(run-hook-with-args
|
||||||
'mu4e-mark-execute-pre-hook mark msg)
|
'mu4e-mark-execute-pre-hook mark msg)
|
||||||
(funcall (plist-get (cdr markdescr) :action) docid msg target))
|
(funcall (plist-get (cdr markdescr) :action) docid msg target))
|
||||||
(mu4e-error "Unrecognized mark %S" mark))))
|
(mu4e-error "Unrecognized mark %S" mark))))
|
||||||
mu4e~mark-map))
|
mu4e~mark-map))
|
||||||
(mu4e-mark-unmark-all)
|
(mu4e-mark-unmark-all)
|
||||||
(message nil)))))
|
(message nil)))))
|
||||||
|
|
||||||
@ -438,8 +438,8 @@ If NO-CONFIRMATION is non-nil, don't ask user for confirmation."
|
|||||||
|
|
||||||
(defun mu4e-mark-marks-num ()
|
(defun mu4e-mark-marks-num ()
|
||||||
"Return the number of marks in the current buffer."
|
"Return the number of marks in the current buffer."
|
||||||
(if mu4e~mark-map (hash-table-count mu4e~mark-map) 0))
|
(mu4e~mark-in-context
|
||||||
|
(if mu4e~mark-map (hash-table-count mu4e~mark-map) 0)))
|
||||||
|
|
||||||
(defun mu4e-mark-handle-when-leaving ()
|
(defun mu4e-mark-handle-when-leaving ()
|
||||||
"If there are any marks in the current buffer, handle those
|
"If there are any marks in the current buffer, handle those
|
||||||
|
|||||||
Reference in New Issue
Block a user