Re: [PATCH] emacs: jump: fix compile warning on emacs 23
authorAustin Clements <aclements@csail.mit.edu>
Mon, 22 Sep 2014 18:57:07 +0000 (18:57 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:04:41 +0000 (10:04 -0800)
db/eff9d999f725eedc8fb92f811405bb961c50b6 [new file with mode: 0644]

diff --git a/db/eff9d999f725eedc8fb92f811405bb961c50b6 b/db/eff9d999f725eedc8fb92f811405bb961c50b6
new file mode 100644 (file)
index 0000000..019c30a
--- /dev/null
@@ -0,0 +1,122 @@
+Return-Path: <aclements@csail.mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 11125431E64\r
+       for <notmuch@notmuchmail.org>; Mon, 22 Sep 2014 11:57:12 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id yJvS-w2GD3jM for <notmuch@notmuchmail.org>;\r
+       Mon, 22 Sep 2014 11:57:08 -0700 (PDT)\r
+Received: from outgoing.csail.mit.edu (outgoing.csail.mit.edu [128.30.2.149])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8A75C431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 22 Sep 2014 11:57:08 -0700 (PDT)\r
+Received: from [104.131.20.129] (helo=awakeningjr)\r
+       by outgoing.csail.mit.edu with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16)\r
+       (Exim 4.72) (envelope-from <aclements@csail.mit.edu>)\r
+       id 1XW8nM-0007El-2D; Mon, 22 Sep 2014 14:57:08 -0400\r
+Received: from amthrax by awakeningjr with local (Exim 4.84)\r
+       (envelope-from <aclements@csail.mit.edu>)\r
+       id 1XW8nL-00079Z-EA; Mon, 22 Sep 2014 18:57:07 +0000\r
+From: Austin Clements <aclements@csail.mit.edu>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: jump: fix compile warning on emacs 23\r
+In-Reply-To: <1409824014-14622-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1409824014-14622-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 22 Sep 2014 18:57:07 +0000\r
+Message-ID: <87fvfj1o1o.fsf@csail.mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 22 Sep 2014 18:57:12 -0000\r
+\r
+LGTM.  I'm a little surprised this is necessary, but whatever.\r
+\r
+I think the eval-and-compile has to be top-level; it's certainly not\r
+wrong for it to be top-level.  (I like the comment in the\r
+eval-and-compile implementation: ";; Remember, it's magic.")\r
+\r
+On Thu, 04 Sep 2014, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> notmuch-jump uses window-body-width which is not defined in emacs\r
+> 23. To get around this it does\r
+>\r
+> (unless (fboundp 'window-body-width)\r
+>   ;; Compatibility for Emacs pre-24\r
+>   (defalias 'window-body-width 'window-width))\r
+>\r
+> This makes sure window-body-width is defined and all should be\r
+> well. But it seems that the byte compiler does not realise that this\r
+> guarantees that window-body-width will be defined and so, when\r
+> compiling with emacs 23, it gives an error\r
+>\r
+> In end of data:\r
+> notmuch-jump.el:172:1:Warning: the function `window-body-width' is not known to be defined.\r
+>\r
+> Domo and I came to following on irc: wrap the (unless (fboundp ...))\r
+> inside eval-and-compile which ensures that both the test and the\r
+> defalias (if needed) happen at both compile and load time.  This fixes\r
+> the warning.\r
+> ---\r
+> I think Domo and I were both not completely sure whether the\r
+> eval-and-compile should be inside or outside the (unless fboundp ..)\r
+> or not (ie should it wrap the unless fboundp or just the defalias) nor\r
+> whether it should be eval-and-compile or eval-when-compile.\r
+>\r
+> We think this is the right version but it would be good to have confirmation.\r
+>\r
+> I tested notmuch jump inside emacs 23 and 24 with notmuch-emacs\r
+> compiled with emacs 23 or 24 (ie all four combinations) and it seemed to work.\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+>\r
+>\r
+>  emacs/notmuch-jump.el |    7 ++++---\r
+>  1 file changed, 4 insertions(+), 3 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el\r
+> index 5eb0949..2706b6c 100644\r
+> --- a/emacs/notmuch-jump.el\r
+> +++ b/emacs/notmuch-jump.el\r
+> @@ -25,9 +25,10 @@\r
+>  (require 'notmuch-lib)\r
+>  (require 'notmuch-hello)\r
+>  \r
+> -(unless (fboundp 'window-body-width)\r
+> -  ;; Compatibility for Emacs pre-24\r
+> -  (defalias 'window-body-width 'window-width))\r
+> +(eval-and-compile\r
+> +  (unless (fboundp 'window-body-width)\r
+> +    ;; Compatibility for Emacs pre-24\r
+> +    (defalias 'window-body-width 'window-width)))\r
+>  \r
+>  ;;;###autoload\r
+>  (defun notmuch-jump-search ()\r
+> -- \r
+> 1.7.10.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r