unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Juri Linkov <juri@linkov.net>
Cc: Alan Mackenzie <acm@muc.de>,
	22118@debbugs.gnu.org, Jan-Mark <jms@codersco.com>
Subject: bug#22118: 23.2; Hitting ^W in a search selects the wrong word.
Date: Tue, 11 Aug 2020 20:33:41 -0700	[thread overview]
Message-ID: <CADwFkm=m5NdBJji42Poj0VNgxpd6Z6=Wdijckw=qRD4_2xSmaQ@mail.gmail.com> (raw)
In-Reply-To: <87k2okbnpk.fsf@mail.linkov.net> (Juri Linkov's message of "Sat,  12 Dec 2015 00:54:47 +0200")

Hi Juri,

Is the below patch still relevant?

Juri Linkov <juri@linkov.net> writes:

>> I would say, either update the text window too or disallow using ^W
>> after a failure.
>
> I agree that the current behavior is not ideal.  The problem is that
> it's difficult to make it more intuitive to work with different
> workflows such as when failing not at the end of the buffer
> but due to a non-existent string, e.g. typing ‘zzz C-w C-w C-w’.
> Please try this patch that takes into account such possible scenarios.
>
> However, I don't agree this is a bug, I think it just provides a more
> useful behavior, so perhaps it shouldn't be installed to emacs-25.
>
> diff --git a/lisp/isearch.el b/lisp/isearch.el
> index 66fab0e..e9a99ea 100644
> --- a/lisp/isearch.el
> +++ b/lisp/isearch.el
> @@ -1959,6 +1959,8 @@ (defun isearch-mouse-2 (click)
>        (when (functionp binding)
>  	(call-interactively binding)))))
>
> +(defvar isearch-yank-prev-point nil)
> +
>  (defun isearch-yank-internal (jumpform)
>    "Pull the text from point to the point reached by JUMPFORM.
>  JUMPFORM is a lambda expression that takes no arguments and returns
> @@ -1969,7 +1971,14 @@ (defun isearch-yank-internal (jumpform)
>     (save-excursion
>       (and (not isearch-forward) isearch-other-end
>  	  (goto-char isearch-other-end))
> -     (buffer-substring-no-properties (point) (funcall jumpform)))))
> +     (and (not isearch-success) isearch-yank-prev-point
> +	  (goto-char isearch-yank-prev-point))
> +     (buffer-substring-no-properties
> +      (point)
> +      (prog1
> +	  (setq isearch-yank-prev-point (funcall jumpform))
> +	(when isearch-success
> +	  (setq isearch-yank-prev-point nil)))))))
>
>  (defun isearch-yank-char-in-minibuffer (&optional arg)
>    "Pull next character from buffer into end of search string in minibuffer."

Best regards,
Stefan Kangas





  reply	other threads:[~2020-08-12  3:33 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
2015-12-10 13:07         ` Jan-Mark
2015-12-11 22:54           ` Juri Linkov
2020-08-12  3:33             ` Stefan Kangas [this message]
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='CADwFkm=m5NdBJji42Poj0VNgxpd6Z6=Wdijckw=qRD4_2xSmaQ@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=22118@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=jms@codersco.com \
    --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).