all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 18697@debbugs.gnu.org, Dima Kogan <dima@secretsauce.net>
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	[thread overview]
Message-ID: <87h889bq00.fsf@mail.linkov.net> (raw)
In-Reply-To: <m3blylwe02.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 25 Jun 2019 23:29:01 +0200")

>> 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	other threads:[~2019-06-28 19:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-12 22:35 bug#18697: 25.0.50; [PATCH] hi-lock interactive functions now default to the active region, if there is one Dima Kogan
2014-10-12 23:01 ` 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 [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h889bq00.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=18697@debbugs.gnu.org \
    --cc=dima@secretsauce.net \
    --cc=larsi@gnus.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.