From: David Edmondson Date: Fri, 9 May 2014 08:22:22 +0000 (+0100) Subject: [PATCH v1 2/3] emacs: Minor re-work of `notmuch-show-pipe-message' X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cb4df994e3a22df1b72bc52f8f0221c5a63a54fb;p=notmuch-archives.git [PATCH v1 2/3] emacs: Minor re-work of `notmuch-show-pipe-message' --- diff --git a/84/5b705b8bca8a18ca8aba16d7ca74ab5c2d6a4e b/84/5b705b8bca8a18ca8aba16d7ca74ab5c2d6a4e new file mode 100644 index 000000000..9d4ebbb14 --- /dev/null +++ b/84/5b705b8bca8a18ca8aba16d7ca74ab5c2d6a4e @@ -0,0 +1,146 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 0E62E431FC3 + for ; Fri, 9 May 2014 01:22:33 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ydzyAsbgTA0J for ; + Fri, 9 May 2014 01:22:28 -0700 (PDT) +Received: from mail-we0-f172.google.com (mail-we0-f172.google.com + [74.125.82.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 1C9D0431FBF + for ; Fri, 9 May 2014 01:22:27 -0700 (PDT) +Received: by mail-we0-f172.google.com with SMTP id k48so3659841wev.31 + for ; Fri, 09 May 2014 01:22:27 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to + :references; + bh=pOt6MlVxSy5HEZc0EkJj/0lL7DaZvjSTy6J7j7613ac=; + b=IEPBCT+LM47Nf67ewjrpYJvOAwNMgTQouVSsO2vi0k8U1X7YHiPMECjf1BYMY2x2Ci + +VaUyq4J5yNsuSylcH/HsZ2P1zJBZryqQfHtvsYPw2AIq165ciutPv0RpBBa0FHsfnUa + zZB8sG005KIK2pBmgKAjCTZ+aqyjDMOz4uv53NV6QH7xF4AgXOlubY6Xhp7PgciewUQY + h/QxnEgyH63wLwVldharV09zn4jCogw35ajtAHCkn9UoEQ0fibYE6sPxsFKTuWgInlyB + 7GkEoabIVrmE9c8XyD5WDd/sDg9tx5ipQKPpcJQZEFFJZ5FtbLwfH1f1zsXYlz/vRv7O + CTIQ== +X-Gm-Message-State: + ALoCoQmoPpy9jLq5ml5GpJJy1iECGxiU/iMaSdUWMlXGgu5YJqCGMbXRMIdTLDMWXpC26rxzi0yy +X-Received: by 10.194.92.7 with SMTP id ci7mr7330736wjb.7.1399623745891; + Fri, 09 May 2014 01:22:25 -0700 (PDT) +Received: from hotblack-desiato.hh.sledj.net + ([2a01:348:1a2:1:a288:b4ff:fe8a:77d8]) + by mx.google.com with ESMTPSA id ct2sm4527426wjb.33.2014.05.09.01.22.24 + for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Fri, 09 May 2014 01:22:24 -0700 (PDT) +Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) + id 14B1910920E; Fri, 9 May 2014 09:22:23 +0100 (BST) +From: David Edmondson +To: notmuch@notmuchmail.org +Subject: [PATCH v1 2/3] emacs: Minor re-work of `notmuch-show-pipe-message' +Date: Fri, 9 May 2014 09:22:22 +0100 +Message-Id: <1399623743-30478-3-git-send-email-dme@dme.org> +X-Mailer: git-send-email 2.0.0.rc0 +In-Reply-To: <1399623743-30478-1-git-send-email-dme@dme.org> +References: <1399623743-30478-1-git-send-email-dme@dme.org> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 09 May 2014 08:22:33 -0000 + +Stylistic only - no functional change. +--- + emacs/notmuch-show.el | 59 +++++++++++++++++++++++++-------------------------- + 1 file changed, 29 insertions(+), 30 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 2ed221a..62c0be6 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1784,36 +1784,35 @@ If ENTIRE-THREAD is non-nil (or when invoked with a prefix + argument), COMMAND will receive all open messages in the current + thread (formatted as an mbox) rather than only the current + message." +- (interactive (let ((query-string (if current-prefix-arg +- "Pipe all open messages to command: " +- "Pipe message to command: "))) +- (list current-prefix-arg (read-string query-string)))) +- (let (shell-command) +- (if entire-thread +- (setq shell-command +- (concat notmuch-command " show --format=mbox --exclude=false " +- (shell-quote-argument +- (mapconcat 'identity (notmuch-show-get-message-ids-for-open-messages) " OR ")) +- " | " command)) +- (setq shell-command +- (concat notmuch-command " show --format=raw " +- (shell-quote-argument (notmuch-show-get-message-id)) " | " command))) +- (let ((cwd default-directory) +- (buf (get-buffer-create (concat "*notmuch-pipe*")))) +- (with-current-buffer buf +- (setq buffer-read-only nil) +- (erase-buffer) +- ;; Use the originating buffer's working directory instead of +- ;; that of the pipe buffer. +- (cd cwd) +- (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)))))))) ++ (interactive (let ((prompt (if current-prefix-arg ++ "Pipe all open messages to command: " ++ "Pipe message to command: "))) ++ (list current-prefix-arg (read-string prompt)))) ++ ++ (let ((shell-command ++ (concat notmuch-command " show" ++ (if entire-thread ++ (concat " --format=mbox --exclude=false " ++ (mapconcat #'shell-quote-argument (notmuch-show-get-message-ids-for-open-messages) " OR ")) ++ (concat " --format=raw " ++ (shell-quote-argument (notmuch-show-get-message-id)))) ++ " | " command)) ++ (cwd default-directory) ++ (buf (get-buffer-create (concat "*notmuch-pipe*")))) ++ (with-current-buffer buf ++ (setq buffer-read-only nil) ++ (erase-buffer) ++ ;; Use the originating buffer's working directory instead of ++ ;; that of the pipe buffer. ++ (cd cwd) ++ (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))))))) + + (defun notmuch-show-tag-message (&rest tag-changes) + "Change tags for the current message. +-- +2.0.0.rc0 +