unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#63616: [PATCH] Preserve mark in comint-history-isearch
@ 2023-05-20 21:16 Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-21  6:21 ` Eli Zaretskii
  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-05-20 21:16 UTC (permalink / raw)
  To: 63616

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

Tags: patch
Version: 30.0.50

A smaller nuisance that I keep fixing from Emacs to Emacs ... the 
isearch started by `comint-history-isearch-backward-regexp' IMHO
unnecessarily changes mark.

To reproduce:

emacs -Q
M-x shell RET

;; list some lengthy directory
ls -alL /bin RET

;; set mark at bob
C-x h
C-x C-x

;; start comint history isearch for "lL" and abort it
M-r lL C-g

;; try to jump to previous mark - no success
C-x C-x

Alternatively:

;; list some lengthy directory
ls -alL /bin RET

;; set mark at bob
C-x h
C-x C-x

;; start comint history isearch for "lL" and accept hit
M-r lL RET

;; mark is set at eol, which seems not very useful
C-x C-x

[-- Attachment #2: 0001-Preserve-mark-in-comint-history-isearch.patch --]
[-- Type: text/x-patch, Size: 1021 bytes --]

From 1cc3067eefdb9bb92eb67fdbff2c903c5df41f6c Mon Sep 17 00:00:00 2001
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Date: Sat, 20 May 2023 23:03:29 +0200
Subject: [PATCH] Preserve mark in comint-history-isearch

Preserve mark in `comint-history-isearch-backward' and friends, which
tend to set the mark on completion of the isearch to unexpected
positions.
* lisp/comint.el (comint-history-isearch-end): Set `isearch-opoint' to
point.
---
 lisp/comint.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/comint.el b/lisp/comint.el
index 9d2c245247f..77973ab76de 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1543,6 +1543,8 @@ comint-history-isearch-end
   (setq isearch-message-function nil)
   (setq isearch-wrap-function nil)
   (setq isearch-push-state-function nil)
+  ;; Force isearch to not change mark.
+  (setq isearch-opoint (point))
   (kill-local-variable 'isearch-lazy-count)
   (remove-hook 'isearch-mode-end-hook 'comint-history-isearch-end t)
   (unless isearch-suspended
-- 
2.30.2


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

* bug#63616: [PATCH] Preserve mark in comint-history-isearch
  2023-05-20 21:16 bug#63616: [PATCH] Preserve mark in comint-history-isearch Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-21  6:21 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-05-21  6:21 UTC (permalink / raw)
  To: Jens Schmidt; +Cc: 63616-done

> Date: Sat, 20 May 2023 23:16:02 +0200
> From:  Jens Schmidt via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> A smaller nuisance that I keep fixing from Emacs to Emacs ... the 
> isearch started by `comint-history-isearch-backward-regexp' IMHO
> unnecessarily changes mark.

Thanks, installed on the emacs-29 branch, and closing the bug.





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

end of thread, other threads:[~2023-05-21  6:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-20 21:16 bug#63616: [PATCH] Preserve mark in comint-history-isearch Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-21  6:21 ` Eli Zaretskii

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).