From: Augusto Stoffel <arstoffel@gmail.com>
To: 46469@debbugs.gnu.org
Subject: bug#46469: 27.1; `isearch-del-char' should move point further back
Date: Fri, 12 Feb 2021 19:56:36 +0100 [thread overview]
Message-ID: <87zh09xggr.fsf@gmail.com> (raw)
[-- 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
next reply other threads:[~2021-02-12 18:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 18:56 Augusto Stoffel [this message]
2021-02-12 20:00 ` bug#46469: 27.1; `isearch-del-char' should move point further back 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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh09xggr.fsf@gmail.com \
--to=arstoffel@gmail.com \
--cc=46469@debbugs.gnu.org \
/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 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.