unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jens Schmidt via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 63616@debbugs.gnu.org
Subject: bug#63616: [PATCH] Preserve mark in comint-history-isearch
Date: Sat, 20 May 2023 23:16:02 +0200	[thread overview]
Message-ID: <31be36a3-9172-12bd-acee-82d09bace288@vodafonemail.de> (raw)

[-- 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


             reply	other threads:[~2023-05-20 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-20 21:16 Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-05-21  6:21 ` bug#63616: [PATCH] Preserve mark in comint-history-isearch Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31be36a3-9172-12bd-acee-82d09bace288@vodafonemail.de \
    --to=bug-gnu-emacs@gnu.org \
    --cc=63616@debbugs.gnu.org \
    --cc=jschmidt4gnu@vodafonemail.de \
    /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 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).