summaryrefslogtreecommitdiff
path: root/lisp/mh-e/mh-utils.el
diff options
context:
space:
mode:
authorBasil L. Contovounesios <contovob@tcd.ie>2021-10-11 19:14:23 +0100
committerBasil L. Contovounesios <contovob@tcd.ie>2021-10-12 22:32:03 +0100
commitbcb43fbc95ad0c635c8f19c391ec90d3f8a74035 (patch)
tree8d3c67e6e4d96c1408f35f6fe1681e28318b6b3c /lisp/mh-e/mh-utils.el
parente47b85a68339063dd3a784e8b90aecbf90b23f41 (diff)
downloademacs-bcb43fbc95ad0c635c8f19c391ec90d3f8a74035.tar.gz
Fix byte-compilation warnings in nox builds
For discussion, see bug#51139. * lisp/edmacro.el (edmacro-fix-menu-commands): Load mwheel to pacify free variable warnings in without-x builds. * lisp/mh-e/mh-compat.el: Declare image.el functions that are not preloaded in without-x builds. * lisp/mh-e/mh-utils.el (mh--with-image-load-path): New macro. (mh-logo-display): * lisp/mh-e/mh-tool-bar.el (mh-tool-bar-folder-buttons-init) (mh-tool-bar-letter-buttons-init): Use it to pacify byte-compilation warnings about image.el definitions not preloaded without-x.
Diffstat (limited to 'lisp/mh-e/mh-utils.el')
-rw-r--r--lisp/mh-e/mh-utils.el22
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index dcfb691ff63..feebf6416fe 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -116,22 +116,32 @@ Ignores case when searching for OLD."
;;; Logo Display
+;;;###mh-autoload
+(defmacro mh--with-image-load-path (&rest body)
+ "Load `image' and eval BODY with `image-load-path' set appropriately."
+ (declare (debug t) (indent 0))
+ `(progn
+ ;; Not preloaded in without-x builds.
+ (require 'image)
+ (defvar image-load-path)
+ (declare-function image-load-path-for-library "image")
+ (let* ((load-path (image-load-path-for-library "mh-e" "mh-logo.xpm"))
+ (image-load-path (cons (car load-path) image-load-path)))
+ ,@body)))
+
(defvar mh-logo-cache nil)
;;;###mh-autoload
(defun mh-logo-display ()
"Modify mode line to display MH-E logo."
- (let* ((load-path (image-load-path-for-library "mh-e" "mh-logo.xpm"))
- (image-load-path (cons (car load-path)
- (when (boundp 'image-load-path)
- image-load-path))))
+ (mh--with-image-load-path
(add-text-properties
0 2
`(display ,(or mh-logo-cache
(setq mh-logo-cache
(mh-funcall-if-exists
- find-image '((:type xpm :ascent center
- :file "mh-logo.xpm"))))))
+ find-image '(( :type xpm :ascent center
+ :file "mh-logo.xpm" ))))))
(car mode-line-buffer-identification))))