- (notmuch-pick-worker basic-query query-context (get-buffer buffer-name))))
-
-(defmacro with-current-notmuch-pick-message (&rest body)
- "Evaluate body with current buffer set to the text of current message"
- `(save-excursion
- (let ((id (notmuch-pick-get-message-id)))
- (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))
- (with-current-buffer buf
- (call-process notmuch-command nil t nil "show" "--format=raw" id)
- ,@body)
- (kill-buffer buf)))))
-
-(defun notmuch-pick-new-mail (&optional prompt-for-sender)
- "Compose new mail."
- (interactive "P")
- (notmuch-pick-close-message-window)
- (notmuch-mua-new-mail prompt-for-sender ))
-
-(defun notmuch-pick-forward-message (&optional prompt-for-sender)
- "Forward the current message."
- (interactive "P")
- (notmuch-pick-close-message-window)
- (with-current-notmuch-pick-message
- (notmuch-mua-new-forward-message prompt-for-sender)))
-
-(defun notmuch-pick-reply (&optional prompt-for-sender)
- "Reply to the sender and all recipients of the current message."
- (interactive "P")
- (notmuch-pick-close-message-window)
- (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender t))
-
-(defun notmuch-pick-reply-sender (&optional prompt-for-sender)
- "Reply to the sender of the current message."
- (interactive "P")
- (notmuch-pick-close-message-window)
- (notmuch-mua-new-reply (notmuch-pick-get-message-id) prompt-for-sender nil))
-
-;; Shamelessly stolen from notmuch-show.el: maybe should be unified.
-(defun notmuch-pick-pipe-message (command)
- "Pipe the contents of the current message to the given command.
-
-The given command will be executed with the raw contents of the
-current email message as stdin. Anything printed by the command
-to stdout or stderr will appear in the *notmuch-pipe* buffer.
-
-When invoked with a prefix argument, the command will receive all
-open messages in the current thread (formatted as an mbox) rather
-than only the current message."
- (interactive "sPipe message to command: ")
- (let ((shell-command
- (concat notmuch-command " show --format=raw "
- (shell-quote-argument (notmuch-pick-get-message-id)) " | " command))
- (buf (get-buffer-create (concat "*notmuch-pipe*"))))
- (with-current-buffer buf
- (setq buffer-read-only nil)
- (erase-buffer)
- (let ((exit-code (call-process-shell-command shell-command nil buf)))
- (goto-char (point-max))
- (set-buffer-modified-p nil)
- (setq buffer-read-only t)
- (unless (zerop exit-code)
- (switch-to-buffer-other-window buf)
- (message (format "Command '%s' exited abnormally with code %d"
- shell-command exit-code)))))))