unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 33446@debbugs.gnu.org
Cc: Juri Linkov <juri@linkov.net>
Subject: bug#33446: 26; `isearch-lazy-highlight-update' in MASTER today
Date: Tue, 20 Nov 2018 11:47:29 -0800 (PST)	[thread overview]
Message-ID: <ea5cbc8d-8524-480f-acc6-da25ef1a7b07@default> (raw)

I ran into this bug today using my setup, which reflects the code for
`isearch-lazy-highlight-update' that was added recently to isearch.el.

Dunno why or how, but for some reason I got in a situation where
`isearch-lazy-highlight-window' is live and is not the selected window.
In fact it is in a different frame.  And there is no lazy-highlighting
showing there and no search in progress there.  I'm willing to guess
that this is not a normal situation that I got myself into. ;-)  But
I think there is nevertheless a bug somewhere in the Isearch code.

The `isearch-lazy-highlight-update' code does this:

(save-selected-window
  (if (and (window-live-p isearch-lazy-highlight-window)
           (not (memq (selected-window)
                isearch-lazy-highlight-window-group)))
      (select-window isearch-lazy-highlight-window))

That causes the window in the other frame to be selected.
It's not there that I wanted to do
`isearch-lazy-highlight-update'.  If there is no lazy
highlighting to be updated in the selected window then
I'd expect that `isearch-lazy-highlight-update' would in
that case be a no-op.  Why do we move to another window
to do it, even if for some reason `isearch-lazy-highlight-window'
is non-nil?  (I don't know why it is non-nil in my case.)

The code then does this:

  (setq window-start (window-group-start))
  (setq window-end (window-group-end))

This causes `window-end' to be nil.  Should `window-group-*' here
be passed window `isearch-lazy-highlight-window'?

In any case, then the code does this:

  (save-excursion
    (save-match-data
      (goto-char (if isearch-lazy-highlight-forward
                     isearch-lazy-highlight-end
                   isearch-lazy-highlight-start))
      (while looping
        (let* ((bound (if isearch-lazy-highlight-forward
                          (min (or isearch-lazy-highlight-end-limit
                                   (point-max))
                               (if isearch-lazy-highlight-wrapped
                                   isearch-lazy-highlight-start
                                 window-end))
                        (max (or isearch-lazy-highlight-start-limit
                                 (point-min))
                             (if isearch-lazy-highlight-wrapped
                                 isearch-lazy-highlight-end
                               window-start))))

and that raises an error because `window-end' is nil.

Dunno what the right fix is.  Definitely min and max should not be
called if one of their args is nil.  What should be done in this case?

And I wonder, even if that error gets prevented, why we should update
lazy highlighting on a window other than the selected one?  Is that TRT?
In this case, at least, that other window has nothing to do with the
action in question (my code that calls `isearch-lazy-highlight-update'),
and there is no search in progress in that other window and no
lazy-highlighting (e.g. overlay) showing there.


In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-30
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor `Microsoft Corp.', version 10.0.16299
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





             reply	other threads:[~2018-11-20 19:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 19:47 Drew Adams [this message]
2018-11-20 21:10 ` bug#33446: 26; `isearch-lazy-highlight-update' in MASTER today Drew Adams
2018-11-20 23:14   ` Juri Linkov
2018-11-20 23:47     ` Drew Adams
2018-11-21 22:42       ` Juri Linkov
2018-11-21 22:50         ` Drew Adams

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=ea5cbc8d-8524-480f-acc6-da25ef1a7b07@default \
    --to=drew.adams@oracle.com \
    --cc=33446@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).