X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=3fc3787c13496ed6c5b1f6a00077cf9496388b68;hp=f872cdfe00d44c1a498ad1ad46abe6b4ee84d1c4;hb=4606ea60a76c11a97e913f87b97d76e64b4bcf0c;hpb=42e146a3a20c1ca2e1a9d6fd2d5e5e9d03a06641 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index f872cdfe..3fc3787c 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -597,21 +597,17 @@ By default, various components of email messages, (citations, signatures, already-read messages), are hidden. You can make these parts visible by clicking with the mouse button or by pressing RET after positioning the cursor on a hidden part, (for -which \\[notmuch-show-next-button] and -\\[notmuch-show-previous-button] are helpful). +which \\[notmuch-show-next-button] and \\[notmuch-show-previous-button] are helpful). Reading the thread sequentially is well-supported by pressing -\\[notmuch-show-advance-and-archive]. This will scroll the -current message (if necessary), advance to the next message, or -advance to the next thread (if already on the last message of a -thread). +\\[notmuch-show-advance-and-archive]. This will scroll the current message (if necessary), advance +to the next message, or advance to the next thread (if already on +the last message of a thread). Other commands are available to read or manipulate the thread -more selectively, (such as '\\[notmuch-show-next-message]' and -'\\[notmuch-show-previous-message]' to advance to messages -without removing any tags, and '\\[notmuch-show-archive-thread]' -to archive an entire thread without scrolling through with -\\[notmuch-show-advance-and-archive]). +more selectively, (such as '\\[notmuch-show-next-message]' and '\\[notmuch-show-previous-message]' to advance to messages +without removing any tags, and '\\[notmuch-show-archive-thread]' to archive an entire thread +without scrolling through with \\[notmuch-show-advance-and-archive]). You can add or remove arbitary tags from the current message with '\\[notmuch-show-add-tag]' or '\\[notmuch-show-remove-tag]'. @@ -730,7 +726,7 @@ All currently available key bindings: (defun notmuch-show-get-message-id () "Return the message id of the current message." - (concat "id:" (notmuch-show-get-prop :id))) + (concat "id:\"" (notmuch-show-get-prop :id) "\"")) ;; dme: Would it make sense to use a macro for many of these? @@ -778,6 +774,22 @@ All currently available key bindings: "Mark the current message as read." (notmuch-show-remove-tag "unread")) +;; Functions for getting attributes of several messages in the current +;; thread. + +(defun notmuch-show-get-message-ids-for-open-messages () + "Return a list of all message IDs for open messages in the current thread." + (save-excursion + (let (message-ids done) + (goto-char (point-min)) + (while (not done) + (if (notmuch-show-message-visible-p) + (setq message-ids (append message-ids (list (notmuch-show-get-message-id))))) + (setq done (not (notmuch-show-goto-message-next))) + ) + message-ids + ))) + ;; Commands typically bound to keys. (defun notmuch-show-advance-and-archive () @@ -908,16 +920,27 @@ any effects from previous calls to (interactive) (view-file (notmuch-show-get-filename))) -(defun notmuch-show-pipe-message (command) - "Pipe the contents of the current message to the given command. +(defun notmuch-show-pipe-message (entire-thread command) + "Pipe the contents of the current message (or thread) 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 *Messages* buffer." - (interactive "sPipe message to command: ") - (apply 'start-process-shell-command "notmuch-pipe-command" "*notmuch-pipe*" - (list command " < " - (shell-quote-argument (notmuch-show-get-filename))))) +to stdout or stderr will appear in the *Messages* 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 "P\nsPipe message to command: ") + (let (shell-command) + (if entire-thread + (setq shell-command + (concat "notmuch show --format=mbox " + (shell-quote-argument + (mapconcat 'identity (notmuch-show-get-message-ids-for-open-messages) " OR ")) + " | " command)) + (setq shell-command + (concat command " < " (shell-quote-argument (notmuch-show-get-filename))))) + (start-process-shell-command "notmuch-pipe-command" "*notmuch-pipe*" shell-command))) (defun notmuch-show-add-tag (&rest toadd) "Add a tag to the current message."