GNU bug report logs - #22118
23.2; Hitting ^W in a search selects the wrong word.

Previous Next

Package: emacs;

Reported by: jms <at> codersco.com

Date: Tue, 8 Dec 2015 18:56:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 23.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefan <at> marxist.se>
To: Juri Linkov <juri <at> linkov.net>
Cc: Alan Mackenzie <acm <at> muc.de>, 22118 <at> debbugs.gnu.org, Jan-Mark <jms <at> 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
Hi Juri,

Is the below patch still relevant?

Juri Linkov <juri <at> 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




This bug report was last modified 4 years and 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.