From ccf892b48f8bb93c6352f611b4256cb401222668 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 12 Oct 2014 15:32:02 -0700 Subject: [PATCH] hi-lock interactive functions now default to the active region, if there is one --- lisp/hi-lock.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 98a26dd..6b06d08 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -419,7 +419,10 @@ highlighting will not update as you type." (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight line" 'regexp-history-last)) + (read-regexp "Regexp to highlight line" + (if mark-active + (buffer-substring-no-properties (point) (mark)) + 'regexp-history-last))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -443,7 +446,10 @@ highlighting will not update as you type." (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight" 'regexp-history-last)) + (read-regexp "Regexp to highlight" + (if mark-active + (buffer-substring-no-properties (point) (mark)) + 'regexp-history-last))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -468,7 +474,10 @@ highlighting will not update as you type." (list (hi-lock-regexp-okay (hi-lock-process-phrase - (read-regexp "Phrase to highlight" 'regexp-history-last))) + (read-regexp "Phrase to highlight" + (if mark-active + (buffer-substring-no-properties (point) (mark)) + 'regexp-history-last)))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) -- 2.0.0