--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 CBEED431FDF\r
+ for <notmuch@notmuchmail.org>; Thu, 29 Aug 2013 09:26:45 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 T9kmMr5OdUUR for <notmuch@notmuchmail.org>;\r
+ Thu, 29 Aug 2013 09:26:41 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu\r
+ [18.9.25.13])\r
+ by olra.theworths.org (Postfix) with ESMTP id A6AE9431E62\r
+ for <notmuch@notmuchmail.org>; Thu, 29 Aug 2013 09:26:15 -0700 (PDT)\r
+X-AuditID: 1209190d-b7f078e000000937-04-521f7627e10c\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id E2.0B.02359.7267F125; Thu, 29 Aug 2013 12:26:15 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r7TGQ3nZ018774; \r
+ Thu, 29 Aug 2013 12:26:04 -0400\r
+Received: from drake.dyndns.org\r
+ (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+ [216.15.114.40]) (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7TGQ1Te014999\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Thu, 29 Aug 2013 12:26:02 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VF52n-0007Ww-3S; Thu, 29 Aug 2013 12:26:01 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 6/9] emacs: Add unified refresh-this-buffer function\r
+Date: Thu, 29 Aug 2013 12:25:54 -0400\r
+Message-Id: <1377793557-28878-7-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1377793557-28878-1-git-send-email-amdragon@mit.edu>\r
+References: <1377793557-28878-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFlrPIsWRmVeSWpSXmKPExsUixG6nrqteJh9k8Pgfs8X1mzOZHRg9nq26\r
+ xRzAGMVlk5Kak1mWWqRvl8CVsXJWA1vBBuOK/1ttGhjna3cxcnJICJhInP48gRXCFpO4cG89\r
+ G4gtJLCPUeLMbcYuRi4geyOjxKt/d9khEneYJBauMYRIzGWUmNo/FyzBJqAhsW3/ckYQW0RA\r
+ WmLn3dlAUzk4mAXUJP50qYCEhQVcJBYe3AVWwiKgKjFvzk82kBJeAQeJ9X9qIG5QlOh+NgHs\r
+ Bk4BR4n+u29ZINY6SPy5+JR9AiP/AkaGVYyyKblVurmJmTnFqcm6xcmJeXmpRbpGermZJXqp\r
+ KaWbGEHhwinJu4Px3UGlQ4wCHIxKPLwPg+WDhFgTy4orcw8xSnIwKYnyBpYAhfiS8lMqMxKL\r
+ M+KLSnNSiw8xSnAwK4nwvuUEyvGmJFZWpRblw6SkOViUxHmfPj0bKCSQnliSmp2aWpBaBJOV\r
+ 4eBQkuCNLwVqFCxKTU+tSMvMKUFIM3FwggznARpuBVLDW1yQmFucmQ6RP8WoKCXOawaSEABJ\r
+ ZJTmwfXC4vkVozjQK8K8YSBVPMBUANf9CmgwE9DgCflyIINLEhFSUg2My99/cY80ydhsvSh7\r
+ Vu3dq6qqh7QOfO1vXLP4R+yaV8syVbaq7Jr+Z/WHLQ3nBTnOBm3cZLPxx699GbVMrUdaH67Y\r
+ P8lQwrpp8bbl76Vv2e6blWo6selcksDMJT0XWA9vjnSLXHFqf8XWqZ3yAdtKJbifzfKNeOLo\r
+ z5K62f3yq49Pzx9T/X3j6SklluKMREMt5qLiRAC4zM/qwgIAAA==\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: Thu, 29 Aug 2013 16:26:46 -0000\r
+\r
+This unifies the various refresh and poll-and-refresh functions we\r
+have for different modes. Now all modes bind "=" and "G" (except\r
+show, which doesn't bind "G" for some reason) to\r
+`notmuch-refresh-this-buffer' and\r
+`notmuch-poll-and-refresh-this-buffer', respectively.\r
+---\r
+ emacs/notmuch-hello.el | 12 +++---------\r
+ emacs/notmuch-lib.el | 20 +++++++++++++++++++-\r
+ emacs/notmuch-show.el | 3 ++-\r
+ emacs/notmuch.el | 12 +++---------\r
+ 4 files changed, 27 insertions(+), 20 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index c9d484c..147e2dd 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -476,15 +476,8 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
+ (defun notmuch-hello-update (&optional no-display)\r
+ "Update the current notmuch view."\r
+ ;; Lazy - rebuild everything.\r
+- (interactive)\r
+ (notmuch-hello no-display))\r
+ \r
+-(defun notmuch-hello-poll-and-update ()\r
+- "Invoke `notmuch-poll' to import mail, then refresh the current view."\r
+- (interactive)\r
+- (notmuch-poll)\r
+- (notmuch-hello-update))\r
+-\r
+ (defvar notmuch-hello-inhibit-auto-refresh nil\r
+ "Don't refresh notmuch-hello on window configuration changes.")\r
+ \r
+@@ -523,8 +516,8 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
+ (message "notmuch version %s" (notmuch-version))))\r
+ (define-key map "?" 'notmuch-help)\r
+ (define-key map "q" 'notmuch-kill-this-buffer)\r
+- (define-key map "=" 'notmuch-hello-update)\r
+- (define-key map "G" 'notmuch-hello-poll-and-update)\r
++ (define-key map "=" 'notmuch-refresh-this-buffer)\r
++ (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)\r
+ (define-key map (kbd "<C-tab>") 'widget-backward)\r
+ (define-key map "m" 'notmuch-mua-new-mail)\r
+ (define-key map "s" 'notmuch-search)\r
+@@ -540,6 +533,7 @@ Complete list of currently available key bindings:\r
+ \\{notmuch-hello-mode-map}"\r
+ (interactive)\r
+ (kill-all-local-variables)\r
++ (setq notmuch-buffer-refresh-function #'notmuch-hello-update)\r
+ (use-local-map notmuch-hello-mode-map)\r
+ (setq major-mode 'notmuch-hello-mode\r
+ mode-name "notmuch-hello")\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 9754e16..782badb 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -204,6 +204,25 @@ depending on the value of `notmuch-poll-script'."\r
+ (interactive)\r
+ (kill-buffer (current-buffer)))\r
+ \r
++(defvar notmuch-buffer-refresh-function nil\r
++ "Function to call to refresh the current buffer.")\r
++(make-variable-buffer-local 'notmuch-buffer-refresh-function)\r
++\r
++(defun notmuch-refresh-this-buffer ()\r
++ "Refresh the current buffer."\r
++ (interactive)\r
++ (when notmuch-buffer-refresh-function\r
++ (if (commandp notmuch-buffer-refresh-function)\r
++ ;; Pass prefix argument, etc.\r
++ (call-interactively notmuch-buffer-refresh-function)\r
++ (funcall notmuch-buffer-refresh-function))))\r
++\r
++(defun notmuch-poll-and-refresh-this-buffer ()\r
++ "Invoke `notmuch-poll' to import mail, then refresh the current buffer."\r
++ (interactive)\r
++ (notmuch-poll)\r
++ (notmuch-refresh-this-buffer))\r
++\r
+ (defun notmuch-prettify-subject (subject)\r
+ ;; This function is used by `notmuch-search-process-filter' which\r
+ ;; requires that we not disrupt its' matching state.\r
+@@ -596,7 +615,6 @@ status."\r
+ (defvar notmuch-show-process-crypto nil)\r
+ (make-variable-buffer-local 'notmuch-show-process-crypto)\r
+ \r
+-\r
+ (provide 'notmuch-lib)\r
+ \r
+ ;; Local Variables:\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 82b70ba..380df66 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1279,7 +1279,7 @@ reset based on the original query."\r
+ (define-key map "w" 'notmuch-show-save-attachments)\r
+ (define-key map "V" 'notmuch-show-view-raw-message)\r
+ (define-key map "c" 'notmuch-show-stash-map)\r
+- (define-key map "=" 'notmuch-show-refresh-view)\r
++ (define-key map "=" 'notmuch-refresh-this-buffer)\r
+ (define-key map "h" 'notmuch-show-toggle-visibility-headers)\r
+ (define-key map "*" 'notmuch-show-tag-all)\r
+ (define-key map "-" 'notmuch-show-remove-tag)\r
+@@ -1338,6 +1338,7 @@ All currently available key bindings:\r
+ \\{notmuch-show-mode-map}"\r
+ (interactive)\r
+ (kill-all-local-variables)\r
++ (setq notmuch-buffer-refresh-function #'notmuch-show-refresh-view)\r
+ (use-local-map notmuch-show-mode-map)\r
+ (setq major-mode 'notmuch-show-mode\r
+ mode-name "notmuch-show")\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 82cece8..80446be 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -228,8 +228,8 @@ For a mouse binding, return nil."\r
+ (define-key map "s" 'notmuch-search)\r
+ (define-key map "o" 'notmuch-search-toggle-order)\r
+ (define-key map "c" 'notmuch-search-stash-map)\r
+- (define-key map "=" 'notmuch-search-refresh-view)\r
+- (define-key map "G" 'notmuch-search-poll-and-refresh-view)\r
++ (define-key map "=" 'notmuch-refresh-this-buffer)\r
++ (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)\r
+ (define-key map "t" 'notmuch-search-filter-by-tag)\r
+ (define-key map "f" 'notmuch-search-filter)\r
+ (define-key map [mouse-1] 'notmuch-search-show-thread)\r
+@@ -403,6 +403,7 @@ Complete list of currently available key bindings:\r
+ (make-local-variable 'notmuch-search-oldest-first)\r
+ (make-local-variable 'notmuch-search-target-thread)\r
+ (make-local-variable 'notmuch-search-target-line)\r
++ (setq notmuch-buffer-refresh-function #'notmuch-search-refresh-view)\r
+ (set (make-local-variable 'scroll-preserve-screen-position) t)\r
+ (add-to-invisibility-spec (cons 'ellipsis t))\r
+ (use-local-map notmuch-search-mode-map)\r
+@@ -950,7 +951,6 @@ query string as the current search. If the current thread is in\r
+ the new search results, then point will be placed on the same\r
+ thread. Otherwise, point will be moved to attempt to be in the\r
+ same relative position within the new buffer."\r
+- (interactive)\r
+ (let ((target-line (line-number-at-pos))\r
+ (oldest-first notmuch-search-oldest-first)\r
+ (target-thread (notmuch-search-find-thread-id 'bare))\r
+@@ -959,12 +959,6 @@ same relative position within the new buffer."\r
+ (notmuch-search query oldest-first target-thread target-line)\r
+ (goto-char (point-min))))\r
+ \r
+-(defun notmuch-search-poll-and-refresh-view ()\r
+- "Invoke `notmuch-poll' to import mail, then refresh the current view."\r
+- (interactive)\r
+- (notmuch-poll)\r
+- (notmuch-search-refresh-view))\r
+-\r
+ (defun notmuch-search-toggle-order ()\r
+ "Toggle the current search order.\r
+ \r
+-- \r
+1.7.10.4\r
+\r