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

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

[elpa] externals/ivy-hydra 7f88b67 345/395: counsel.el (counsel-highligh


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 7f88b67 345/395: counsel.el (counsel-highlight-with-face): New action for counsel-faces
Date: Thu, 25 Feb 2021 08:32:35 -0500 (EST)

branch: externals/ivy-hydra
commit 7f88b67b3a220ce7dbabfe956ebe8a2b6d16573b
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    counsel.el (counsel-highlight-with-face): New action for counsel-faces
    
    Fixes #2651
---
 counsel.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/counsel.el b/counsel.el
index 484a5aa..6cfb652 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1188,6 +1188,15 @@ back to the face of the character after point, and 
finally the
   "Customize face with NAME in another window."
   (customize-face-other-window (intern name)))
 
+(declare-function hi-lock-set-pattern "hi-lock")
+(defun counsel-highlight-with-face (face)
+  "Highlight thing-at-point with FACE."
+  (hi-lock-mode 1)
+  (let ((thing (ivy-thing-at-point)))
+    (when (use-region-p)
+      (deactivate-mark))
+    (hi-lock-set-pattern (regexp-quote thing) face)))
+
 (ivy-set-actions
  'counsel-describe-face
  '(("c" counsel-customize-face "customize")
@@ -1232,7 +1241,8 @@ selected face."
 (ivy-set-actions
  'counsel-faces
  '(("c" counsel-customize-face "customize")
-   ("C" counsel-customize-face-other-window "customize other window")))
+   ("C" counsel-customize-face-other-window "customize other window")
+   ("h" counsel-highlight-with-face "highlight")))
 
 ;;* Git
 ;;** `counsel-git'



reply via email to

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