From: Earl Date: Mon, 28 Sep 2020 12:16:22 +0000 (+0200) Subject: Suggest region contents in highlight-regexp when region active X-Git-Tag: emacs-28.0.90~5837 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=27e1649977dfc65a7d9987070100f7da3c5c97a6;p=emacs.git 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). --- 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))