unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 51139@debbugs.gnu.org
Cc: Dave Gillespie <daveg@synaptics.com>, Bill Wohler <wohler@newt.com>
Subject: bug#51139: 29.0.50; MH-E and edmacro byte-compile warnings in nox builds
Date: Mon, 11 Oct 2021 22:49:24 +0100	[thread overview]
Message-ID: <87a6jfkza3.fsf@tcd.ie> (raw)
In-Reply-To: <87tuhnl0rk.fsf@tcd.ie> (Basil L. Contovounesios" via "Bug reports for GNU Emacs, the Swiss army knife of text editors's message of "Mon, 11 Oct 2021 22:17:19 +0100")

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Basil L. Contovounesios [2021-10-11 22:17 +0100] wrote:

> I assume the warnings are not important enough to install anything on
> emacs-28, so I attach a patch against master for both sets of warnings.
> WDYT?

Heh, no sooner had I submitted the patch than it already had conflicts
against master after the following change:

Remove redundant calls to 'mh-do-in-gnu-emacs'
76d75df8e7 2021-10-11 22:57:43 +0200
https://git.sv.gnu.org/cgit/emacs.git/commit/?id=76d75df8e7

So I've respun it in the attached.

-- 
Basil


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-byte-compilation-warnings-in-nox-builds.patch --]
[-- Type: text/x-diff, Size: 5595 bytes --]

From bad4d4ac2abf48ef3c31ba9172c703d1117350cd Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Mon, 11 Oct 2021 19:14:23 +0100
Subject: [PATCH] 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.
---
 lisp/edmacro.el          |  6 ++++++
 lisp/mh-e/mh-compat.el   |  4 ++++
 lisp/mh-e/mh-tool-bar.el | 12 ++----------
 lisp/mh-e/mh-utils.el    | 24 ++++++++++++++++++------
 4 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index e90b3a006e..a4eb574a4c 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -604,6 +604,12 @@ edmacro-sanitize-for-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)
diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el
index 839379857f..561e2ec7c8 100644
--- a/lisp/mh-e/mh-compat.el
+++ b/lisp/mh-e/mh-compat.el
@@ -87,9 +87,13 @@ 'mh-face-background
 (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")
 
diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el
index 06b94b6bf8..88e5c0e7bb 100644
--- a/lisp/mh-e/mh-tool-bar.el
+++ b/lisp/mh-e/mh-tool-bar.el
@@ -213,11 +213,7 @@ mh-tool-bar-define
        ;; 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)
@@ -236,11 +232,7 @@ mh-tool-bar-define
                      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)
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index 4f211c1286..3f1bcbdcc0 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -119,22 +119,34 @@ mh-replace-string
 
 ;;; 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)
+                                   (and (boundp 'image-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
-- 
2.33.0


  reply	other threads:[~2021-10-11 21:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 21:17 bug#51139: 29.0.50; MH-E and edmacro byte-compile warnings in nox builds Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-11 21:49 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-10-12  0:21   ` Stefan Kangas
2021-10-12 12:41     ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-12 15:59       ` Stefan Kangas
2021-10-24 22:57     ` Bill Wohler
2021-10-12 12:46 ` Lars Ingebrigtsen
2021-10-12 21:51   ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-12 13:06 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6jfkza3.fsf@tcd.ie \
    --to=bug-gnu-emacs@gnu.org \
    --cc=51139@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=daveg@synaptics.com \
    --cc=wohler@newt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).