unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Jan-Mark <jms@codersco.com>
Cc: 22118@debbugs.gnu.org
Subject: bug#22118: 23.2; Hitting ^W in a search selects the wrong word.
Date: Thu, 10 Dec 2015 12:10:28 +0000	[thread overview]
Message-ID: <20151210121027.GA3978@acm.fritz.box> (raw)
In-Reply-To: <56694D83.3080902@codersco.com>

Hello, Jan-Mark.

On Thu, Dec 10, 2015 at 11:01:39AM +0100, Jan-Mark wrote:
> Hi Alan,

> Thanks for your swift response and all the work you do on my favorite
> editor. People like you improve my life.

Thanks, that's appreciated.  Just one small request: when you reply,
would you please leave the Cc: to the bug archive.  That way, there's a
full record of the bug on the public list.

> >> Note that if you are not in 'last-occurrence' state, there is no
> >> problem, even at the last line. This bug only manifests itself if ^S has
> >> been hit until it shows "Failing the I-search" in the minibuffer.

> > Why is this behaviour a bug?  I think that the effect of ^W in
> > "last-occurrence" state is probably undefined in the manual.  Adding
> > "_aap" to the search string for each ^W does give the user feedback that
> > the ^W has actually been received and processed.

> Depending on how you define "bug". :-) Adding "_aap" is definitely what
> you would expect.

> There are three problems IMHO that make this a "bug":

> 1) The screen is inconsistent. The minibuffer shows a "aap_noot_aap" but
> the text buffer window's highlighting is not updated, only "aap_noot" is
> highlighted.

Don't forget, that by this stage the text in the minibuffer indicates
"not found".  So the main window highlights as much text as was found,
the minibuffer indicates the current search string, and any lazy
highlighting shows where the current search string would be found
earlier on.

All of this _is_ in the manual, on page "Errors in Incremental Search".

> 2) Hitting ^W again will add an other "_aap" (consistent with the end of
> the highlighting) which is unexpected to say the least. The minibuffer
> will contain "aap_noot_aap_aap" which is nowhere in the text.

This is true: the minibuffer shows what you are searching for.  This
indeed is nowhere in the text, but it's what you're searching for.

> 3) Not hitting ^W again, but ^S will wrap the search around looking for
> what is stated in the minibuffer ("aap_noot_aap") not what is
> highlighted in the text buffer window ("aap_noot"). The highlighting
> however is correct again ("aap_noot_aap").

The search is ALWAYS for what's in the minibuffer.  Once you hit ^S
again, the search becomes wrapped, and is no longer failing: it finds
"aap_noot_aap".

> > What do you think should happen in these circumstances?  Does the current
> > behaviour actually give you problems?

> Depending on how you define "problems". :-P However, there are two
> different ways emacs could deal with this that would definitely improve
> the ease of understanding and ease of use.

> a) The most consistent behavior, IMHO, would be to update the
> highlighting in the text buffer window. This way the the text buffer and
> mini buffer will be consistent. This way I don't have to check both to
> find out what is going on.

But when the search has failed, they should be different: in the main
window, you can sea the bit that matched, and in the minibuffer, in
bright red, you can see the bit that didn't match.  I think you're
asking for the distinction between successful and failing searches to be
removed.  This would surely be a Bad Thing.

> b) What would help me (personally) more would be if emacs would go back
> into search mode, highlight the whole search text in the text buffer
> window and remove the "Failing I-search:" from the mini buffer. The
> rational behind this is that changing the search string kind of "resets"
> the search status to the "default".

Internally, Isearch does indeed do this: it searches for the complete
string from the starting point each time you type a new character.  But
if it has already failed, it's going to stay failed unless something
like a C-s make the search wrap.

> I understand that if an I-search has failed extending the search string
> would keep you in the same search state (I.e., the last match.) However,
> by that reasoning hitting ^S should also not change the state. So I vote
> for behavior b) but I could live with behavior a).

> However I strongly feel, the mini buffer and the text buffer should be
> consistent.

They are the same as long as a search hasn't yet failed.  If it has, the
minibuffer shows what you're searching for, the text buffer what you
have found.

> If I type ^S until I find the last entry, hitting ^W appends
> "_aap" and updates the text buffer window. If I type ^S until I find the
> last entry, hit ^S again (going into Failing I-search) hitting ^W also
> appends "_aap" but does not update the text buffer window.

With the best will in the world, I honestly don't think there's a bug
here.  Could I ask you to have another look at that manual page ("Errors
in Incremental Search" in the Emacs manual) and carefully compare what
you read there with what you see on the screen.

By the way, Emacs 23.2 is now pretty old.  You might want to consider
upgrading to a newer version.  The current released version is 24.5.

> Regards,

> Jan-Mark

-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2015-12-10 12:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 17:54 bug#22118: 23.2; Hitting ^W in a search selects the wrong word jms
     [not found] ` <mailman.1705.1449600970.31583.bug-gnu-emacs@gnu.org>
2015-12-10  9:25   ` Alan Mackenzie
     [not found]     ` <56694D83.3080902@codersco.com>
2015-12-10 12:10       ` Alan Mackenzie [this message]
2015-12-10 13:07         ` Jan-Mark
2015-12-11 22:54           ` Juri Linkov
2020-08-12  3:33             ` Stefan Kangas
2020-08-12 23:58               ` Juri Linkov
2020-08-13  1:22                 ` Stefan Kangas
2020-08-13 16:53                   ` Jan-Mark
2020-08-29 16:48                     ` Stefan Kangas
2020-10-11  3:05                       ` 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=20151210121027.GA3978@acm.fritz.box \
    --to=acm@muc.de \
    --cc=22118@debbugs.gnu.org \
    --cc=jms@codersco.com \
    /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).