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 B95E64196F2 for ; Wed, 21 Apr 2010 14:42:11 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[BAYES_20=-0.001] 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 9HNujFoWB6us for ; Wed, 21 Apr 2010 14:42:11 -0700 (PDT) Received: from pivot.cs.unb.ca (pivot.cs.unb.ca [131.202.240.57]) by olra.theworths.org (Postfix) with ESMTP id E8670431FC1 for ; Wed, 21 Apr 2010 14:42:10 -0700 (PDT) Received: from fctnnbsc30w-142167190087.pppoe-dynamic.high-speed.nb.bellaliant.net ([142.167.190.87] helo=rocinante.cs.unb.ca) by pivot.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1O4hgQ-0004Ib-7B; Wed, 21 Apr 2010 18:42:10 -0300 Received: from bremner by rocinante.cs.unb.ca with local (Exim 4.71) (envelope-from ) id 1O4hfy-0004eK-Iw; Wed, 21 Apr 2010 18:41:42 -0300 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH v2] notmuch.el: add a hook to notmuch-reply Date: Wed, 21 Apr 2010 18:41:35 -0300 Message-Id: <1271886095-17766-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1267186952-4561-1-git-send-email-david@tethera.net> References: <1267186952-4561-1-git-send-email-david@tethera.net> X-Sender-Verified: bremner@pivot.cs.unb.ca Cc: David Bremner 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: Wed, 21 Apr 2010 21:42:11 -0000 From: David Bremner This patch introduces a variable notmuch-reply-hook and calls it using run-hooks. This allows people to easily override the header setup and so forth done by notmuch-reply. In particular it allows harmonizing the headers of message-mode and notmuch-reply. --- Rebased against current master. The rework was inspired by current discussion about how Bcc handling was broken in message-mode buffers not generated by notmuch-reply. emacs/notmuch.el | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 66958a6..563fdc8 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -72,6 +72,14 @@ For example: :type '(alist :key-type (string) :value-type (string)) :group 'notmuch) +(defcustom notmuch-reply-hook nil + "List of functions to call when replying to a message. +Run after the buffer content is returned from notmuch and before +handing off to message mode. The function `notmuch-reply' runs +this hook." + :type 'hook + :group 'notmuch) + (defun notmuch-select-tag-with-completion (prompt &rest search-terms) (let ((tag-list (with-output-to-string @@ -124,6 +132,8 @@ For example: (progn (insert "--text follows this line--") (forward-line))) + (save-excursion + (run-hooks 'notmuch-reply-hook)) (message-mode)) (defun notmuch-documentation-first-line (symbol) -- 1.7.0