Avoid using aliases for color functions

* lisp/emulation/viper-init.el (viper-has-face-support-p):
* lisp/emulation/viper-util.el (viper-save-cursor-color)
(viper-change-cursor-color):
* lisp/faces.el (read-color):
* lisp/net/dictionary.el (dictionary-color-support):
* lisp/obsolete/gs.el (gs-set-ghostview-colors-window-prop):
* lisp/progmodes/cperl-mode.el (cperl-choose-color):
* lisp/woman.el (woman-fontify): Avoid using aliases for
color-defined-p, display-color-p, and color-values.
This commit is contained in:
Stefan Kangas 2022-08-09 22:28:08 +02:00
parent 06cb954ae3
commit 32d8fc999c
7 changed files with 12 additions and 12 deletions

View file

@ -71,7 +71,7 @@ In all likelihood, you don't need to bother with this setting."
(defun viper-has-face-support-p ()
(cond ((viper-window-display-p))
(viper-force-faces)
((x-display-color-p))
((display-color-p))
(t (memq window-system '(pc)))))

View file

@ -57,7 +57,7 @@
(define-obsolete-function-alias 'viper-int-to-char #'identity "27.1")
(define-obsolete-function-alias 'viper-get-face #'facep "27.1")
(define-obsolete-function-alias 'viper-color-defined-p
#'x-color-defined-p "27.1")
#'color-defined-p "27.1")
(define-obsolete-function-alias 'viper-iconify
#'iconify-or-deiconify-frame "27.1")
@ -71,7 +71,7 @@
(= char char1))
(t nil)))
(define-obsolete-function-alias 'viper-color-display-p #'x-display-color-p "29.1")
(define-obsolete-function-alias 'viper-color-display-p #'display-color-p "29.1")
(defun viper-get-cursor-color (&optional _frame)
(cdr (assoc 'cursor-color (frame-parameters))))
@ -89,8 +89,8 @@ Otherwise return the normal value."
;; cursor colors
(defun viper-change-cursor-color (new-color &optional frame)
(if (and (viper-window-display-p) (x-display-color-p)
(stringp new-color) (x-color-defined-p new-color)
(if (and (viper-window-display-p) (display-color-p)
(stringp new-color) (color-defined-p new-color)
(not (string= new-color (viper-get-cursor-color))))
(modify-frame-parameters
(or frame (selected-frame))
@ -121,9 +121,9 @@ Otherwise return the normal value."
;; By default, saves current frame cursor color before changing viper state
(defun viper-save-cursor-color (before-which-mode)
(if (and (viper-window-display-p) (x-display-color-p))
(if (and (viper-window-display-p) (display-color-p))
(let ((color (viper-get-cursor-color)))
(if (and (stringp color) (x-color-defined-p color)
(if (and (stringp color) (color-defined-p color)
;; there is something fishy in that the color is not saved if
;; it is the same as frames default cursor color. need to be
;; checked.

View file

@ -2037,7 +2037,7 @@ as backgrounds."
(setq color (background-color-at-point))))
(when (and convert-to-RGB
(not (string-equal color "")))
(let ((components (x-color-values color)))
(let ((components (color-values color)))
(unless (string-match-p "^#\\(?:[[:xdigit:]][[:xdigit:]][[:xdigit:]]\\)+$" color)
(setq color (format "#%04X%04X%04X"
(logand 65535 (nth 0 components))

View file

@ -357,7 +357,7 @@ is utf-8"
(defvar dictionary-color-support
(condition-case nil
(x-display-color-p)
(display-color-p)
(error nil))
"Determines if the Emacs has support to display color.")

View file

@ -144,7 +144,7 @@ image in pixels."
(defun gs-set-ghostview-colors-window-prop (frame pixel-colors)
"Set the `GHOSTVIEW_COLORS' environment variable depending on FRAME."
(let ((mode (cond ((x-display-color-p frame) "Color")
(let ((mode (cond ((display-color-p frame) "Color")
((x-display-grayscale-p frame) "Grayscale")
(t "Monochrome"))))
(x-change-window-property "GHOSTVIEW_COLORS"

View file

@ -98,7 +98,7 @@
(let (answer)
(while list
(or answer
(if (or (x-color-defined-p (car list))
(if (or (color-defined-p (car list))
(null (cdr list)))
(setq answer (car list))))
(setq list (cdr list)))

View file

@ -902,7 +902,7 @@ Troff emulation is experimental and largely untested.
(defcustom woman-fontify
(or (display-color-p)
(display-graphic-p)
(x-display-color-p))
(display-color-p))
"If non-nil then WoMan assumes that face support is available.
It defaults to a non-nil value if the display supports either colors
or different fonts."