[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ement 6fc2908868 15/19: Tidy: Compilation warning
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ement 6fc2908868 15/19: Tidy: Compilation warning |
Date: |
Mon, 14 Aug 2023 03:58:03 -0400 (EDT) |
branch: externals/ement
commit 6fc290886832f6bef914eb46155e08f08ef1d5f0
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Tidy: Compilation warning
---
ement-lib.el | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/ement-lib.el b/ement-lib.el
index 3b1024e6fd..8bfad5e1fd 100644
--- a/ement-lib.el
+++ b/ement-lib.el
@@ -95,7 +95,7 @@ that stray such forms don't remain if the function is
removed."
;; Copied from Emacs 28. See
<https://github.com/alphapapa/ement.el/issues/99>.
-;; FIXME: Remove this workaround when possible.
+;; TODO(future): Remove these workarounds when dropping support for Emacs <28.
(eval-and-compile
(unless (boundp 'color-luminance-dark-limit)
@@ -108,27 +108,28 @@ determined experimentally.")))
(defalias 'ement--color-dark-p
(if (fboundp 'color-dark-p)
'color-dark-p
- (lambda (rgb)
- "Whether RGB is more readable against white than black.
+ (with-suppressed-warnings ((free-vars ement--color-luminance-dark-limit))
+ (lambda (rgb)
+ "Whether RGB is more readable against white than black.
RGB is a 3-element list (R G B), each component in the range [0,1].
This predicate can be used both for determining a suitable (black or white)
contrast colour with RGB as background and as foreground."
- (unless (<= 0 (apply #'min rgb) (apply #'max rgb) 1)
- (error "RGB components %S not in [0,1]" rgb))
- ;; Compute the relative luminance after gamma-correcting (assuming sRGB),
- ;; and compare to a cut-off value determined experimentally.
- ;; See https://en.wikipedia.org/wiki/Relative_luminance for details.
- (let* ((sr (nth 0 rgb))
- (sg (nth 1 rgb))
- (sb (nth 2 rgb))
- ;; Gamma-correct the RGB components to linear values.
- ;; Use the power 2.2 as an approximation to sRGB gamma;
- ;; it should be good enough for the purpose of this function.
- (r (expt sr 2.2))
- (g (expt sg 2.2))
- (b (expt sb 2.2))
- (y (+ (* r 0.2126) (* g 0.7152) (* b 0.0722))))
- (< y ement--color-luminance-dark-limit)))))
+ (unless (<= 0 (apply #'min rgb) (apply #'max rgb) 1)
+ (error "RGB components %S not in [0,1]" rgb))
+ ;; Compute the relative luminance after gamma-correcting (assuming
sRGB),
+ ;; and compare to a cut-off value determined experimentally.
+ ;; See https://en.wikipedia.org/wiki/Relative_luminance for details.
+ (let* ((sr (nth 0 rgb))
+ (sg (nth 1 rgb))
+ (sb (nth 2 rgb))
+ ;; Gamma-correct the RGB components to linear values.
+ ;; Use the power 2.2 as an approximation to sRGB gamma;
+ ;; it should be good enough for the purpose of this function.
+ (r (expt sr 2.2))
+ (g (expt sg 2.2))
+ (b (expt sb 2.2))
+ (y (+ (* r 0.2126) (* g 0.7152) (* b 0.0722))))
+ (< y ement--color-luminance-dark-limit))))))
;;;; Functions
- [elpa] externals/ement 36677f4cf6 07/19: Change: (ement-room-image-show) Enable image-mode, (continued)
- [elpa] externals/ement 36677f4cf6 07/19: Change: (ement-room-image-show) Enable image-mode, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 3ddbd38a64 08/19: Change: (ement-connect) Omit unhandled login flows, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 54aac8c068 12/19: Tidy: Compilation warning, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 06bb5df147 13/19: Tidy: Compilation warning, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 25c4eabf93 14/19: Tidy: Compilation warning, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 284db78e79 17/19: Docs: Tidy, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 565b999170 02/19: Fix: (ement-notify--log-to-buffer) Select log buffer's window, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 13077e36e4 10/19: Change: (ement-connect) Show message when browsing externally, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 7f82724743 16/19: Docs: Tidy, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 76e90dc418 06/19: Enable image-mode when displaying images in a new buffer, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 6fc2908868 15/19: Tidy: Compilation warning,
ELPA Syncer <=
- [elpa] externals/ement 1e348a793c 01/19: Comment: Add, ELPA Syncer, 2023/08/14
- [elpa] externals/ement a2fc8a3a4a 11/19: Tidy: Use ash instead of lsh, ELPA Syncer, 2023/08/14
- [elpa] externals/ement c9bcea5895 03/19: Fix: (ement-read-receipt-idle-timer) Could be duplicated, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 4ae7b742d5 04/19: Add Guix package search link, ELPA Syncer, 2023/08/14
- [elpa] externals/ement c217fe49f1 05/19: Docs: Add Guix package link, ELPA Syncer, 2023/08/14
- [elpa] externals/ement fc2748aae8 09/19: Change: (ement-connect) Improve login flow errors, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 8f6fef38a9 18/19: Docs: Update installation section, ELPA Syncer, 2023/08/14
- [elpa] externals/ement 3a01d427dd 19/19: Docs: Update installation section, ELPA Syncer, 2023/08/14