From: Austin Clements <aclements@csail.mit.edu>
To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: jump: fix compile warning on emacs 23
Date: Mon, 22 Sep 2014 18:57:07 +0000 [thread overview]
Message-ID: <87fvfj1o1o.fsf@csail.mit.edu> (raw)
In-Reply-To: <1409824014-14622-1-git-send-email-markwalters1009@gmail.com>
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 <markwalters1009@gmail.com> 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
next prev parent reply other threads:[~2014-09-22 18:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 9:46 [PATCH] emacs: jump: fix compile warning on emacs 23 Mark Walters
2014-09-22 18:57 ` Austin Clements [this message]
2014-09-24 17:57 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fvfj1o1o.fsf@csail.mit.edu \
--to=aclements@csail.mit.edu \
--cc=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).