emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 331ddd8: Address some --without-x byte-compilation warnings


From: Basil L. Contovounesios
Subject: master 331ddd8: Address some --without-x byte-compilation warnings
Date: Fri, 26 Mar 2021 13:39:49 -0400 (EDT)

branch: master
commit 331ddd803a72056d0f0c70e5a677e0d4a6300584
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Address some --without-x byte-compilation warnings
    
    These came to light in the contexts of bug#29713 and bug#47234.
    
    * lisp/emulation/edt-mapper.el (edt-xserver):
    * lisp/emulation/edt.el (edt-xserver):
    * lisp/gnus/gnus-util.el (gnus-rescale-image):
    * lisp/gnus/nnimap.el (nnimap-map-port):
    * lisp/term/w32-win.el:
    * lisp/image.el (image--get-imagemagick-and-warn):
    * lisp/frame.el (frame-notice-user-settings): Declare functions that
    are known to be present at runtime in GUI builds.
    (make-frame-on-display): Signal more informative error when called
    interactively in a non-GUI build (bug#29713).
    * lisp/international/mule-diag.el (describe-font):
    * lisp/org/org-macs.el (org--string-from-props): Pacify warnings
    about unknown functions in non-GUI bilds.
    * lisp/mh-e/mh-mime.el (mh-small-image-p): Avoid eliminating fboundp
    check in non-GUI builds, to pacify unused lexical variable warning.
    * lisp/net/newst-plainview.el (newsticker--plainview-tool-bar-map):
    * lisp/net/newst-treeview.el (newsticker-treeview-tool-bar-map):
    Declare tool-bar-map as a special variable in non-GUI builds.
---
 lisp/emulation/edt-mapper.el    | 2 ++
 lisp/emulation/edt.el           | 2 ++
 lisp/frame.el                   | 9 ++++++---
 lisp/gnus/gnus-util.el          | 8 ++++----
 lisp/gnus/nnimap.el             | 1 +
 lisp/image.el                   | 1 +
 lisp/international/mule-diag.el | 2 ++
 lisp/mh-e/mh-mime.el            | 4 ++--
 lisp/net/newst-plainview.el     | 1 +
 lisp/net/newst-treeview.el      | 1 +
 lisp/org/org-macs.el            | 3 ++-
 lisp/term/w32-win.el            | 3 +++
 12 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el
index c1c1772..0b15278 100644
--- a/lisp/emulation/edt-mapper.el
+++ b/lisp/emulation/edt-mapper.el
@@ -101,6 +101,8 @@
 (define-obsolete-variable-alias 'edt-window-system 'window-system "27.1")
 
 (defconst edt-xserver (when (eq window-system 'x)
+                        (declare-function x-server-vendor "xfns.c"
+                                          (&optional terminal))
                        ;; The Cygwin window manager has a `/' in its
                        ;; name, which breaks the generated file name of
                        ;; the custom key map file.  Replace `/' with a
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index 8f90ed2..50979c4 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -299,6 +299,8 @@ This means that an edt-user.el file was found in the user's 
`load-path'.")
 ;;;     o edt-emulation-on      o edt-load-keys
 ;;;
 (defconst edt-xserver (when (eq window-system 'x)
+                        (declare-function x-server-vendor "xfns.c"
+                                          (&optional terminal))
                        ;; The Cygwin window manager has a `/' in its
                        ;; name, which breaks the generated file name of
                        ;; the custom key map file.  Replace `/' with a
diff --git a/lisp/frame.el b/lisp/frame.el
index 151aefb..2b6e4a6 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -367,6 +367,7 @@ there (in decreasing order of priority)."
       ;; by the lines added in x-create-frame for the tab-bar and
       ;; switch `tab-bar-mode' off.
       (when (display-graphic-p)
+        (declare-function tab-bar-height "xdisp.c" (&optional frame pixelwise))
        (let* ((init-lines
                (assq 'tab-bar-lines initial-frame-alist))
               (other-lines
@@ -708,9 +709,11 @@ Return nil if we don't know how to interpret DISPLAY."
 (defun make-frame-on-display (display &optional parameters)
   "Make a frame on display DISPLAY.
 The optional argument PARAMETERS specifies additional frame parameters."
-  (interactive (list (completing-read
-                      (format "Make frame on display: ")
-                      (x-display-list))))
+  (interactive (if (fboundp 'x-display-list)
+                   (list (completing-read
+                          (format "Make frame on display: ")
+                          (x-display-list)))
+                 (user-error "This Emacs build does not support X displays")))
   (make-frame (cons (cons 'display display) parameters)))
 
 (defun make-frame-on-current-monitor (&optional parameters)
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index f80243c..e558f63 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1612,8 +1612,8 @@ empty directories from OLD-PATH."
   "Rescale IMAGE to SIZE if possible.
 SIZE is in format (WIDTH . HEIGHT).  Return a new image.
 Sizes are in pixels."
-  (if (not (display-graphic-p))
-      image
+  (when (display-images-p)
+    (declare-function image-size "image.c" (spec &optional pixels frame))
     (let ((new-width (car size))
           (new-height (cdr size)))
       (when (> (cdr (image-size image t)) new-height)
@@ -1621,8 +1621,8 @@ Sizes are in pixels."
                                   :max-height new-height)))
       (when (> (car (image-size image t)) new-width)
        (setq image (create-image (plist-get (cdr image) :data) nil t
-                                  :max-width new-width)))
-      image)))
+                                  :max-width new-width)))))
+  image)
 
 (defun gnus-recursive-directory-files (dir)
   "Return all regular files below DIR.
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 93e1c47..f06959f 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -440,6 +440,7 @@ during splitting, which may be slow."
 
 ;; This is only needed for Windows XP or earlier
 (defun nnimap-map-port (port)
+  (declare-function x-server-version "xfns.c" (&optional terminal))
   (if (and (eq system-type 'windows-nt)
            (<= (car (x-server-version)) 5)
            (equal port "imaps"))
diff --git a/lisp/image.el b/lisp/image.el
index 4ede1fb..b802c1c 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -1130,6 +1130,7 @@ default is 20%."
     image))
 
 (defun image--get-imagemagick-and-warn (&optional position)
+  (declare-function image-transforms-p "image.c" (&optional frame))
   (unless (or (fboundp 'imagemagick-types) (image-transforms-p))
     (error "Cannot rescale images on this terminal"))
   (let ((image (image--get-image position)))
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index d97d090..a0063c8 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -835,6 +835,8 @@ The IGNORED argument is ignored."
    (list (completing-read
           "Font name (default current choice for ASCII chars): "
           (and window-system
+               ;; Implied by `window-system'.
+               (fboundp 'x-list-fonts)
                (fboundp 'fontset-list)
                ;; The final element in `fontset-list' is a default
                ;; (generic) one, so don't include that.
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index 5ffba8f..fec2293 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -777,7 +777,7 @@ This is only useful if a Content-Disposition header is not 
present."
          (funcall media-test handle) ; Since mm-inline-large-images is T,
                                         ; this only tells us if the image is
                                         ; something that emacs can display
-         (let* ((image (mm-get-image handle)))
+         (let ((image (mm-get-image handle)))
            (or (mh-do-in-xemacs
                  (and (mh-funcall-if-exists glyphp image)
                       (< (glyph-width image)
@@ -786,7 +786,7 @@ This is only useful if a Content-Disposition header is not 
present."
                          (or mh-max-inline-image-height
                              (window-pixel-height)))))
                (mh-do-in-gnu-emacs
-                 (let ((size (mh-funcall-if-exists image-size image)))
+                 (let ((size (and (fboundp 'image-size) (image-size image))))
                    (and size
                         (< (cdr size) (or mh-max-inline-image-height
                                           (1- (window-height))))
diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el
index 76b1ef3..420cf82 100644
--- a/lisp/net/newst-plainview.el
+++ b/lisp/net/newst-plainview.el
@@ -273,6 +273,7 @@ images."
 
 (defvar newsticker--plainview-tool-bar-map
   (when (boundp 'tool-bar-map)
+    (defvar tool-bar-map)
     (let ((tool-bar-map (make-sparse-keymap)))
       (tool-bar-add-item "newsticker/prev-feed"
                          'newsticker-previous-feed
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index d778cc1..29c92d5 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -1102,6 +1102,7 @@ Arguments are ignored."
 ;; ======================================================================
 (defvar newsticker-treeview-tool-bar-map
   (when (boundp 'tool-bar-map)
+    (defvar tool-bar-map)
     (let ((tool-bar-map (make-sparse-keymap)))
       (tool-bar-add-item "newsticker/prev-feed"
                          'newsticker-treeview-prev-feed
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index ac6691d..58d3fd3 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -869,7 +869,8 @@ delimiting S."
                    (let ((width (plist-get props :width)))
                      (and (wholenump width) width)))
                   (`(image . ,_)
-                   (ceiling (car (image-size spec))))
+                    (and (fboundp 'image-size)
+                         (ceiling (car (image-size spec)))))
                   ((pred stringp)
                    ;; Displayed string could contain invisible parts,
                    ;; but no nested display.
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index e845193..687250f 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -555,6 +555,9 @@ be found in this alist.
 This alist is used by w32font.c when it looks for fonts that can display
 characters from scripts for which no USBs are defined.")
 
+(declare-function x-list-fonts "xfaces.c"
+                  (pattern &optional face frame maximum width))
+
 (defun w32-find-non-USB-fonts (&optional frame size)
   "Compute the value of `w32-non-USB-fonts' for specified SIZE and FRAME.
 FRAME defaults to the selected frame.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]