From 27e1649977dfc65a7d9987070100f7da3c5c97a6 Mon Sep 17 00:00:00 2001 From: Earl Date: Mon, 28 Sep 2020 14:16:22 +0200 Subject: 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(-) (limited to 'lisp') 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)) -- cgit v1.2.3