--- /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 71050431FDA\r
+ for <notmuch@notmuchmail.org>; Tue, 3 Sep 2013 14:45:59 -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 wLRjpUhV+miA for <notmuch@notmuchmail.org>;\r
+ Tue, 3 Sep 2013 14:45:52 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (dmz-mailsec-scanner-5.mit.edu\r
+ [18.7.68.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 4248B431FDE\r
+ for <notmuch@notmuchmail.org>; Tue, 3 Sep 2013 14:45:34 -0700 (PDT)\r
+X-AuditID: 12074422-b7ef78e000000935-fa-5226587b0bc6\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 8A.AC.02357.B7856225; Tue, 3 Sep 2013 17:45:31 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r83LjUin023526; \r
+ Tue, 3 Sep 2013 17:45:31 -0400\r
+Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182])\r
+ (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 r83LjRBx026854\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Tue, 3 Sep 2013 17:45:28 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VGyPe-0004y1-Um; Tue, 03 Sep 2013 17:45:26 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 6/9] emacs: Add unified refresh-this-buffer function\r
+Date: Tue, 3 Sep 2013 17:45:22 -0400\r
+Message-Id: <1378244725-18846-7-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1378244725-18846-1-git-send-email-amdragon@mit.edu>\r
+References: <1378244725-18846-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrVsdoRZk8H2fmUXTdGeL1XN5LK7f\r
+ nMnswOyxc9Zddo9b91+zezxbdYs5gDmKyyYlNSezLLVI3y6BK6Op7zRjwSvjipvX3jI2MJ7X\r
+ 7mLk5JAQMJH42tfKCmGLSVy4t56ti5GLQ0hgH6PE+x9fWCGcDYwSH/6thsocZpLY1HkJypnL\r
+ KPG9+wkjSD+bgIbEtv3LwWwRAWmJnXdng81lFoiWOHJ5BhuILSzgLnH/bwcziM0ioCpxtmkx\r
+ WJxXwEFi36237BB3KEp0P5sAFucUcJToXbAILC4EVNO08jL7BEb+BYwMqxhlU3KrdHMTM3OK\r
+ U5N1i5MT8/JSi3RN9XIzS/RSU0o3MYKCi91FaQfjz4NKhxgFOBiVeHgZHqkGCbEmlhVX5h5i\r
+ lORgUhLlPRKqFiTEl5SfUpmRWJwRX1Sak1p8iFGCg1lJhDfBByjHm5JYWZValA+TkuZgURLn\r
+ ffb0bKCQQHpiSWp2ampBahFMVoaDQ0mCtzwcqFGwKDU9tSItM6cEIc3EwQkynAdo+M8wkOHF\r
+ BYm5xZnpEPlTjIpS4rzzQZoFQBIZpXlwvbDof8UoDvSKMG8PSBUPMHHAdb8CGswENDjtsyrI\r
+ 4JJEhJRUA+Ps2wGfr9QqST7vnLnN/xMLS4NwesK7v3Mtjz+3mMKfe0vjmOsUhm9FvAXl9zWS\r
+ FLudSv7+OhUbrvahyCBpy2rH9u4so01TCv0vOYi+i+HrU/SpijjyI1N4a3pFJOPN5c+bfFx2\r
+ cu7OiLCeLvQ4ZoKZb+38LR9i7gutDki7923/vuaPIqoPbZRYijMSDbWYi4oTAYEpC6bZAgAA\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: Tue, 03 Sep 2013 21:45:59 -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 94cc4b5..6a7b884 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -481,15 +481,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
+ (defun notmuch-hello-window-configuration-change ()\r
+ "Hook function to update the hello buffer when it is switched to."\r
+ (let ((hello-buf (get-buffer "*notmuch-hello*"))\r
+@@ -528,8 +521,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
+@@ -545,6 +538,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