From: Dima Kogan <dima@secretsauce.net>
To: 18697@debbugs.gnu.org
Subject: bug#18697: 25.0.50; [PATCH] hi-lock interactive functions now default to the active region, if there is one
Date: Sun, 12 Oct 2014 15:35:55 -0700 [thread overview]
Message-ID: <87zjd0digk.fsf@secretsauce.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 427 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-hi-lock-interactive-functions-now-default-to-the-act.patch --]
[-- Type: text/x-diff, Size: 1974 bytes --]
From ccf892b48f8bb93c6352f611b4256cb401222668 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@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
next reply other threads:[~2014-10-12 22:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-12 22:35 Dima Kogan [this message]
2014-10-12 23:01 ` bug#18697: 25.0.50; [PATCH] hi-lock interactive functions now default to the active region, if there is one Drew Adams
2014-10-14 19:32 ` Juri Linkov
2014-10-14 19:48 ` Drew Adams
2014-10-14 20:04 ` Juri Linkov
2014-10-14 20:25 ` Drew Adams
2014-10-14 21:45 ` Drew Adams
2014-10-13 11:12 ` Ivan Shmakov
2014-10-14 18:51 ` Stefan Monnier
2019-06-25 21:29 ` Lars Ingebrigtsen
2019-06-28 19:09 ` Juri Linkov
2019-06-29 10:14 ` Lars Ingebrigtsen
2019-06-30 20:58 ` Juri Linkov
2019-07-02 12:41 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zjd0digk.fsf@secretsauce.net \
--to=dima@secretsauce.net \
--cc=18697@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).