Subject: bug#63616: closed (Re: bug#63616: [PATCH] Preserve mark in comint-history-isearch)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 21 May 2023 06:22:02 +0000

Your bug report

#63616: [PATCH] Preserve mark in comint-history-isearch

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
63616: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63616
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#63616: [PATCH] Preserve mark in comint-history-isearch
From: Eli Zaretskii <[email-masked]>
To: Jens Schmidt <[email-masked]>
Cc: [email-masked]
Date: Sun, 21 May 2023 09:21:36 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> 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" <[email-masked]>
> 
> 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.

Subject: [PATCH] Preserve mark in comint-history-isearch
From: Jens Schmidt <[email-masked]>
To: [email-masked]
Date: Sat, 20 May 2023 23:16:02 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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

From 1cc3067eefdb9bb92eb67fdbff2c903c5df41f6c Mon Sep 17 00:00:00 2001
From: Jens Schmidt <[email-masked]>
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