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: Ivan Shmakov
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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





reply via email to

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