Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id A9C076DE1992 for ; Sat, 2 Jan 2016 08:48:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -1.605 X-Spam-Level: X-Spam-Status: No, score=-1.605 tagged_above=-999 required=5 tests=[AWL=1.245, RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.55] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AUFG7pGFr14q for ; Sat, 2 Jan 2016 08:47:58 -0800 (PST) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by arlo.cworth.org (Postfix) with ESMTP id 857D36DE1962 for ; Sat, 2 Jan 2016 08:47:58 -0800 (PST) Received: from localhost (unknown [192.168.200.7]) by max.feld.cvut.cz (Postfix) with ESMTP id 6964219F48CD for ; Sat, 2 Jan 2016 17:47:56 +0100 (CET) X-Virus-Scanned: IMAP STYX AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044) with ESMTP id wA04puoL6EMA for ; Sat, 2 Jan 2016 17:47:54 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 7F86519F48D2 for ; Sat, 2 Jan 2016 17:47:53 +0100 (CET) Received: from wsh by steelpick.2x.cz with local (Exim 4.86) (envelope-from ) id 1aFPLM-0007BI-6x; Sat, 02 Jan 2016 17:47:52 +0100 From: Michal Sojka To: notmuch@notmuchmail.org Subject: [PATCH 2/3] emacs: Refactor notmuch-mua-mail Date: Sat, 2 Jan 2016 17:47:44 +0100 Message-Id: <1451753265-26713-3-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1451753265-26713-1-git-send-email-sojkam1@fel.cvut.cz> References: <1451753265-26713-1-git-send-email-sojkam1@fel.cvut.cz> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 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, 02 Jan 2016 16:48:01 -0000 This should be more readable. --- emacs/notmuch-mua.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index d4950cb..2d6825d 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -320,24 +320,24 @@ modified. This function is notmuch addaptation of (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers)) (notmuch-mua-pop-to-buffer (message-buffer-name "mail" to)) - (let ((args (list yank-action send-actions))) + (let ((headers + ;; The following sexp is copied from `message-mail' + (nconc + `((To . ,(or to "")) (Subject . ,(or subject ""))) + ;; C-h f compose-mail says that headers should be specified as + ;; (string . value); however all the rest of message expects + ;; headers to be symbols, not strings (eg message-header-format-alist). + ;; http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00337.html + ;; We need to convert any string input, eg from rmail-start-mail. + (dolist (h other-headers other-headers) + (if (stringp (car h)) (setcar h (intern (capitalize (car h)))))))) + (args (list yank-action send-actions))) ;; message-setup-1 in Emacs 23 does not accept return-action ;; argument. Pass it only if it is supplied by the caller. This ;; will never be the case when we're called by `compose-mail' in ;; Emacs 23. (when return-action (nconc args '(return-action))) - (apply 'message-setup-1 - ;; The following sexp is copied from `message-mail' - (nconc - `((To . ,(or to "")) (Subject . ,(or subject ""))) - ;; C-h f compose-mail says that headers should be specified as - ;; (string . value); however all the rest of message expects - ;; headers to be symbols, not strings (eg message-header-format-alist). - ;; http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00337.html - ;; We need to convert any string input, eg from rmail-start-mail. - (dolist (h other-headers other-headers) - (if (stringp (car h)) (setcar h (intern (capitalize (car h))))))) - args)) + (apply 'message-setup-1 headers args)) (notmuch-fcc-header-setup) (message-sort-headers) (message-hide-headers) -- 2.6.4