bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18697: 25.0.50; [PATCH] hi-lock interactive functions now default to


From: Juri Linkov
Subject: bug#18697: 25.0.50; [PATCH] hi-lock interactive functions now default to the active region, if there is one
Date: Fri, 28 Jun 2019 22:09:31 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> 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.
>
> Hm...  I think this sounds kinda unusual?  We don't have any other
> prompting functions that default to using the contents of the region (if
> it's active), I think?

Wouldn't the following patch satisfy the request by allowing to use
M-n M-n to fetch the active region in the hi-lock command prompt:

diff --git a/lisp/replace.el b/lisp/replace.el
index 9d1b7bf747..15309a6a22 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -775,6 +775,8 @@ read-regexp-suggestions
 appends the list returned by this function to the end of values available
 via \\<minibuffer-local-map>\\[next-history-element]."
   (list
+   (when (use-region-p)
+     (buffer-substring-no-properties (region-beginning) (region-end)))
    (find-tag-default-as-regexp)
    (find-tag-default-as-symbol-regexp)
    (car regexp-search-ring)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]