emacs-diffs
[Top][All Lists]
Advanced

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

master 27e1649: Suggest region contents in highlight-regexp when region


From: Lars Ingebrigtsen
Subject: master 27e1649: Suggest region contents in highlight-regexp when region active
Date: Mon, 28 Sep 2020 08:16:31 -0400 (EDT)

branch: master
commit 27e1649977dfc65a7d9987070100f7da3c5c97a6
Author: Earl <ej32u@protonmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Suggest region contents in highlight-regexp when region active
    
    * lisp/hi-lock.el (hi-lock-face-buffer): Use the region in the
    prompt if the region is active in transient-mark-mode (bug#43641).
---
 lisp/hi-lock.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index c386b7c..1c55a23 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -484,7 +484,13 @@ the major mode specifies support for Font Lock."
   (interactive
    (list
     (hi-lock-regexp-okay
-     (read-regexp "Regexp to highlight" 'regexp-history-last))
+     (read-regexp "Regexp to highlight"
+                  (if (use-region-p)
+                      (prog1
+                          (buffer-substring (region-beginning)
+                                            (region-end))
+                        (deactivate-mark))
+                    'regexp-history-last)))
     (hi-lock-read-face-name)
     current-prefix-arg))
   (or (facep face) (setq face 'hi-yellow))



reply via email to

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