From: Basil L. Contovounesios Date: Fri, 26 Mar 2021 17:13:59 +0000 (+0000) Subject: Address some --without-x byte-compilation warnings X-Git-Tag: emacs-28.0.90~3133 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=331ddd803a72056d0f0c70e5a677e0d4a6300584;p=emacs.git 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. --- diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el index c1c17723a44..0b152784252 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 8f90ed28260..50979c4dbb3 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 151aefb47a3..2b6e4a60b83 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 f80243cfedb..e558f639e46 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 93e1c47be70..f06959f65d9 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 4ede1fbf375..b802c1c906f 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 d97d090cd08..a0063c8dbb6 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 5ffba8fe1a8..fec2293ff1f 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 76b1ef37640..420cf82e4d8 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 d778cc17615..29c92d52dd8 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 ac6691db0d5..58d3fd39922 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 e8451930133..687250fe46e 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.