aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBasil L. Contovounesios2021-10-11 19:14:23 +0100
committerBasil L. Contovounesios2021-10-12 22:32:03 +0100
commitbcb43fbc95ad0c635c8f19c391ec90d3f8a74035 (patch)
tree8d3c67e6e4d96c1408f35f6fe1681e28318b6b3c
parente47b85a68339063dd3a784e8b90aecbf90b23f41 (diff)
downloademacs-bcb43fbc95ad0c635c8f19c391ec90d3f8a74035.tar.gz
emacs-bcb43fbc95ad0c635c8f19c391ec90d3f8a74035.zip
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.
-rw-r--r--lisp/edmacro.el6
-rw-r--r--lisp/mh-e/mh-compat.el4
-rw-r--r--lisp/mh-e/mh-tool-bar.el12
-rw-r--r--lisp/mh-e/mh-utils.el22
4 files changed, 28 insertions, 16 deletions
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index e90b3a006ef..a4eb574a4c2 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -604,6 +604,12 @@ This function assumes that the events can be stored in a string."
604(defun edmacro-fix-menu-commands (macro &optional noerror) 604(defun edmacro-fix-menu-commands (macro &optional noerror)
605 (if (vectorp macro) 605 (if (vectorp macro)
606 (let (result) 606 (let (result)
607 ;; Not preloaded in without-x builds.
608 (require 'mwheel)
609 (defvar mouse-wheel-down-event)
610 (defvar mouse-wheel-left-event)
611 (defvar mouse-wheel-right-event)
612 (defvar mouse-wheel-up-event)
607 ;; Make a list of the elements. 613 ;; Make a list of the elements.
608 (setq macro (append macro nil)) 614 (setq macro (append macro nil))
609 (dolist (ev macro) 615 (dolist (ev macro)
diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el
index 1c36c27bbf5..19be5afd790 100644
--- a/lisp/mh-e/mh-compat.el
+++ b/lisp/mh-e/mh-compat.el
@@ -83,9 +83,13 @@ the completions."
83(define-obsolete-function-alias 'mh-font-lock-add-keywords 83(define-obsolete-function-alias 'mh-font-lock-add-keywords
84 #'font-lock-add-keywords "29.1") 84 #'font-lock-add-keywords "29.1")
85 85
86;; Not preloaded in without-x builds.
87(declare-function image-load-path-for-library "image")
86(define-obsolete-function-alias 'mh-image-load-path-for-library 88(define-obsolete-function-alias 'mh-image-load-path-for-library
87 #'image-load-path-for-library "29.1") 89 #'image-load-path-for-library "29.1")
88 90
91;; Not preloaded in without-x builds.
92(declare-function image-search-load-path "image")
89(define-obsolete-function-alias 'mh-image-search-load-path 93(define-obsolete-function-alias 'mh-image-search-load-path
90 #'image-search-load-path "29.1") 94 #'image-search-load-path "29.1")
91 95
diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el
index ca08cc3b35d..0200d232c33 100644
--- a/lisp/mh-e/mh-tool-bar.el
+++ b/lisp/mh-e/mh-tool-bar.el
@@ -211,11 +211,7 @@ where,
211 ;; Tool bar initialization functions 211 ;; Tool bar initialization functions
212 (defun mh-tool-bar-folder-buttons-init () 212 (defun mh-tool-bar-folder-buttons-init ()
213 (when (mh-buffer-exists-p 'mh-folder-mode) 213 (when (mh-buffer-exists-p 'mh-folder-mode)
214 (let* ((load-path (image-load-path-for-library "mh-e" 214 (mh--with-image-load-path
215 "mh-logo.xpm"))
216 (image-load-path (cons (car load-path)
217 (when (boundp 'image-load-path)
218 image-load-path))))
219 (setq mh-folder-tool-bar-map 215 (setq mh-folder-tool-bar-map
220 (let ((tool-bar-map (make-sparse-keymap))) 216 (let ((tool-bar-map (make-sparse-keymap)))
221 ,@(nreverse folder-button-setter) 217 ,@(nreverse folder-button-setter)
@@ -234,11 +230,7 @@ where,
234 tool-bar-map))))) 230 tool-bar-map)))))
235 (defun mh-tool-bar-letter-buttons-init () 231 (defun mh-tool-bar-letter-buttons-init ()
236 (when (mh-buffer-exists-p 'mh-letter-mode) 232 (when (mh-buffer-exists-p 'mh-letter-mode)
237 (let* ((load-path (image-load-path-for-library "mh-e" 233 (mh--with-image-load-path
238 "mh-logo.xpm"))
239 (image-load-path (cons (car load-path)
240 (when (boundp 'image-load-path)
241 image-load-path))))
242 (setq mh-letter-tool-bar-map 234 (setq mh-letter-tool-bar-map
243 (let ((tool-bar-map (make-sparse-keymap))) 235 (let ((tool-bar-map (make-sparse-keymap)))
244 ,@(nreverse letter-button-setter) 236 ,@(nreverse letter-button-setter)
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."
116 116
117;;; Logo Display 117;;; Logo Display
118 118
119;;;###mh-autoload
120(defmacro mh--with-image-load-path (&rest body)
121 "Load `image' and eval BODY with `image-load-path' set appropriately."
122 (declare (debug t) (indent 0))
123 `(progn
124 ;; Not preloaded in without-x builds.
125 (require 'image)
126 (defvar image-load-path)
127 (declare-function image-load-path-for-library "image")
128 (let* ((load-path (image-load-path-for-library "mh-e" "mh-logo.xpm"))
129 (image-load-path (cons (car load-path) image-load-path)))
130 ,@body)))
131
119(defvar mh-logo-cache nil) 132(defvar mh-logo-cache nil)
120 133
121;;;###mh-autoload 134;;;###mh-autoload
122(defun mh-logo-display () 135(defun mh-logo-display ()
123 "Modify mode line to display MH-E logo." 136 "Modify mode line to display MH-E logo."
124 (let* ((load-path (image-load-path-for-library "mh-e" "mh-logo.xpm")) 137 (mh--with-image-load-path
125 (image-load-path (cons (car load-path)
126 (when (boundp 'image-load-path)
127 image-load-path))))
128 (add-text-properties 138 (add-text-properties
129 0 2 139 0 2
130 `(display ,(or mh-logo-cache 140 `(display ,(or mh-logo-cache
131 (setq mh-logo-cache 141 (setq mh-logo-cache
132 (mh-funcall-if-exists 142 (mh-funcall-if-exists
133 find-image '((:type xpm :ascent center 143 find-image '(( :type xpm :ascent center
134 :file "mh-logo.xpm")))))) 144 :file "mh-logo.xpm" ))))))
135 (car mode-line-buffer-identification)))) 145 (car mode-line-buffer-identification))))
136 146
137 147