]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix byte-compilation warnings in nox builds
authorBasil L. Contovounesios <contovob@tcd.ie>
Mon, 11 Oct 2021 18:14:23 +0000 (19:14 +0100)
committerBasil L. Contovounesios <contovob@tcd.ie>
Tue, 12 Oct 2021 21:32:03 +0000 (22:32 +0100)
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.

lisp/edmacro.el
lisp/mh-e/mh-compat.el
lisp/mh-e/mh-tool-bar.el
lisp/mh-e/mh-utils.el

index e90b3a006efb43fda1250a281ea8dd66b4238151..a4eb574a4c2d535c73624a2eb34a92415de875da 100644 (file)
@@ -604,6 +604,12 @@ This function assumes that the events can be stored in a string."
 (defun edmacro-fix-menu-commands (macro &optional noerror)
   (if (vectorp macro)
       (let (result)
+        ;; Not preloaded in without-x builds.
+        (require 'mwheel)
+        (defvar mouse-wheel-down-event)
+        (defvar mouse-wheel-left-event)
+        (defvar mouse-wheel-right-event)
+        (defvar mouse-wheel-up-event)
        ;; Make a list of the elements.
        (setq macro (append macro nil))
        (dolist (ev macro)
index 1c36c27bbf574d4f7243936bf270343b3be76a72..19be5afd790ceffed8d9b93185c02cc20ca3262d 100644 (file)
@@ -83,9 +83,13 @@ the completions."
 (define-obsolete-function-alias 'mh-font-lock-add-keywords
   #'font-lock-add-keywords "29.1")
 
+;; Not preloaded in without-x builds.
+(declare-function image-load-path-for-library "image")
 (define-obsolete-function-alias 'mh-image-load-path-for-library
   #'image-load-path-for-library "29.1")
 
+;; Not preloaded in without-x builds.
+(declare-function image-search-load-path "image")
 (define-obsolete-function-alias 'mh-image-search-load-path
   #'image-search-load-path "29.1")
 
index ca08cc3b35dddeabd595bb6879a4980424813bf3..0200d232c332c4b53cab62121015c2d6de5aa1a3 100644 (file)
@@ -211,11 +211,7 @@ where,
        ;; Tool bar initialization functions
        (defun mh-tool-bar-folder-buttons-init ()
          (when (mh-buffer-exists-p 'mh-folder-mode)
-           (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
              (setq mh-folder-tool-bar-map
                    (let ((tool-bar-map (make-sparse-keymap)))
                      ,@(nreverse folder-button-setter)
@@ -234,11 +230,7 @@ where,
                      tool-bar-map)))))
        (defun mh-tool-bar-letter-buttons-init ()
          (when (mh-buffer-exists-p 'mh-letter-mode)
-           (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
              (setq mh-letter-tool-bar-map
                    (let ((tool-bar-map (make-sparse-keymap)))
                      ,@(nreverse letter-button-setter)
index dcfb691ff63dabe2feb809b0b6d942f9f9328c06..feebf6416fec9340056ea21e5d1d8c04ad43b376 100644 (file)
@@ -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))))
 
 \f