--- /dev/null
+Return-Path: <david@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 129BC6DE1601\r
+ for <notmuch@notmuchmail.org>; Wed, 30 Dec 2015 07:22:16 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.312\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.312 tagged_above=-999 required=5 tests=[AWL=0.239,\r
+ RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id fqSVquFYDfIZ for <notmuch@notmuchmail.org>;\r
+ Wed, 30 Dec 2015 07:22:14 -0800 (PST)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 566B76DE14A8\r
+ for <notmuch@notmuchmail.org>; Wed, 30 Dec 2015 07:22:14 -0800 (PST)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1aEIZg-00074a-CV; Wed, 30 Dec 2015 10:22:04 -0500\r
+Received: (nullmailer pid 5772 invoked by uid 1000);\r
+ Wed, 30 Dec 2015 15:22:09 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Michal Sojka <sojkam1@fel.cvut.cz>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2] emacs: Improve notmuch-message-mode initialization\r
+In-Reply-To: <1450690875-2111-2-git-send-email-sojkam1@fel.cvut.cz>\r
+References: <1450690875-2111-1-git-send-email-sojkam1@fel.cvut.cz>\r
+ <1450690875-2111-2-git-send-email-sojkam1@fel.cvut.cz>\r
+User-Agent: Notmuch/0.21+26~g9404723 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Wed, 30 Dec 2015 11:22:09 -0400\r
+Message-ID: <87y4cc3qse.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 30 Dec 2015 15:22:16 -0000\r
+\r
+Michal Sojka <sojkam1@fel.cvut.cz> writes:\r
+\r
+> Recent addition of notmuch-message-mode introduced several problems:\r
+>\r
+> 1. When message-setup-hook is used to set buffer local variables,\r
+> these settings are not effective, because all buffer local\r
+> variables are immediately erased by notmuch-message-mode\r
+> initialization.\r
+>\r
+> 2. message-mode-hook gets invoked twice - first when message-mail\r
+> invokes message-mode and second when notmuch-mua-mail invokes\r
+> notmuch-message-mode.\r
+>\r
+> This commit fixes these problems by replacing a call to message-mail\r
+> with notmuch-specific code that is (hopefully) equivalent to\r
+> message-mail functionality before introduction of\r
+> notmuch-message-mode.\r
+>\r
+> We first initialize notmuch-message-mode with\r
+> notmuch-mua-pop-to-buffer, which is a modified version of\r
+> message-pop-to-buffer and then call message-setup-1, which is the only\r
+> functionality of message-mail that is needed for notmuch.\r
+\r
+This doesn't break anything for me, and looks fairly sane. I'm not sure\r
+if the indirectrion of notmuch-mua-get-switch-function is still needed,\r
+but that can wait for an optional followup patch. \r