GNU bug report logs -
#18697
25.0.50; [PATCH] hi-lock interactive functions now default to the active region, if there is one
Previous Next
Reported by: Dima Kogan <dima <at> secretsauce.net>
Date: Sun, 12 Oct 2014 22:37:02 UTC
Severity: wishlist
Tags: patch, wontfix
Found in version 25.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi.
Attached is a small feature patch. Currently when a hi-lock.el function
is called interactively, the default offered by (read-regexp) is the
last value.
With the patch, the behavior is the same if no active region is
available; if an active region IS available, the default is the contents
of the region.
Perhaps something like this should be added to (read-regexp), but that's
a bigger proposal than this small patch.
[0001-hi-lock-interactive-functions-now-default-to-the-act.patch (text/x-diff, inline)]
From ccf892b48f8bb93c6352f611b4256cb401222668 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
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
This bug report was last modified 6 years and 16 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.