From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 49C3A431FB6 for ; Thu, 26 May 2011 01:41:53 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=disabled 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 LusZ1096SC6s for ; Thu, 26 May 2011 01:41:52 -0700 (PDT) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id 6655E431FD0 for ; Thu, 26 May 2011 01:41:52 -0700 (PDT) Received: from localhost.localdomain (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id B70B36A06A9; Thu, 26 May 2011 10:41:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1306399311; bh=sbmpolwzteB/vfVXJwj48vukpdpIDINppX6bu14zzro=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=FHInpmYSH77FLkFWH6kwpSui4V1fsxRaZ6mh3rVuDxlz+SK4trHRfhwY7VJfztC9J 0oZT0VmGNiQ17EyfzP1efFq9OnK2xbsFyM/E8MAmQTAWTKMg9f+LEJ2yvEOXecMIa2 2Y3mVKM3XXUYNsz3tYWvg/g+6eXd0cuYJ1H9gum4= From: Thomas Jost To: Carl Worth , Stewart Smith , notmuch Subject: [PATCH v2 1/4] emacs: Helpers needed for the user to be able to choose the "From" address when composing a new message Date: Thu, 26 May 2011 10:41:30 +0200 Message-Id: <1306399293-22215-1-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <87hb8hlush.fsf@thor.loria.fr> References: <87hb8hlush.fsf@thor.loria.fr> 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: Thu, 26 May 2011 08:41:53 -0000 This adds functions and variables needed for this feature to be implemented. Once it's done, the user will be able to use a prefix argument (e.g. pressing C-u m instead of m) and be able to select a From address. By default the list of names/addresses to be used during completion will be automatically generated by the settings in the notmuch configuration file. The user can customize the notmuch-identities variable to provide an alternate list. This is based on a previous patch by Carl Worth (id:"87wrhfvk6a.fsf@yoom.home.cworth.org" and follow-ups). --- emacs/notmuch-mua.el | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 003b313..2baf6bd 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -143,6 +143,29 @@ list." (message-goto-to)) +(defcustom notmuch-identities nil + "Identities that can be used as the From: address when composing a new message. + +If this variable is left unset, then a list will be constructed from the +name and addresses configured in the notmuch configuration file." + :group 'notmuch + :type '(repeat string)) + +(defun notmuch-mua-sender-collection () + (if notmuch-identities + notmuch-identities + (mapcar (lambda (address) + (concat (notmuch-user-name) " <" address ">")) + (cons (notmuch-user-primary-email) (notmuch-user-other-email))))) + +(defvar notmuch-mua-sender-history nil) + +(defun notmuch-mua-prompt-for-sender () + (interactive) + (let ((collection (notmuch-mua-sender-collection))) + (ido-completing-read "Send mail From: " collection + nil 'confirm nil 'notmuch-mua-sender-history (car collection)))) + (defun notmuch-mua-send-and-exit (&optional arg) (interactive "P") (message-send-and-exit arg)) -- 1.7.5.1