From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pengji Zhang Newsgroups: gmane.emacs.bugs Subject: bug#74287: [PATCH] Rework history Isearch for Eshell Date: Mon, 09 Dec 2024 21:35:52 +0800 Message-ID: <87wmg9htc7.fsf@pengjiz.com> References: <871pzjkhmm.fsf@pengjiz.com> <8c80ae91-476e-e665-43be-86d72fb57ed1@gmail.com> <86v7waz603.fsf@gmx.net> <6fdd8386-8915-e3a8-046a-b18750a7057d@gmail.com> <87v7vzgtuq.fsf@mail.linkov.net> <87jzcecnc9.fsf@pengjiz.com> <87h67icmu1.fsf@pengjiz.com> <87cyi159vo.fsf@pengjiz.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39028"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74287@debbugs.gnu.org To: Jim Porter , Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 09 14:38:43 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tKdyE-0009yC-Qw for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 Dec 2024 14:38:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKdwv-0006Ev-CA; Mon, 09 Dec 2024 08:37:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKdwd-0006DI-Oj for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2024 08:37:07 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKdwc-0007FB-Oi for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2024 08:37:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=Tc909s4faUlnsHVxKRxahqipyJNKG7OB3ykEr8t34iE=; b=KqIH3TJ3oz+NfhIQ/rtUWnC95AxuPFKmj9KD1FIIDVJo6/bBX9LBm3jR3eX4zvrCHEfFv6uQpn3WUnHe1Jd/YtqdAjKczwCyRV3LeFoVCrhQsm2xc2yO02cndEh9Ibi5bBUZuPYUBD/KuOVLHrSG4vMSwyNQOXBdkD1C2V48pNwqJfKBXXgT+BEXDhwhSCmQrXRg5LxC3ChNLM1sVSqTa5oXux5UjvEkGNmUWe7Q27DxPou8bWV4PO1AUmVXimjjyMQP2Eo7rRbW6f4ckGOHkLIeaT7NK4BejM6iDUQ4p0a2wpTSmIoVDffPV2JW3MweNepEokuf7QsWYxBgqFnJ7A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKdwc-0004gb-7K for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2024 08:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Dec 2024 13:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74287 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74287-submit@debbugs.gnu.org id=B74287.173375136617926 (code B ref 74287); Mon, 09 Dec 2024 13:37:02 +0000 Original-Received: (at 74287) by debbugs.gnu.org; 9 Dec 2024 13:36:06 +0000 Original-Received: from localhost ([127.0.0.1]:53269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKdvh-0004f3-P1 for submit@debbugs.gnu.org; Mon, 09 Dec 2024 08:36:06 -0500 Original-Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]:47439) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKdve-0004eU-Qj for 74287@debbugs.gnu.org; Mon, 09 Dec 2024 08:36:04 -0500 Original-Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 60AB311401B3; Mon, 9 Dec 2024 08:35:57 -0500 (EST) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Mon, 09 Dec 2024 08:35:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1733751357; x=1733837757; bh=Tc909s4faU lnsHVxKRxahqipyJNKG7OB3ykEr8t34iE=; b=SDARuARv320fWDm+Kw9hEO11jt gmx0zZ5wuAE4/8DvPeauxMlw9tBjv6Vr9/TYnvQaairpPWERynVSq9xRvaMM8Qf9 Ad9tn56B1OjpNZon9Uyk8XsB14Sj9GWjEN2tF4OXDWoM6yzFxEaCSSjpfgwZwXuk bAuDEQcNVbeblz0yP+eOKZnrlYkV2GwKzi9/scNR32x44bS0bHpA+H47ksuLXm/S GxoxWQLorbvphxX0EPMoSwQMENjn8eWh/bgzoHCNRkARmg86Wgb9E0pTnSK9XgnN N6o67gP2vy6RsbCQJz6t4b1+tLe4e4MpRgHFaIFHEWSgJaUEs/Gay4Czz0TA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1733751357; x=1733837757; bh=Tc909s4faUlnsHVxKRxahqipyJNKG7OB3yk Er8t34iE=; b=r+7mPhlzVYvFO1SD7HQ7jk4AbnBZ2MtJcXAXnnlHWuuWRLYS+hJ RxQL5u99LZYhksmbH02quLlNMzz8Dt83+zc2+vdIZKWMaJ2Tv5lnEoihclxSpI+p tUd1QNMOxRykfQqF3CUetAU3ajG5ketNJLgtUi5MrJmU50YtuywEpNRHlu6o0laZ KJ2ryA2/NAKXrDrV1XU5GHBX+gYllfqHSjA42e9ML5mLFVDZXDo/0zTn7jMWz2nB 7rdve+0mJjfQvvaicpP9zFVVxrJQAJWF3i2nab3khm90blV0iL0IdeT6wSzhnxfn 3UiqXnLy7r8pnmBLi3mRIzKFBQYUsNhc9yw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrjeeigddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhvfevufgjfhffkfggtgesmhdtreertddttdenucfh rhhomheprfgvnhhgjhhiucgkhhgrnhhguceomhgvsehpvghnghhjihiirdgtohhmqeenuc ggtffrrghtthgvrhhnpeeifffgieeulefgjeejiedvleehffffueeiiefhhfffveejuefh gedvhfekgfelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehmvgesphgvnhhgjhhiiidrtghomhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepjhhpohhrthgvrhgsuhhgshesghhmrghilhdrtg homhdprhgtphhtthhopehjuhhriheslhhinhhkohhvrdhnvghtpdhrtghpthhtohepjeeg vdekjeesuggvsggsuhhgshdrghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i16614472:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Dec 2024 08:35:56 -0500 (EST) In-Reply-To: <87cyi159vo.fsf@pengjiz.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296689 Archived-At: --=-=-= Content-Type: text/plain Pengji Zhang writes: > Jim Porter writes: > >> Is there a way we could change this so that users who use 'setopt' >> (or even 'setq'?) instead of the Customize package can enable this >> feature? > > Indeed, it only works with 'M-x customize' (and friends). I guess we > can instead save the original value to another variable and restore > from it. How about the change in the attachment? If it looks good to you, I will merge it into the main patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=em-hist-restore-option.patch diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index c85e7704eca..4bcf434f6e4 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -218,6 +218,9 @@ eshell--history-isearch-message-overlay "Overlay for Isearch message when searching through input history.") (defvar-local eshell--stored-incomplete-input nil "Stored input for history cycling.") +(defvar eshell--force-history-isearch nil + "Non-nil means to force searching in input history. +If nil, respect the option `eshell-history-isearch'.") (defvar-keymap eshell-hist-mode-map "" #'eshell-previous-matching-input-from-input @@ -951,7 +954,8 @@ eshell--isearch-setup (when (and ;; Eshell is busy running a foreground process (not eshell-foreground-command) - (or (eq eshell-history-isearch t) + (or eshell--force-history-isearch + (eq eshell-history-isearch t) (and (eq eshell-history-isearch 'dwim) (>= (point) eshell-last-output-end)))) (setq isearch-message-prefix-add "history ") @@ -975,7 +979,7 @@ eshell-history-isearch-end (remove-hook 'isearch-mode-end-hook #'eshell-history-isearch-end t) (setq isearch-opoint (point)) (unless isearch-suspended - (custom-reevaluate-setting 'eshell-history-isearch))) + (setq eshell--force-history-isearch nil))) (defun eshell-history-isearch-search () "Return search function for Isearch in input history." @@ -1077,7 +1081,7 @@ eshell-history-isearch-push-state (defun eshell-isearch-backward (&optional invert) "Do incremental search backward through past commands." (interactive nil eshell-mode) - (setq eshell-history-isearch t) + (setq eshell--force-history-isearch t) (if invert (isearch-forward nil t) (isearch-backward nil t))) @@ -1090,7 +1094,7 @@ eshell-isearch-forward (defun eshell-isearch-backward-regexp (&optional invert) "Do incremental regexp search backward through past commands." (interactive nil eshell-mode) - (setq eshell-history-isearch t) + (setq eshell--force-history-isearch t) (if invert (isearch-forward-regexp nil t) (isearch-backward-regexp nil t))) --=-=-=--