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).
This commit is contained in:
Earl 2020-09-28 14:16:22 +02:00 committed by Lars Ingebrigtsen
parent 3a95f4fc12
commit 27e1649977

View file

@ -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))