]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: jump: fix compile warning on emacs 23
authorMark Walters <markwalters1009@gmail.com>
Thu, 4 Sep 2014 09:46:54 +0000 (10:46 +0100)
committerDavid Bremner <david@tethera.net>
Wed, 24 Sep 2014 17:55:36 +0000 (19:55 +0200)
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.

emacs/notmuch-jump.el

index 0193f8cd7064436efb73f13da4ea798668cbfef0..05ec57ec5e13aeb2071f5a2a9282ad63bb3af793 100644 (file)
 (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 ()