bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36034: [PATCH] Zsh extended_history shows up in comint input ring


From: Matthew Bauer
Subject: bug#36034: [PATCH] Zsh extended_history shows up in comint input ring
Date: Fri, 31 May 2019 16:30:44 -0400

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.

>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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]