From: Drew Adams <drew.adams@oracle.com>
To: Juri Linkov <juri@linkov.net>
Cc: 29360@debbugs.gnu.org
Subject: bug#29360: 26.0; Add full-buffer choice for `isearch-lazy-highlight'
Date: Sun, 21 Oct 2018 20:33:35 -0700 (PDT) [thread overview]
Message-ID: <76121a16-e057-4aa7-9a5a-1f09cc221d7c@default> (raw)
In-Reply-To: <87woqbglvb.fsf@mail.linkov.net>
> > In any case, yes, your suggestion of first doing what we do now
> > (highlight the immediate area, using the current algorith), and
> > then following that with highlighting the rest of the buffer,
> > could be a good idea. Dunno how much that might change
> > the existing code.
>
> In the patch attached below, a new function isearch-lazy-highlight-buffer-
> update
> is a copy of isearch-lazy-highlight-update with some changes specific
> to highlighting the full buffer. It seems making a duplicate function
> is necessary because adding more full-buffer specific conditions to
> the existing function isearch-lazy-highlight-update will make it
> unmaintainable.
>
> Only a part of the function (that highlights the match) is extracted
> into a new function isearch-lazy-highlight-match and shared among these
> aforementioned two functions.
Thanks for doing this. A cursory check tells me it works.
One main comment and a couple of minor ones.
1. The main one is to remind you of what I said earlier:
> [P]lease also allow also for programmatic use. Code
> should be able to bind a variable (non-option, if binding an
> option is verboten) to control whether lazy highlighting is
> full-buffer.
>
> That is, I believe that Isearch has several cases where there
> are both a user option and a non-option variable to control some
> behavior. That should be the case for full-buffer highlighting too.
As also stated earlier, I expect that the main use cases
will involve using "Isearch as a UI to get parts of a buffer
highlighted (and so propertized), for other purposes than
just Isearch."
Would you please consider adding such non-option variable
control? I don't need it for my own code, because I don't
hesitate to offer commands that bind user options. But
vanilla Emacs feels differently.
2. Please think about changing "on the screen" (it's in a
couple places) to something like "currently visible in the
window". (Or "currently visible on the screen" if you want
this to apply to multiple windows.)
This is actually something that's bothered me before, but
it becomes more important now that we've introduced the
possibility of highlighting "beyond the screen", so to speak.
My concern here is that "on the screen" can be misinterpreted
as more than just the text that is currently shown. Even
talking about the text that is "in" a window is problematic
for someone who hasn't gotten acquainted with Emacs jargon.
A user can mistakenly think that all of a buffer's text is
"in" a window that shows the buffer, even the parts that are
not currently shown there. We should try to somehow get
across the fact that only text in parts of the buffer that
you show by scrolling to it gets highlighted.
Yes, there could be some confusion regarding invisible text
if we say something like currently "visible" or "shown".
But I don't think "on the screen" is clear enough. It's not
obvious to a user that there is some text in the buffer that
is not "on the screen".
Maybe it would be best to explicitly state what's involved,
at each place where we speak of "screen" - including perhaps
`isearch-allow-scroll'.
Perhaps say that unless `isearch-lazy-highlight-buffer'
is non-nil lazy highlighting highlights only the parts of
the buffer you can currently see (but that other parts
already highlighted remain highlighted).
Also, as a casual user might well wonder why we have
option `isearch-lazy-highlight-buffer', it might be good
to mention a use case: you might want to highlight all
occurrences and then process all of them programmatically.
(And mention option `lazy-highlight-cleanup', for instance.)
Dunno how important this is, as most users will neither
look at `isearch-lazy-highlight-buffer' nor imagine that
they might want to highlight text that they don't yet see.
But for a user who does, it could help to give them the
idea that they might do something with the highlighted
text.
3. Finally, I think that lazy-highlighting the full buffer
will typically go hand in hand with keeping the highlighting.
That is, non-nil `isearch-lazy-highlight-buffer' will be
used with nil `isearch-lazy-highlight-cleanup', and vice
versa. It might be useful to make it easy to couple the two.
(In my own code, at least, I've added a key that toggles
`isearch-lazy-highlight-buffer' and sets
`isearch-lazy-highlight-cleanup' to `(not
isearch-lazy-highlight-buffer)'. I know that Emacs won't
want keys that toggle option values, so I'm not sure what
Emacs would want to do to make it easy for a user to couple
the two.)
4. Another possible addition might be an indicator somewhere
(in the prompt? lighter?) to show that lazy highlighting
is in progress. Dunno whether that's needed. It's good
that you added the message letting you know when it's done.
Thanks again for implementing this feature. I think you
can close this bug now. I've played with it a bit, and
it seems to work fine.
- Drew
next prev parent reply other threads:[~2018-10-22 3:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-19 19:05 bug#29360: 26.0; Add full-buffer choice for `isearch-lazy-highlight' Drew Adams
2017-11-20 20:53 ` Juri Linkov
2017-11-20 22:40 ` Drew Adams
2017-11-23 21:49 ` Juri Linkov
2017-11-23 23:53 ` Drew Adams
2018-10-18 5:47 ` Drew Adams
2018-10-18 22:18 ` Juri Linkov
2018-10-18 23:25 ` Drew Adams
2018-10-20 17:10 ` Drew Adams
2018-10-20 22:12 ` Juri Linkov
2018-10-20 23:09 ` Drew Adams
2018-10-21 19:06 ` Juri Linkov
2018-10-22 3:33 ` Drew Adams [this message]
2018-10-23 22:05 ` Juri Linkov
2018-10-23 22:51 ` Drew Adams
2018-10-24 23:11 ` Juri Linkov
2018-10-25 0:28 ` Drew Adams
2018-10-27 20:28 ` Juri Linkov
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=76121a16-e057-4aa7-9a5a-1f09cc221d7c@default \
--to=drew.adams@oracle.com \
--cc=29360@debbugs.gnu.org \
--cc=juri@linkov.net \
/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).