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