From: Matthew Bauer <mjbauer95@gmail.com>
To: 36034@debbugs.gnu.org
Subject: bug#36034: [PATCH] Zsh extended_history shows up in comint input ring
Date: Fri, 31 May 2019 16:30:44 -0400 [thread overview]
Message-ID: <87woi6e58r.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
Currently, Zsh’s extended_history option is not handled well in Emacs.
The comint buffer does not know to skip it when running
comint-read-input-ring. The attached patch handles this.
This behavior is described in the Zsh manual available at:
http://zsh.sourceforge.net/Doc/Release/Options.html#History
The format of this line looks like this:
: <beginning time>:<elapsed seconds>;<command>
This patch just skips those timestamp to get the <command> part.
[-- Attachment #2: 0001-Add-zsh-extended_history-handling-for-comint.el-inpu.patch --]
[-- Type: text/x-patch, Size: 1607 bytes --]
From b8a8857cd686fae1ebbeca79f4469ce878837b90 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Fri, 31 May 2019 16:27:24 -0400
Subject: [PATCH] Add zsh extended_history handling for comint.el input ring
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Adds handling of the Zsh extended_history to comint.el input
ring. This means that the timestamp doesn’t show up when reading
through history from other shells. The lines look like this:
: <beginning time>:<elapsed seconds>;<command>
This patch skips the part before <command>.
Zsh documents it here:
http://zsh.sourceforge.net/Doc/Release/Options.html#History
---
lisp/comint.el | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lisp/comint.el b/lisp/comint.el
index 3dce1c9c8d..c5c0ad0f7b 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -976,7 +976,11 @@ See also `comint-input-ignoredups' and `comint-write-input-ring'."
(setq start
(if (re-search-backward comint-input-ring-separator
nil t)
- (match-end 0)
+ (progn
+ ;; Skip zsh extended_history stamps
+ (re-search-forward ": [[:digit:]]+:[[:digit:]]+;" nil t)
+
+ (match-end 0))
(point-min)))
(setq history (buffer-substring start end))
(goto-char start)
--
2.21.0
next reply other threads:[~2019-05-31 20:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 20:30 Matthew Bauer [this message]
2019-06-23 16:53 ` bug#36034: [PATCH] Zsh extended_history shows up in comint input ring Lars Ingebrigtsen
2019-06-23 22:27 ` Matthew Bauer
2019-06-24 10:51 ` Lars Ingebrigtsen
2019-06-24 22:45 ` Matthew Bauer
2019-06-25 11:05 ` Lars Ingebrigtsen
2019-06-29 21:35 ` Matthew Bauer
2019-07-04 13:37 ` Lars Ingebrigtsen
2020-01-20 19:43 ` Stefan Kangas
2020-03-18 15:05 ` Matthew Bauer
2020-08-10 11:11 ` Lars Ingebrigtsen
2019-06-24 10:51 ` Lars Ingebrigtsen
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=87woi6e58r.fsf@gmail.com \
--to=mjbauer95@gmail.com \
--cc=36034@debbugs.gnu.org \
/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).