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 DE34840BFD5 for ; Sat, 18 Sep 2010 12:49:05 -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 yZxN4hpOiCb5 for ; Sat, 18 Sep 2010 12:48:53 -0700 (PDT) Received: from brinza.cc.columbia.edu (brinza.cc.columbia.edu [128.59.29.8]) by olra.theworths.org (Postfix) with ESMTP id EC24340BFD3 for ; Sat, 18 Sep 2010 12:48:52 -0700 (PDT) Received: from servo.finestructure.net (cpe-67-243-144-42.nyc.res.rr.com [67.243.144.42]) (user=jgr2110 author=jrollins@finestructure.net mech=PLAIN bits=0) by brinza.cc.columbia.edu (8.14.4/8.14.3) with ESMTP id o8IJmoHi001538 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 18 Sep 2010 15:48:52 -0400 (EDT) Received: from jrollins by servo.finestructure.net with local (Exim 4.72) (envelope-from ) id 1Ox3P0-00080G-6w; Sat, 18 Sep 2010 15:48:50 -0400 From: Jameson Rollins To: notmuch@notmuchmail.org Subject: [PATCH 1/2] emacs: mv notmuch-{show,common}-do-stash Date: Sat, 18 Sep 2010 15:48:21 -0400 Message-Id: <1284839302-30583-1-git-send-email-jrollins@finestructure.net> X-Mailer: git-send-email 1.7.1 X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.68 on 128.59.29.8 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: Sat, 18 Sep 2010 19:49:06 -0000 Here we move the notmuch-show/notmuch-show-do-stash function to notmuch-lib/notmuch-common-do-stash. Nothing in this function is notmuch-show mode specific, so this move will make it cleaner to be used by other modes (such as notmuch-search). --- emacs/notmuch-lib.el | 8 ++++++++ emacs/notmuch-show.el | 20 ++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index f30bcb4..9fb15ca 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -70,6 +70,13 @@ the user hasn't set this variable with the old or new value." ;; +(defun notmuch-common-do-stash (text) + "Common function to stash text in kill ring, and display in minibuffer." + (kill-new text) + (message "Stashed: %s" text)) + +;; + ;; XXX: This should be a generic function in emacs somewhere, not ;; here. (defun point-invisible-p () @@ -86,3 +93,4 @@ within the current window." (assq prop buffer-invisibility-spec))))) (provide 'notmuch-lib) + diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index b0c1f63..b88267d 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1012,49 +1012,45 @@ buffer." (interactive) (notmuch-show-archive-thread-internal nil)) -(defun notmuch-show-do-stash (text) - (kill-new text) - (message "Saved: %s" text)) - (defun notmuch-show-stash-cc () "Copy CC field of current message to kill-ring." (interactive) - (notmuch-show-do-stash (notmuch-show-get-cc))) + (notmuch-common-do-stash (notmuch-show-get-cc))) (defun notmuch-show-stash-date () "Copy date of current message to kill-ring." (interactive) - (notmuch-show-do-stash (notmuch-show-get-date))) + (notmuch-common-do-stash (notmuch-show-get-date))) (defun notmuch-show-stash-filename () "Copy filename of current message to kill-ring." (interactive) - (notmuch-show-do-stash (notmuch-show-get-filename))) + (notmuch-common-do-stash (notmuch-show-get-filename))) (defun notmuch-show-stash-from () "Copy From address of current message to kill-ring." (interactive) - (notmuch-show-do-stash (notmuch-show-get-from))) + (notmuch-common-do-stash (notmuch-show-get-from))) (defun notmuch-show-stash-message-id () "Copy message ID of current message to kill-ring." (interactive) - (notmuch-show-do-stash (notmuch-show-get-message-id))) + (notmuch-common-do-stash (notmuch-show-get-message-id))) (defun notmuch-show-stash-subject () "Copy Subject field of current message to kill-ring." (interactive) - (notmuch-show-do-stash (notmuch-show-get-subject))) + (notmuch-common-do-stash (notmuch-show-get-subject))) (defun notmuch-show-stash-tags () "Copy tags of current message to kill-ring as a comma separated list." (interactive) - (notmuch-show-do-stash (mapconcat 'identity (notmuch-show-get-tags) ","))) + (notmuch-common-do-stash (mapconcat 'identity (notmuch-show-get-tags) ","))) (defun notmuch-show-stash-to () "Copy To address of current message to kill-ring." (interactive) - (notmuch-show-do-stash (notmuch-show-get-to))) + (notmuch-common-do-stash (notmuch-show-get-to))) ;; Commands typically bound to buttons. -- 1.7.1