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 435E34196F0 for ; Fri, 9 Apr 2010 12:53:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -4.2 X-Spam-Level: X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham 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 7HYv0vt-mbIz for ; Fri, 9 Apr 2010 12:53:27 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by olra.theworths.org (Postfix) with ESMTP id 73200431FC1 for ; Fri, 9 Apr 2010 12:53:27 -0700 (PDT) Received: from localhost ([::1] helo=localhost.localdomain) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1O0KGd-0007Mz-18 for notmuch@notmuchmail.org; Fri, 09 Apr 2010 19:53:27 +0000 Received: by localhost.localdomain (Postfix, from userid 500) id 3532AC00E1; Fri, 9 Apr 2010 12:53:26 -0700 (PDT) From: Dirk Hohndel To: Subject: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll Date: Fri, 09 Apr 2010 12:53:26 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html 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 Apr 2010 19:53:28 -0000 The new functions first check if an external poll script has been defined in the variable 'notmuch-external-refresh-script and if yes, runs that script before executing the existing refresh function (which is bound to '=') This can be used to have 'G' mimic the mutt behavior of polling an external mail server - or if the mail polling is already automatic, it can trigger the call to notmuch new and any necessary automatic tagging of new email. Signed-off-by: Dirk Hohndel --- emacs/notmuch.el | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 517c53a..a56b949 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -260,6 +260,7 @@ For a mouse binding, return nil." (define-key map "s" 'notmuch-search) (define-key map "o" 'notmuch-search-toggle-order) (define-key map "=" 'notmuch-search-refresh-view) + (define-key map "G" 'notmuch-poll-and-search-refresh-view) (define-key map "t" 'notmuch-search-filter-by-tag) (define-key map "f" 'notmuch-search-filter) (define-key map [mouse-1] 'notmuch-search-show-thread) @@ -747,6 +748,17 @@ same relative position within the new buffer." (goto-char (point-min)) )) +(defun notmuch-poll-and-search-refresh-view () + "Run external script to import mail and refresh the current view. + +Checks if the variable 'notmuch-external-refresh-script is defined +and runs the external program defined it provides. Then calls +notmuch-search-refresh-view to refresh the current view." + (interactive) + (if (boundp 'notmuch-external-refresh-script) + (call-process notmuch-external-refresh-script nil nil)) + (notmuch-search-refresh-view)) + (defun notmuch-search-toggle-order () "Toggle the current search order. @@ -801,6 +813,7 @@ current search results AND that are tagged with the given tag." (define-key map ">" 'notmuch-folder-last) (define-key map "<" 'notmuch-folder-first) (define-key map "=" 'notmuch-folder) + (define-key map "G" 'notmuch-poll-and-folder) (define-key map "s" 'notmuch-search) (define-key map [mouse-1] 'notmuch-folder-show-search) (define-key map (kbd "RET") 'notmuch-folder-show-search) @@ -919,6 +932,17 @@ Currently available key bindings: (if search (notmuch-search (cdr search) notmuch-search-oldest-first)))) +(defun notmuch-poll-and-folder () + "Run external script to import mail and refresh the folder view. + +Checks if the variable 'notmuch-external-refresh-script is defined +and runs the external program defined it provides. Then calls +notmuch-folder to refresh the current view." + (interactive) + (if (boundp 'notmuch-external-refresh-script) + (call-process notmuch-external-refresh-script nil nil)) + (notmuch-folder)) + ;;;###autoload (defun notmuch-folder () "Show the notmuch folder view and update the displayed counts." -- 1.6.6.1 -- Dirk Hohndel Intel Open Source Technology Center