mirror of https://github.com/djcb/mu.git
Extract mu4e-headers-mark-thread-using-markpair
This allows for a key binding to something like: (mu4e-headers-mark-thread-using-markpair '(read))
This commit is contained in:
parent
33804f63d8
commit
69ef3037a7
|
@ -1082,21 +1082,20 @@ matching messages with that mark."
|
||||||
(otherwise (mu4e-error "Not supported")))))
|
(otherwise (mu4e-error "Not supported")))))
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e-headers-mark-thread (&optional subthread)
|
(defun mu4e-headers-mark-thread-using-markpair (markpair &optional subthread)
|
||||||
"Mark the thread at point. If SUBTHREAD is non-nil, marking is
|
"Mark the thread at point using the given markpair. If SUBTHREAD is
|
||||||
limited to the message at point and its descendants."
|
non-nil, marking is limited to the message at point and its
|
||||||
|
descendants."
|
||||||
|
(let* ((mark (car markpair))
|
||||||
|
(allowed-marks (mapcar 'car mu4e-marks)))
|
||||||
|
(unless (memq mark allowed-marks)
|
||||||
|
(mu4e-error "The mark (%s) has to be one of: %s"
|
||||||
|
mark allowed-marks)))
|
||||||
;; note: the tread id is shared by all messages in a thread
|
;; note: the tread id is shared by all messages in a thread
|
||||||
(interactive "P")
|
|
||||||
(let* ((msg (mu4e-message-at-point))
|
(let* ((msg (mu4e-message-at-point))
|
||||||
(thread-id (mu4e~headers-get-thread-info msg 'thread-id))
|
(thread-id (mu4e~headers-get-thread-info msg 'thread-id))
|
||||||
(path (mu4e~headers-get-thread-info msg 'path))
|
(path (mu4e~headers-get-thread-info msg 'path))
|
||||||
;; FIXME: e.g., for refiling we should evaluate this
|
(last-marked-point))
|
||||||
;; for each line separately
|
|
||||||
(markpair
|
|
||||||
(mu4e~mark-get-markpair
|
|
||||||
(if subthread "Mark subthread with: " "Mark whole thread with: ")
|
|
||||||
t))
|
|
||||||
(last-marked-point))
|
|
||||||
(mu4e-headers-for-each
|
(mu4e-headers-for-each
|
||||||
(lambda (mymsg)
|
(lambda (mymsg)
|
||||||
(let ((my-thread-id (mu4e~headers-get-thread-info mymsg 'thread-id)))
|
(let ((my-thread-id (mu4e~headers-get-thread-info mymsg 'thread-id)))
|
||||||
|
@ -1116,6 +1115,17 @@ limited to the message at point and its descendants."
|
||||||
(goto-char last-marked-point)
|
(goto-char last-marked-point)
|
||||||
(mu4e-headers-next))))
|
(mu4e-headers-next))))
|
||||||
|
|
||||||
|
(defun mu4e-headers-mark-thread (&optional subthread)
|
||||||
|
"Like `mu4e-headers-mark-thread-using-markpair' but prompt for the markpair."
|
||||||
|
(interactive "P")
|
||||||
|
(let* (;; FIXME: e.g., for refiling we should evaluate this
|
||||||
|
;; for each line separately
|
||||||
|
(markpair
|
||||||
|
(mu4e~mark-get-markpair
|
||||||
|
(if subthread "Mark subthread with: " "Mark whole thread with: ")
|
||||||
|
t)))
|
||||||
|
(mu4e-headers-mark-thread-using-markpair markpair)))
|
||||||
|
|
||||||
(defun mu4e-headers-mark-subthread ()
|
(defun mu4e-headers-mark-subthread ()
|
||||||
"Like `mu4e-mark-thread', but only for a sub-thread."
|
"Like `mu4e-mark-thread', but only for a sub-thread."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
Loading…
Reference in New Issue