emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/substitute 5dcf6901ed 1/3: Inline the check for appropr


From: ELPA Syncer
Subject: [elpa] externals/substitute 5dcf6901ed 1/3: Inline the check for appropriate face
Date: Tue, 17 Jan 2023 05:58:26 -0500 (EST)

branch: externals/substitute
commit 5dcf6901ed50b67ef177721e4c80303f259c08c1
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Inline the check for appropriate face
    
    We want this to be known at the time the face is loaded.  The problem
    with the previous design was that the function was not known at
    compile time.  Faces are declared earlier.
    
    Thanks to Tomasz Hołubowicz for reporting this issue:
    
<https://lists.sr.ht/~protesilaos/general-issues/%3C87y1q27400.fsf%40alternateved.com%3E#%3C87fsc91tc4.fsf@alternateved.com%3E>.
---
 substitute.el | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/substitute.el b/substitute.el
index 390eb63cd8..129ef2c4f5 100644
--- a/substitute.el
+++ b/substitute.el
@@ -59,7 +59,10 @@ For a reference function, see `substitute-report-operation'."
   :type 'hook)
 
 (defface substitute-match
-  `((t :inherit ,(substitute--determine-face)))
+  `((t :inherit ,(if-let* ((face 'lazy-highlight)
+                           (facep face))
+                     face
+                   'secondary-selection)))
   "Face to highlight matches of the given target."
   :group 'substitute)
 
@@ -87,13 +90,6 @@ Use this to produce a more readable version of TARGET for 
prompts
 and related."
   (replace-regexp-in-string "\\\\_<\\(?1:.*?\\)\\\\_>" "\\1" target))
 
-(defun substitute--determine-face ()
-  "Return face to highlight target of substitute."
-  (if-let* ((face 'lazy-highlight)
-            (facep face))
-      face
-    'secondary-selection))
-
 (defun substitute--remove-highlights ()
   "Remove `substitute-match' overlays."
   (remove-overlays nil nil 'face 'substitute-match))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]