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.
This commit is contained in:
Basil L. Contovounesios 2021-03-26 17:13:59 +00:00
parent bc50644137
commit 331ddd803a
12 changed files with 27 additions and 10 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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.

View file

@ -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"))

View file

@ -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)))

View file

@ -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.

View file

@ -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))))

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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.