From d37385030f70f8141e45d1bb5f75aad18c5daac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Yrj=C3=B6l=C3=A4?= Date: Mon, 23 Nov 2015 13:33:50 +0200 Subject: [PATCH] mu4e: Fetch markpair in interactive declaration This makes it possible to bind mark shortcuts in view-mode for certain markpairs. --- mu4e/mu4e-headers.el | 24 +++++++++++++----------- mu4e/mu4e-view.el | 24 ++++++++++++++++-------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 0aefd1f8..4406283c 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -1153,21 +1153,23 @@ descendants." (goto-char last-marked-point) (mu4e-headers-next)))) -(defun mu4e-headers-mark-thread (&optional subthread) +(defun mu4e-headers-mark-thread (&optional subthread markpair) "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))) + (interactive + (let* ((subthread current-prefix-arg)) + (list current-prefix-arg + ;; FIXME: e.g., for refiling we should evaluate this + ;; for each line separately + (mu4e~mark-get-markpair + (if subthread "Mark subthread with: " "Mark whole thread with: ") t)))) + (mu4e-headers-mark-thread-using-markpair markpair subthread)) -(defun mu4e-headers-mark-subthread () +(defun mu4e-headers-mark-subthread (&optional markpair) "Like `mu4e-mark-thread', but only for a sub-thread." (interactive) - (mu4e-headers-mark-thread t)) + (if markpair (mu4e-headers-mark-thread t markpair) + (let ((current-prefix-arg t)) + (call-interactively 'mu4e-headers-mark-thread)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 7e2ba575..38b09957 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -935,17 +935,25 @@ matching messages with that mark." (interactive) (mu4e~view-in-headers-context (mu4e-headers-mark-pattern))) -(defun mu4e-view-mark-thread () - "Ask user for a kind of mark (move, delete etc.), and apply it to -all messages in the thread at point in the headers view." +(defun mu4e-view-mark-thread (&optional markpair) + "Ask user for a kind of mark (move, delete etc.), and apply it +to all messages in the thread at point in the headers view. The +optional MARKPAIR can also be used to provide the mark +selection." (interactive) - (mu4e~view-in-headers-context (mu4e-headers-mark-thread))) + (mu4e~view-in-headers-context + (if markpair (mu4e-headers-mark-thread nil markpair) + (call-interactively 'mu4e-headers-mark-thread)))) -(defun mu4e-view-mark-subthread () - "Ask user for a kind of mark (move, delete etc.), and apply it to -all messages in the subthread at point in the headers view." +(defun mu4e-view-mark-subthread (&optional markpair) + "Ask user for a kind of mark (move, delete etc.), and apply it +to all messages in the subthread at point in the headers view. +The optional MARKPAIR can also be used to provide the mark +selection." (interactive) - (mu4e~view-in-headers-context (mu4e-headers-mark-subthread))) + (mu4e~view-in-headers-context + (if markpair (mu4e-headers-mark-subthread markpair) + (mu4e-headers-mark-subthread)))) (defun mu4e-view-search-narrow () "Run `mu4e-headers-search-narrow' in the headers buffer."