[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eglot-inactive-regions 7a9e3ac805 57/66: refactor and clea
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eglot-inactive-regions 7a9e3ac805 57/66: refactor and cleanup |
Date: |
Fri, 6 Dec 2024 06:59:58 -0500 (EST) |
branch: elpa/eglot-inactive-regions
commit 7a9e3ac805777796fa1537903d7919156558ead9
Author: Filippo Argiolas <filippo.argiolas@gmail.com>
Commit: Filippo Argiolas <filippo.argiolas@gmail.com>
refactor and cleanup
---
eglot-inactive-regions.el | 37 +++++++++++++++++--------------------
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/eglot-inactive-regions.el b/eglot-inactive-regions.el
index a4cb9d9d88..e627d3e917 100644
--- a/eglot-inactive-regions.el
+++ b/eglot-inactive-regions.el
@@ -118,22 +118,20 @@ factor. All other face attributes you can customize.")
(eglot-inactive-regions--disable))))
(defun eglot-inactive-regions--styles ()
- "Return a list of styles and style names."
- (let ((choices (get 'eglot-inactive-regions-style 'custom-type)))
+ "Return a cons list of style names and styles."
+ (let ((choices (cdr (get 'eglot-inactive-regions-style 'custom-type))))
(mapcar (lambda (opt)
- (let ((symbol (car (last opt)))
- (tag (plist-get (cdr opt) :tag)))
- (cons symbol tag)))
- (cdr choices))))
+ (pcase opt (`(const :tag ,tag ,value) (cons tag value))))
+ choices)))
(defun eglot-inactive-regions-set-style (style)
"Interactively select a shading STYLE to render inactive code regions."
(interactive
(let* ((styles (eglot-inactive-regions--styles))
- (names (mapcar #'cdr styles))
+ (names (mapcar #'car styles))
(prompt "Set inactive regions shading style: ")
- (value (completing-read prompt names)))
- (list (car (rassoc value styles)))))
+ (name (completing-read prompt names)))
+ (list (cdr (assoc name styles)))))
(setq eglot-inactive-regions-style style)
(eglot-inactive-regions-refresh-all))
@@ -159,14 +157,13 @@ Only applies to `shade-background' style."
"Linearly interpolate between two colors.
Blend colors FROM-COLOR and TO-COLOR with ALPHA interpolation
factor."
- (let ((from-rgb (color-name-to-rgb from-color))
- (to-rgb (color-name-to-rgb to-color))
- (alpha (min 1.0 (max 0.0 alpha))))
- (if (and from-rgb to-rgb)
- (apply 'color-rgb-to-hex
- (cl-mapcar #'(lambda (a b) (+ (* a alpha) (* b (- 1.0 alpha))))
- from-rgb to-rgb))
- 'unspecified)))
+ (if-let ((from-rgb (color-name-to-rgb from-color))
+ (to-rgb (color-name-to-rgb to-color))
+ (alpha (min 1.0 (max 0.0 alpha))))
+ (apply 'color-rgb-to-hex
+ (cl-mapcar #'(lambda (a b) (+ (* a alpha) (* b (- 1.0 alpha))))
+ from-rgb to-rgb))
+ 'unspecified))
(defun eglot-inactive-regions-cleanup ()
"Clean up inactive regions."
@@ -262,10 +259,10 @@ we don't want to include whitespace in fontification."
;; no need to dim whitespace
(unless (string-match-p "[[:blank:]\n]" (string (char-before)))
(let* ((cur-face (eglot-inactive-regions--get-face (1-
(point))))
- (eglot-inactive-face
(eglot-inactive-regions--make-darken-face cur-face)))
- (let* ((ov (make-overlay beg (point))))
+ (eglot-inactive-face
(eglot-inactive-regions--make-darken-face cur-face))
+ (ov (make-overlay beg (point))))
(overlay-put ov 'face eglot-inactive-face)
- (push ov eglot-inactive-regions--overlays))))
+ (push ov eglot-inactive-regions--overlays)))
(setq beg (point))))))
(setq start to)))))
- [nongnu] elpa/eglot-inactive-regions 6ac373dfd0 62/66: bump version after emacs-devel review, (continued)
- [nongnu] elpa/eglot-inactive-regions 6ac373dfd0 62/66: bump version after emacs-devel review, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 3569bd5dc7 24/66: Properly enable/clean up state on minor mode toggle, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 3b248e0684 37/66: Update install section in README.md, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 3ca295f189 45/66: switch to global minor mode, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 15259e94b2 50/66: move to defcustoms for customization, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 5b48f4940d 54/66: rename shading method to shading style, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 2d93c0cab0 04/66: forgot some package comment, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 3cb6ed0bc4 34/66: update README.md, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 5e08869dd6 36/66: Bump version to 0.3, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 89ffc22d6f 49/66: rename main package file, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 7a9e3ac805 57/66: refactor and cleanup,
ELPA Syncer <=
- [nongnu] elpa/eglot-inactive-regions 12794454af 41/66: properly check if mode is enabled, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions f4a79c0d0f 35/66: Remove a couple of setq-s to make byte compiler happy, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 4a33baf9e6 52/66: no need to enable extra caps for ccls, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 2c83a3230d 66/66: bump release after elpaignore inclusion, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions b6f05af2bc 64/66: bump version, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions e3d63eeac0 43/66: revert to deprecated eglot functions, ELPA Syncer, 2024/12/06