all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#65379: 29.1.50; isearch started through `isearch-resume' incorrectly moves point after failure
@ 2023-08-19  9:45 Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-20 17:37 ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-19  9:45 UTC (permalink / raw)
  To: 65379

One of the more arcane features of isearch ... I do not actually
use that, but I modeled one of my personal isearch functions after
`isearch-resume´ and came across this issue.

emacs -Q

M-: (setq isearch-resume-in-command-history t) RET

Then execute:

  f                     ;; self-insert-command
  o                     ;; self-insert-command
  o                     ;; self-insert-command
  b                     ;; self-insert-command
  a                     ;; self-insert-command
  r                     ;; self-insert-command
  b                     ;; self-insert-command
  a                     ;; self-insert-command
  z                     ;; self-insert-command
  <return>              ;; newline
  C-<home>              ;; beginning-of-buffer
  C-s                   ;; isearch-forward
  f                     ;; isearch-printing-char
  o                     ;; isearch-printing-char
  o                     ;; isearch-printing-char
  b                     ;; isearch-printing-char
  a                     ;; isearch-printing-char
  r                     ;; isearch-printing-char
  b                     ;; isearch-printing-char
  a                     ;; isearch-printing-char
  z                     ;; isearch-printing-char
  <return>              ;; isearch-exit
  C-<home>              ;; beginning-of-buffer
  C-x <escape> <escape> ;; repeat-complex-command
  <return>              ;; read--expression-try-read
  C-s                   ;; isearch-repeat-forward

=> point jumps to bob and the complete buffer gets highlighted on the
   search failure after the `C-s'

I'm not an isearch expert, but I think the remedy should be to add a
call to `isearch-push-state' before the call to `isearch-update' in
function `isearch-resume':

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 3d2bbda4975..14f335f4cea 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -4640,6 +4640,7 @@ isearch-resume
 	isearch-message message
 	isearch-case-fold-search case-fold)
   (isearch-search)
+  (isearch-push-state)
   (isearch-update))
 
At least that helps preventing the incorrect behavior, and most other
calls to `isearch-update' have a preceeding call to `isearch-push-state'
in isearch.el.  But that doesn't mean anything, of course, so somebody
else should review that.






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

end of thread, other threads:[~2023-08-20 17:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-19  9:45 bug#65379: 29.1.50; isearch started through `isearch-resume' incorrectly moves point after failure Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-20 17: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.