unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.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: Mon, 13 Oct 2014 11:12:31 +0000	[thread overview]
Message-ID: <87vbnoz0io.fsf@violet.siamics.net> (raw)
In-Reply-To: <87zjd0digk.fsf@secretsauce.net> (Dima Kogan's message of "Sun, 12 Oct 2014 15:35:55 -0700")

>>>>> Dima Kogan <dima@secretsauce.net> writes:

 > 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.

[…]

 > --- 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))

	I don’t seem to understand; is mark-active ever supposed to
	become nil when /not/ in the transient-mark-mode?

	Personally, I find the latter distracting enough not to ever
	turn it on.  So, I guess that the above would mean that I’d
	always be getting anything I have for the region (which may
	easily be a substantial portion of the buffer) for the default.

	Thus, at the very least, the above should probably use
	(and transient-mark-mode mark-active) as the condition, or
	something like that.

[…]

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A





  parent reply	other threads:[~2014-10-13 11:12 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 [this message]
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=87vbnoz0io.fsf@violet.siamics.net \
    --to=ivan@siamics.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).