diff options
author | Basil L. Contovounesios <contovob@tcd.ie> | 2021-10-11 19:14:23 +0100 |
---|---|---|
committer | Basil L. Contovounesios <contovob@tcd.ie> | 2021-10-12 22:32:03 +0100 |
commit | bcb43fbc95ad0c635c8f19c391ec90d3f8a74035 (patch) | |
tree | 8d3c67e6e4d96c1408f35f6fe1681e28318b6b3c /lisp/mh-e/mh-utils.el | |
parent | e47b85a68339063dd3a784e8b90aecbf90b23f41 (diff) | |
download | emacs-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.el | 22 |
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)))) |