From: Pengji Zhang <me@pengjiz.com>
To: Jim Porter <jporterbugs@gmail.com>, Juri Linkov <juri@linkov.net>
Cc: 74287@debbugs.gnu.org
Subject: bug#74287: [PATCH] Rework history Isearch for Eshell
Date: Mon, 09 Dec 2024 21:35:52 +0800 [thread overview]
Message-ID: <87wmg9htc7.fsf@pengjiz.com> (raw)
In-Reply-To: <87cyi159vo.fsf@pengjiz.com>
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
Pengji Zhang <me@pengjiz.com> writes:
> Jim Porter <jporterbugs@gmail.com> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: em-hist-restore-option.patch --]
[-- Type: text/x-patch, Size: 2190 bytes --]
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
"<up>" #'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)))
next prev parent reply other threads:[~2024-12-09 13:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-10 1:22 bug#74287: [PATCH] Rework history Isearch for Eshell Pengji Zhang
2024-11-10 23:40 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-12 8:54 ` Pengji Zhang
2024-11-26 6:53 ` Jim Porter
2024-11-26 9:41 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-26 17:00 ` Jim Porter
2024-11-27 5:37 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-04 18:56 ` Juri Linkov
2024-12-05 12:43 ` Pengji Zhang
2024-12-05 12:53 ` Pengji Zhang
2024-12-09 4:34 ` Jim Porter
2024-12-09 12:16 ` Pengji Zhang
2024-12-09 13:35 ` Pengji Zhang [this message]
2024-12-09 19:06 ` Jim Porter
2024-12-09 18:23 ` Juri Linkov
2024-12-10 0:55 ` Pengji Zhang
2024-12-10 7:46 ` Juri Linkov
2024-12-10 11:01 ` Pengji Zhang
2024-12-10 17:41 ` Juri Linkov
2024-12-11 0:45 ` Pengji Zhang
2024-12-11 7:06 ` Juri Linkov
2024-12-11 19:58 ` Jim Porter
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=87wmg9htc7.fsf@pengjiz.com \
--to=me@pengjiz.com \
--cc=74287@debbugs.gnu.org \
--cc=jporterbugs@gmail.com \
--cc=juri@linkov.net \
/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).