[PATCH 1/2] emacs: add notmuch-show-refresh-view function
authorJameson Graef Rollins <jrollins@finestructure.net>
Sun, 29 May 2011 00:09:43 +0000 (17:09 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:27 +0000 (09:38 -0800)
8b/9f3eae441d12e82d73ce0cfd722e0da6f6ecda [new file with mode: 0644]

diff --git a/8b/9f3eae441d12e82d73ce0cfd722e0da6f6ecda b/8b/9f3eae441d12e82d73ce0cfd722e0da6f6ecda
new file mode 100644 (file)
index 0000000..4d1c06f
--- /dev/null
@@ -0,0 +1,144 @@
+Return-Path: <jrollins@servo.finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 763DF431FD0\r
+       for <notmuch@notmuchmail.org>; Sat, 28 May 2011 17:10:10 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.921\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5\r
+       tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id M2ugFPFRtrBG for <notmuch@notmuchmail.org>;\r
+       Sat, 28 May 2011 17:10:09 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id B3380431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 28 May 2011 17:10:09 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by fire-doxen-postvirus (Postfix) with ESMTP id BA79C32808D;\r
+       Sat, 28 May 2011 17:03:41 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com\r
+       [98.149.172.122]) (Authenticated sender: jrollins)\r
+       by fire-doxen-submit (Postfix) with ESMTP id 7E631328071;\r
+       Sat, 28 May 2011 17:03:34 -0700 (PDT)\r
+Received: by servo.finestructure.net (Postfix, from userid 1000)\r
+       id 2EA6B4C5; Sat, 28 May 2011 17:10:01 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 1/2] emacs: add notmuch-show-refresh-view function\r
+Date: Sat, 28 May 2011 17:09:43 -0700\r
+Message-Id: <1306627784-3401-1-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.4.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 29 May 2011 00:10:10 -0000\r
+\r
+This function, like the equivalent for notmuch-search, just refreshes\r
+the current show view.  Like in notmuch-search, this new function is\r
+bound to "=".  If a prefix is given then the rediplay happens with the\r
+crypto-switch set, which displays the thread with the opposite logic\r
+of whatever is set in the notmuch-crypto-process-mime customization\r
+variable.\r
+---\r
+ emacs/notmuch-show.el |   42 +++++++++++++++++++++++++++++++++++-------\r
+ 1 files changed, 35 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index a25ad99..3b35b81 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -780,8 +780,14 @@ current buffer, if possible."\r
+   "Insert the forest of threads FOREST."\r
+   (mapc '(lambda (thread) (notmuch-show-insert-thread thread 0)) forest))\r
\r
++(defvar notmuch-show-thread-id nil)\r
++(make-variable-buffer-local 'notmuch-show-thread-id)\r
+ (defvar notmuch-show-parent-buffer nil)\r
+ (make-variable-buffer-local 'notmuch-show-parent-buffer)\r
++(defvar notmuch-show-query-context nil)\r
++(make-variable-buffer-local 'notmuch-show-query-context)\r
++(defvar notmuch-show-buffer-name nil)\r
++(make-variable-buffer-local 'notmuch-show-buffer-name)\r
\r
+ ;;;###autoload\r
+ (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)\r
+@@ -801,17 +807,23 @@ which the message thread is shown. If it is nil (which occurs\r
+ when the command is called interactively) the argument to the\r
+ function is used. "\r
+   (interactive "sNotmuch show: ")\r
+-  (let ((buffer (get-buffer-create (generate-new-buffer-name\r
+-                                  (or buffer-name\r
+-                                      (concat "*notmuch-" thread-id "*")))))\r
+-      (process-crypto (if crypto-switch\r
+-                          (not notmuch-crypto-process-mime)\r
+-                        notmuch-crypto-process-mime))\r
+-      (inhibit-read-only t))\r
++  (let* ((buffer-name (generate-new-buffer-name\r
++                     (or buffer-name\r
++                         (concat "*notmuch-" thread-id "*"))))\r
++       (buffer (get-buffer-create buffer-name))\r
++       (process-crypto (if crypto-switch\r
++                           (not notmuch-crypto-process-mime)\r
++                         notmuch-crypto-process-mime))\r
++       (inhibit-read-only t))\r
+     (switch-to-buffer buffer)\r
+     (notmuch-show-mode)\r
++\r
++    (setq notmuch-show-thread-id thread-id)\r
+     (setq notmuch-show-parent-buffer parent-buffer)\r
++    (setq notmuch-show-query-context query-context)\r
++    (setq notmuch-show-buffer-name buffer-name)\r
+     (setq notmuch-show-process-crypto process-crypto)\r
++\r
+     (erase-buffer)\r
+     (goto-char (point-min))\r
+     (save-excursion\r
+@@ -844,6 +856,21 @@ function is used. "\r
\r
+     (notmuch-show-mark-read)))\r
\r
++(defun notmuch-show-refresh-view (&optional crypto-switch)\r
++  "Refresh the current view (with crypto switch if prefix given).\r
++\r
++Kills the current buffer and reruns notmuch show with the same\r
++thread id.  If a prefix is given, the current thread is\r
++redisplayed with the crypto switch activated, which switch the\r
++logic of the notmuch-crypto-process-mime customization variable."\r
++  (interactive "P")\r
++  (let ((thread-id notmuch-show-thread-id)\r
++      (parent-buffer notmuch-show-parent-buffer)\r
++      (query-context notmuch-show-query-context)\r
++      (buffer-name notmuch-show-buffer-name))\r
++    (notmuch-kill-this-buffer)\r
++    (notmuch-show thread-id parent-buffer query-context buffer-name crypto-switch)))\r
++\r
+ (defvar notmuch-show-stash-map\r
+   (let ((map (make-sparse-keymap)))\r
+     (define-key map "c" 'notmuch-show-stash-cc)\r
+@@ -875,6 +902,7 @@ function is used. "\r
+       (define-key map "V" 'notmuch-show-view-raw-message)\r
+       (define-key map "v" 'notmuch-show-view-all-mime-parts)\r
+       (define-key map "c" 'notmuch-show-stash-map)\r
++      (define-key map "=" 'notmuch-show-refresh-view)\r
+       (define-key map "h" 'notmuch-show-toggle-headers)\r
+       (define-key map "-" 'notmuch-show-remove-tag)\r
+       (define-key map "+" 'notmuch-show-add-tag)\r
+-- \r
+1.7.4.4\r
+\r