summaryrefslogtreecommitdiff
path: root/lisp/hi-lock.el
diff options
context:
space:
mode:
authorEarl <ej32u@protonmail.com>2020-09-28 14:16:22 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-09-28 14:16:22 +0200
commit27e1649977dfc65a7d9987070100f7da3c5c97a6 (patch)
tree9ffe3454baceccbeb184e6530fb321db71b23e19 /lisp/hi-lock.el
parent3a95f4fc12df0a570ad413e099a22bf901b7346d (diff)
downloademacs-27e1649977dfc65a7d9987070100f7da3c5c97a6.tar.gz
emacs-27e1649977dfc65a7d9987070100f7da3c5c97a6.tar.bz2
emacs-27e1649977dfc65a7d9987070100f7da3c5c97a6.zip
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).
Diffstat (limited to 'lisp/hi-lock.el')
-rw-r--r--lisp/hi-lock.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index c386b7c8012..1c55a23764d 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))