all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#46469: 27.1; `isearch-del-char' should move point further back
@ 2021-02-12 18:56 Augusto Stoffel
  2021-02-12 20:00 ` Eli Zaretskii
  2021-02-13 18:31 ` Juri Linkov
  0 siblings, 2 replies; 22+ messages in thread
From: Augusto Stoffel @ 2021-02-12 18:56 UTC (permalink / raw)
  To: 46469

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

Suppose my buffer contains the text "x1yx2" right after point, and that
`isearch-del-char' is bound to DEL in Isearch mode.  If I type

   C-s y DEL x1

then I would expect the search to succeed: the cursor would first go
after "y", then return to the starting point of search after pressing
DEL – this is how `isearch-delete-char' behaves, anyway.

Instead, the cursor remains after "y" after pressing DEL, and the search
fails with the cursor after the second "x".  I have attached a patch to
fix this.

I have also attached a second trivial patch for an unrelated, very tiny
bug.

Best,
Augusto


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Make-isearch-del-char-backtrack-the-search-more-aggr.patch --]
[-- Type: text/x-patch, Size: 1509 bytes --]

From 1b1fad0d106390d907a805c9e8c81dd9831b5e1e Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Fri, 12 Feb 2021 19:37:14 +0100
Subject: [PATCH 2/2] Make `isearch-del-char' backtrack the search more
 aggressively

This allows to always find the first occurrence of the search string
after the last `isearch-repeat' or the start of search.
* lisp/isearch.el (isearch-del-char): Call `isearch-fallback' before
updating the search.
---
 lisp/isearch.el | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index aae4aeb261..b9c4cd2a65 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2475,13 +2475,9 @@ isearch-del-char
                                      isearch-string "")))
   ;; Do the following before moving point.
   (funcall (or isearch-message-function #'isearch-message) nil t)
-  ;; Use the isearch-other-end as new starting point to be able
-  ;; to find the remaining part of the search string again.
-  ;; This is like what `isearch-search-and-update' does,
-  ;; but currently it doesn't support deletion of characters
-  ;; for the case where unsuccessful search may become successful
-  ;; by deletion of characters.
-  (if isearch-other-end (goto-char isearch-other-end))
+  ;; Use `isearch-fallback' to be able to find an earlier occurrence
+  ;; of the remaining part of the search string.
+  (isearch-fallback nil nil t)
   (isearch-search)
   (isearch-push-state)
   (isearch-update))
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-Small-correction-to-isearch-lazy-highlight-buffer-up.patch --]
[-- Type: text/x-patch, Size: 1297 bytes --]

From 3707102e4a87ae31105ca1dc71f0f1c349ed806f Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Fri, 12 Feb 2021 19:29:54 +0100
Subject: [PATCH 1/2] Small correction to
 `isearch-lazy-highlight-buffer-update'

The value of point is now read after a potential change of buffer.
* lisp/isearch.el (isearch-lazy-highlight-buffer-update): move call
to `point' after `select-window'.
---
 lisp/isearch.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index b58ca8a6f7..aae4aeb261 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -4127,13 +4127,13 @@ isearch-lazy-highlight-buffer-update
   "Update highlighting of other matches in the full buffer."
   (let ((max lazy-highlight-buffer-max-at-a-time)
         (looping t)
-        nomore window-start window-end
-        (opoint (point)))
+        nomore window-start window-end opoint)
     (with-local-quit
       (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))
+        (setq opoint (point))
 	(setq window-start (window-group-start))
 	(setq window-end (window-group-end))
 	(save-excursion
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2021-04-28 21:37 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-12 18:56 bug#46469: 27.1; `isearch-del-char' should move point further back Augusto Stoffel
2021-02-12 20:00 ` Eli Zaretskii
2021-02-12 20:20   ` Augusto Stoffel
2021-02-13  7:04     ` Eli Zaretskii
2021-02-13  7:32       ` Augusto Stoffel
2021-02-13  8:59         ` Eli Zaretskii
2021-02-13  9:53           ` Augusto Stoffel
2021-02-13 13:28             ` Eli Zaretskii
2021-02-13 23:14           ` bug#46469: [External] : " Drew Adams
2021-02-14  3:42             ` Eli Zaretskii
2021-02-14  7:18               ` Augusto Stoffel
2021-02-14 15:24                 ` Eli Zaretskii
2021-02-14 17:49                 ` Juri Linkov
2021-02-15 19:31                   ` Augusto Stoffel
2021-02-15 19:41                     ` Eli Zaretskii
2021-02-13 18:31 ` Juri Linkov
2021-02-14  7:00   ` Augusto Stoffel
2021-02-14 17:45     ` Juri Linkov
2021-04-27 18:44       ` Augusto Stoffel
2021-04-28 20:53         ` Juri Linkov
2021-04-28 21:16           ` Augusto Stoffel
2021-04-28 21:37             ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.