From: Mark Walters Date: Thu, 4 Sep 2014 09:46:54 +0000 (+0100) Subject: [PATCH] emacs: jump: fix compile warning on emacs 23 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=78058f16498413e1d6138373a7ea52850aab825f;p=notmuch-archives.git [PATCH] emacs: jump: fix compile warning on emacs 23 --- diff --git a/68/579fb70f5095fc73b97221892e4e57c67a82e5 b/68/579fb70f5095fc73b97221892e4e57c67a82e5 new file mode 100644 index 000000000..ac5d45c07 --- /dev/null +++ b/68/579fb70f5095fc73b97221892e4e57c67a82e5 @@ -0,0 +1,121 @@ +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 1C410431FB6 + for ; Thu, 4 Sep 2014 02:47:15 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] 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 Fx2AR21aKl9E for ; + Thu, 4 Sep 2014 02:47:09 -0700 (PDT) +Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com + [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 68A86431FAF + for ; Thu, 4 Sep 2014 02:47:09 -0700 (PDT) +Received: by mail-wi0-f181.google.com with SMTP id e4so732668wiv.14 + for ; Thu, 04 Sep 2014 02:47:08 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id; + bh=o6wkQIVWoJOu5Yz85J6lk1cJ5+japQL2mX9qmM176A0=; + b=VCxSdHqmip5vdGL5G/kh9nE84a8VpaY6KEL7HPhkGWEYzb9H65f+7g6Eo7QwNUR6B3 + 5kN8onhEs+eiNOtorERXxHcs342udFK9PRhxswmAgfVJK7UijNRbrt0HipE9JoTskxRQ + a2bKZSD0Iv3VLw9aH0M3K20AVSdJVy9ko5cEc++wl8fEUkzPX0hG6T02ybw5C5dYJ35f + pa03O54tp6uPIMmPb4k3YZ22t6gUdb1HQagmpC7cS0AVKosaa4LK0pVhh6CCJh7c1OQF + BWRfol61lu2NoYTzi4cfP5fdhOYFhzu8VH1byGu9NILo2d/btIs7LzDejO+6b2NGnXc0 + vgfA== +X-Received: by 10.194.157.135 with SMTP id wm7mr4395162wjb.117.1409824027024; + Thu, 04 Sep 2014 02:47:07 -0700 (PDT) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by mx.google.com with ESMTPSA id s1sm792000wiw.6.2014.09.04.02.47.05 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Thu, 04 Sep 2014 02:47:06 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: jump: fix compile warning on emacs 23 +Date: Thu, 4 Sep 2014 10:46:54 +0100 +Message-Id: <1409824014-14622-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.10.4 +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: Thu, 04 Sep 2014 09:47:15 -0000 + +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 +