GNU bug report logs - #36034
[PATCH] Zsh extended_history shows up in comint input ring

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Matthew Bauer <mjbauer95@HIDDEN>; Keywords: patch; dated Fri, 31 May 2019 20:43:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 36034 <at> debbugs.gnu.org:


Received: (at 36034) by debbugs.gnu.org; 4 Jul 2019 13:37:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 04 09:37:35 2019
Received: from localhost ([127.0.0.1]:50581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hj1vb-0001s1-Gf
	for submit <at> debbugs.gnu.org; Thu, 04 Jul 2019 09:37:35 -0400
Received: from quimby.gnus.org ([80.91.231.51]:37468)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1hj1vZ-0001rq-LO
 for 36034 <at> debbugs.gnu.org; Thu, 04 Jul 2019 09:37:34 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories)
 by quimby.gnus.org with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <larsi@HIDDEN>)
 id 1hj1vV-0001zo-Ct; Thu, 04 Jul 2019 15:37:31 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Matthew Bauer <mjbauer95@HIDDEN>
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
References: <87woi6e58r.fsf@HIDDEN> <m3lfxs6y59.fsf@HIDDEN>
 <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN>
 <m3ftnyk46o.fsf@HIDDEN>
 <3FE84EF1-D1F2-4F8B-B89C-C147C922F32D@HIDDEN>
 <m3h88eexhp.fsf@HIDDEN>
 <3761BF5D-AD36-4F7D-8518-CEFD3A3AC6E6@HIDDEN>
Date: Thu, 04 Jul 2019 15:37:29 +0200
In-Reply-To: <3761BF5D-AD36-4F7D-8518-CEFD3A3AC6E6@HIDDEN> (Matthew Bauer's
 message of "Sat, 29 Jun 2019 17:35:19 -0400")
Message-ID: <m3k1cx7wfa.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Matthew Bauer <mjbauer95@HIDDEN> writes: > (setq start
 > (if (re-search-backward comint-input-ring-separator > nil t) > - (match-end
 0) > - (point-min))) > + (progn > + (when comint-input-ring-file-prefix >
 + ;; Skip zsh extended_history sta [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36034
Cc: 36034 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Matthew Bauer <mjbauer95@HIDDEN> writes:

>                   (setq start
>                         (if (re-search-backward comint-input-ring-separator
>                                                 nil t)
> -                           (match-end 0)
> -                         (point-min)))
> +                           (progn
> +                             (when comint-input-ring-file-prefix
> +                               ;; Skip zsh extended_history stamps
> +                               (re-search-forward comint-input-ring-file-prefix
> +                                                  nil t))
> +                             (match-end 0))

Hm...  I don't think this is right, either.  If the re-search-forward
fails, then (match-end 0) will fail, too.  And since (if I understood
correctly), the prefix will follow on directly from where point it,
using looking-at would be better, anyway...

>        ;; Bypass a bug in certain versions of bash.
>        (when (string-equal shell "bash")
>          (add-hook 'comint-preoutput-filter-functions
> -                  'shell-filter-ctrl-a-ctrl-b nil t)))
> +                  'shell-filter-ctrl-a-ctrl-b nil t))
> +
> +      ;; Skip extended history for zsh.
> +      (when (string-equal shell "zsh")
> +        (setq-local comint-input-ring-file-prefix ": [[:digit:]]+:[[:digit:]]+;")))
>      (comint-read-input-ring t)))

And this bit didn't apply.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.

Message received at 36034 <at> debbugs.gnu.org:


Received: (at 36034) by debbugs.gnu.org; 29 Jun 2019 21:35:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 29 17:35:29 2019
Received: from localhost ([127.0.0.1]:44972 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hhL0K-000551-Sf
	for submit <at> debbugs.gnu.org; Sat, 29 Jun 2019 17:35:29 -0400
Received: from mail-qt1-f180.google.com ([209.85.160.180]:41235)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mjbauer95@HIDDEN>) id 1hhL0I-00054o-Tt
 for 36034 <at> debbugs.gnu.org; Sat, 29 Jun 2019 17:35:27 -0400
Received: by mail-qt1-f180.google.com with SMTP id d17so10408314qtj.8
 for <36034 <at> debbugs.gnu.org>; Sat, 29 Jun 2019 14:35:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:message-id:mime-version:subject:date:in-reply-to:cc:to
 :references; bh=iFXB/0gNsWCtEzVNZ1I3ix4MHp3mIx5WIVLB7EA1yZo=;
 b=mIXw17msTBdTycVHQFRlKQ0Tyyd3kn1t0YthkiXdBFIbhDK8hkcwYFsIViAltpAMCv
 R/MLYor1WngkSl1v9C4Ze909tLVdl4X1X3Po8ACktywcd1YvsNzfxG3S+SHlK4CQZyiV
 lRUzGVngCUbh2YvoxjpIa+b9OIsF8g++xW7hdfJAKcA0BvD6mBtkJSJd2wpY+oNbqZFx
 siLiSVBrs755ScIwdaMkq847G0o6MT7JgbrdJgcxEG/Bybz3ZjWM1HcsvlPsXwPq8kOx
 1O83ZZV+ZRErx1kSqeoE12k3xx0gnyowqXdxLpyTei2sRrV2mwLLW7GU6dJsrKRUJjgU
 Mx2A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:message-id:mime-version:subject:date
 :in-reply-to:cc:to:references;
 bh=iFXB/0gNsWCtEzVNZ1I3ix4MHp3mIx5WIVLB7EA1yZo=;
 b=EYuFfCkw1JYAPrjQzID8LNaau9Pli6IQL2yJlc0WqIs8oUzqz7Px997K8fMIRQ0Oxh
 y/056YPv7KHXI3V8sENw7S3Em5dXq+FwNkF861Av+bs88nlxG+zcPtHxdMYffWhfVVpT
 TgvICo/MyTMHBX6wjWhLR9OgGbzbJmrgaHTEXQdDf4JU38jQjvKkzQivbzpZje8TsWTJ
 I4296UNvhO1MPkx6TDSZU8Z8Q7GE7YaWGF7uEJBfNip5ZeqjatbOatoDzEj3WBY0bjMr
 qfdPJ85uZkmgI+Ts9PS1QDzkIPPAhQ5e9j7Aa7Ikt0R4mJcbRhb+1+RDW3+CnJ7cZOml
 YhVA==
X-Gm-Message-State: APjAAAUT99qdZ68Gb+3uHqh0DtbwppDs8EY5l9V6vAFFLHzUfRWTWEsv
 r+ZdJ4bSbB9wPlpnzfiP6mw=
X-Google-Smtp-Source: APXvYqwrF5GXaE4Qt3GTpDhJZeRE/7rh2eELyZv1UNhK83YCuEhwq2U9v3RN22sPj8M4zI9hC+42QQ==
X-Received: by 2002:a0c:b7a8:: with SMTP id l40mr14465944qve.142.1561844121088; 
 Sat, 29 Jun 2019 14:35:21 -0700 (PDT)
Received: from matthewsmacbook.home (ool-457386fe.dyn.optonline.net.
 [69.115.134.254])
 by smtp.gmail.com with ESMTPSA id o54sm3213235qtb.63.2019.06.29.14.35.20
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 29 Jun 2019 14:35:20 -0700 (PDT)
From: Matthew Bauer <mjbauer95@HIDDEN>
Message-Id: <3761BF5D-AD36-4F7D-8518-CEFD3A3AC6E6@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_2DCFBCEE-AC5B-4EBD-B21F-34F6283C9E5D"
Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3560.7\))
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
Date: Sat, 29 Jun 2019 17:35:19 -0400
In-Reply-To: <m3h88eexhp.fsf@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87woi6e58r.fsf@HIDDEN> <m3lfxs6y59.fsf@HIDDEN>
 <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN> <m3ftnyk46o.fsf@HIDDEN>
 <3FE84EF1-D1F2-4F8B-B89C-C147C922F32D@HIDDEN> <m3h88eexhp.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3560.7)
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 36034
Cc: 36034 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)


--Apple-Mail=_2DCFBCEE-AC5B-4EBD-B21F-34F6283C9E5D
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii


> On Jun 25, 2019, at 7:05 AM, Lars Ingebrigtsen <larsi@HIDDEN> wrote:

> This will make point end up at where (match-end 0) would be after the
> looking-at, surely?
> 

Ok yeah that simplified things a bit. Attached an updated version.


--Apple-Mail=_2DCFBCEE-AC5B-4EBD-B21F-34F6283C9E5D
Content-Disposition: attachment;
	filename=0001-Add-zsh-extended_history-handling-for-comint.el-inpu.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-Add-zsh-extended_history-handling-for-comint.el-inpu.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20286ceba115b3deabfd90e589c3dbebf03a992e25=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Matthew=20Bauer=20<mjbauer95@HIDDEN>=0A=
Date:=20Sun,=2023=20Jun=202019=2018:08:32=20-0400=0ASubject:=20[PATCH]=20=
Add=20zsh=20extended_history=20handling=20for=20comint.el=20input=20ring=0A=
MIME-Version:=201.0=0AContent-Type:=20text/plain;=20charset=3DUTF-8=0A=
Content-Transfer-Encoding:=208bit=0A=0AAdds=20handling=20of=20the=20Zsh=20=
extended_history=20to=20comint.el=20input=0Aring.=20This=20means=20that=20=
the=20timestamp=20doesn=E2=80=99t=20show=20up=20when=20reading=0Athrough=20=
history=20from=20other=20shells.=20The=20lines=20look=20like=20this:=0A=0A=
:=20<beginning=20time>:<elapsed=20seconds>;<command>=0A=0AThis=20patch=20=
skips=20the=20part=20before=20<command>=20when=20the=20=E2=80=98shell=E2=80=
=99=20is=0Azsh.=20This=20is=20done=20through=20the=20=
comint-input-ring-file-prefix=0Avariable.=20When=20set,=20this=20will=20=
skip=20a=20prefix=20of=20the=20file=20when=20loading=0Ainto=20the=20=
input=20ring.=20This=20matches=20the=20behavior=20of=20Zsh.=20Zsh=20=
documents=0Ait=20here:=0A=0A=
http://zsh.sourceforge.net/Doc/Release/Options.html#History=0A---=0A=20=
lisp/comint.el=20|=2018=20++++++++++++++++--=0A=20lisp/shell.el=20=20|=20=
=206=20+++++-=0A=202=20files=20changed,=2021=20insertions(+),=203=20=
deletions(-)=0A=0Adiff=20--git=20a/lisp/comint.el=20b/lisp/comint.el=0A=
index=2056e38e24ac..6d4293b722=20100644=0A---=20a/lisp/comint.el=0A+++=20=
b/lisp/comint.el=0A@@=20-249,6=20+249,10=20@@=20to=20set=20this=20in=20a=20=
mode=20hook,=20rather=20than=20customize=20the=20default=20value."=0A=20=09=
=09=20file)=0A=20=20=20:group=20'comint)=0A=20=0A+(defvar=20=
comint-input-ring-file-prefix=20nil=0A+=20=20"The=20prefix=20to=20skip=20=
when=20parsing=20the=20input=20ring=20file.=0A+This=20is=20useful=20in=20=
Zsh=20when=20the=20extended_history=20option=20is=20on.")=0A+=0A=20=
(defcustom=20comint-scroll-to-bottom-on-input=20nil=0A=20=20=20"Controls=20=
whether=20input=20to=20interpreter=20causes=20window=20to=20scroll.=0A=20=
If=20nil,=20then=20do=20not=20scroll.=20=20If=20t=20or=20`all',=20scroll=20=
all=20windows=20showing=20buffer.=0A@@=20-978,8=20+982,18=20@@=20See=20=
also=20`comint-input-ignoredups'=20and=20`comint-write-input-ring'."=0A=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20start=0A=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20=
(re-search-backward=20comint-input-ring-separator=0A=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20t)=0A-=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(match-end=200)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(point-min)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(progn=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(when=20comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Skip=20=
zsh=20extended_history=20stamps=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(re-search-forward=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20nil=20t))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(match-end=20=
0))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(progn=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(goto-char=20(point-min))=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(when=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(re-search-forward=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20nil=20t))=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(point))))=0A=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20history=20=
(buffer-substring=20start=20end))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20(goto-char=20start)=0A=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20(when=20(and=20(not=20(string-match=20=
comint-input-history-ignore=0Adiff=20--git=20a/lisp/shell.el=20=
b/lisp/shell.el=0Aindex=20e30825cd66..25f6892d96=20100644=0A---=20=
a/lisp/shell.el=0A+++=20b/lisp/shell.el=0A@@=20-600,7=20+600,11=20@@=20=
buffer."=0A=20=20=20=20=20=20=20;;=20Bypass=20a=20bug=20in=20certain=20=
versions=20of=20bash.=0A=20=20=20=20=20=20=20(when=20(string-equal=20=
shell=20"bash")=0A=20=20=20=20=20=20=20=20=20(add-hook=20=
'comint-preoutput-filter-functions=0A-=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20'shell-filter-ctrl-a-ctrl-b=20nil=20t)))=0A+=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20'shell-filter-ctrl-a-ctrl-b=20=
nil=20t))=0A+=0A+=20=20=20=20=20=20;;=20Skip=20extended=20history=20for=20=
zsh.=0A+=20=20=20=20=20=20(when=20(string-equal=20shell=20"zsh")=0A+=20=20=
=20=20=20=20=20=20(setq-local=20comint-input-ring-file-prefix=20":=20=
[[:digit:]]+:[[:digit:]]+;")))=0A=20=20=20=20=20(comint-read-input-ring=20=
t)))=0A=20=0A=20(defun=20shell-apply-ansi-color=20(beg=20end=20face)=0A=
--=20=0A2.22.0=0A=0A=

--Apple-Mail=_2DCFBCEE-AC5B-4EBD-B21F-34F6283C9E5D--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.

Message received at 36034 <at> debbugs.gnu.org:


Received: (at 36034) by debbugs.gnu.org; 25 Jun 2019 11:05:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 25 07:05:28 2019
Received: from localhost ([127.0.0.1]:58713 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfjGR-0000rE-Qu
	for submit <at> debbugs.gnu.org; Tue, 25 Jun 2019 07:05:28 -0400
Received: from quimby.gnus.org ([80.91.231.51]:46838)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1hfjGQ-0000r5-Dl
 for 36034 <at> debbugs.gnu.org; Tue, 25 Jun 2019 07:05:26 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories)
 by quimby.gnus.org with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <larsi@HIDDEN>)
 id 1hfjGN-0007BN-2x; Tue, 25 Jun 2019 13:05:25 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Matthew Bauer <mjbauer95@HIDDEN>
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
References: <87woi6e58r.fsf@HIDDEN> <m3lfxs6y59.fsf@HIDDEN>
 <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN>
 <m3ftnyk46o.fsf@HIDDEN>
 <3FE84EF1-D1F2-4F8B-B89C-C147C922F32D@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVqhlq8HEWOwMzqJzbx
 JDbnITb4+DtnYFi6GS+/LkGpFTKDCUjkD3+EP1uBqoLTHj/f+5OGAAACV0lEQVQ4jV3TTWgTURAA
 4AeC0YtQ8OhpL6EgvWSR2nqRzvbXEIQs+IMUWtlzscpShV7s4WU9JGigTUE8NIclFy+WSJ4/CN4S
 D0ohgiyIl9DLnhq6TQ9x5r39S+a28+28mXnZsIlrHRnfYSTmWAy5UWFhvtMRYNSdfsMZnLkzpVIC
 38SOcVjm7nngOM5gkEBbfFCHjx/VFjsAhttwpl+WnZKT7qEjHATO9Ec3GNSAdZLmGCcGQA6MJe36
 GMhYfvBL01LwecK7qmA3O5UGz/N+SshrWqrCI/DkwFoM7U8/PAVFKvgn4RbBYd5LKvL2EwL9Du5W
 Lyg4UkDCdFgUog5578/G5T6EgML05dYsAsxdtKx1Ca8RthEW9VnxFWDewnishlUA8Ko1A3DDkpHL
 0UwhnNNthGBZNomCFYL5GOS0EgpjEO6BSXmxKQj3wEVSsNZLYKUFSXdNy8bwUH4GqsmaRhJV1OVt
 U37dpomyCgrd51Up9C125Rpqql3sdhD93t1wDYQlms+uJoD3QVA8lbCZAupzzO6zjBRdwe2uhEnO
 KgwDH56GJXdRtKk9zlgIW5CI9ps7LJYwb5r3mpNBDJkYDHM14DwGFoFpmsMhQiOCzFZUYAZY0YiB
 bZ55VQnD8ijQYEU6ig5yEniLkD2BIp5EHSJ4Awu2aNpH2AFnwvcRarVa5QLAQla8EM9wplUeQr9I
 n/7NSk/YzXfYQXYmCN5j/pSxnmhu+P7xkEcwcPFPytiVXlNs+75/iXNXHcXLJuAN+70vNub9v6pD
 o8V433zECOh9jH2ZF+I/QIbz8E4uSaIAAAAASUVORK5CYII=
Date: Tue, 25 Jun 2019 13:05:22 +0200
In-Reply-To: <3FE84EF1-D1F2-4F8B-B89C-C147C922F32D@HIDDEN> (Matthew Bauer's
 message of "Mon, 24 Jun 2019 18:45:51 -0400")
Message-ID: <m3h88eexhp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Matthew Bauer <mjbauer95@HIDDEN> writes: > - (match-end
 0) > - (point-min))) > + (progn > + (when (and > +
 comint-input-ring-file-prefix
 > + (looking-at (concat > comint-input-ring-separator > +
 comint-input-ring-file-prefix))) > + ;; Skip z [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36034
Cc: 36034 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Matthew Bauer <mjbauer95@HIDDEN> writes:

>  -                           (match-end 0)
>  -                         (point-min)))
>  +                           (progn
>  +                             (when (and
>  +                                    comint-input-ring-file-prefix
>  +                                    (looking-at (concat
>  comint-input-ring-separator
>  +                                                        comint-input-ri=
ng-file-prefix)))
>  +                               ;; Skip zsh extended_history stamps
>  +                               (re-search-forward comint-input-ring-fil=
e-prefix
>  +                                                  nil t))
>  +                             (match-end 0))
>
>  The re-search-forward here doesn't seem necessary -- can't you just go
>  to (match-end 0) here instead?
>
> Without re-search-forward, the =E2=80=9Cstart=E2=80=9D integer would just=
 be the character
> right after the newline. re-search-forward skips that prefix.

You first do a

(looking-at (concat comint-input-ring-separator comint-input-ring-file-pref=
ix)))

and then

(re-search-forward comint-input-ring-file-prefix)

This will make point end up at where (match-end 0) would be after the
looking-at, surely?

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.

Message received at 36034 <at> debbugs.gnu.org:


Received: (at 36034) by debbugs.gnu.org; 24 Jun 2019 22:46:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 18:46:08 2019
Received: from localhost ([127.0.0.1]:58253 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfXiw-0000qY-L1
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2019 18:46:08 -0400
Received: from mail-qt1-f176.google.com ([209.85.160.176]:40714)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mjbauer95@HIDDEN>) id 1hfXir-0000pj-7u
 for 36034 <at> debbugs.gnu.org; Mon, 24 Jun 2019 18:46:04 -0400
Received: by mail-qt1-f176.google.com with SMTP id a15so16341430qtn.7
 for <36034 <at> debbugs.gnu.org>; Mon, 24 Jun 2019 15:46:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:message-id:mime-version:subject:date:in-reply-to:cc:to
 :references; bh=uEDCCmg8sGQKODS4IBmQENp4GR/PKlWEEbNzKFGo3JQ=;
 b=KmXYNQeNoTMqzlQqLyd7n8mNvcocxB239X7tBWODeU0OHtZqJ65GkOrtc0c56IGSPz
 7zcpgElYXleaf0ogYsRBorbw8jYfB6sb0RhRcRIHdtCkfLXm0xRAISTw55+sxi1F2Cqw
 QoNJa9fmlKF0UAzfARuG0NiRFgxVqItkVJ8sxCyRdEZHA4c0aHsgdtLOVZV/lK1HHM5L
 NSuEJlJb2ndJc4nvytUuJ//8dJEqWgsJ4jNOkdNWePaqI/1OsW3v8XRyDqCVwjH2Aoo8
 B8FQsDSyuFmpYpmYUDDD3vnMYAQssSjmmMVhXzoZ8VmKQZLkqq3t7tH7wqxh+xtLxhpZ
 0+9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:message-id:mime-version:subject:date
 :in-reply-to:cc:to:references;
 bh=uEDCCmg8sGQKODS4IBmQENp4GR/PKlWEEbNzKFGo3JQ=;
 b=TLMQNvkkmADAH9TFowO8MVLV4y1UottkYrllCDdOQG0s5ecehtxrvi61hGY29ck6EF
 oM85ACBgv0Q7hhs8hxp6/ZuxfmJJH4BaGaiGeeOwpeH0SbfQmcmTyNELK4hjHU4mvp/J
 74m7flGEnyyjbLzE0wGYjcZb11h+LdgzzSoih9fKmUGaA+orogwUtMFZE5p46+vcCSJQ
 nX48iEW0NQM0kHnO/yn1IXnrO3DTEkTerCDE1ZRFo+5b6a7LS6PRjg5YGMLDxdCSGSfk
 DVlXozsbLZeZvvoo3MQfccJYknDfovMHp2AflvtBQXQdtsYoWZ8omyL9iZpoK5zSQkq5
 bbcw==
X-Gm-Message-State: APjAAAWjpUsPTV9L2rQJH1Wgbcw2bo3lA/562e8jedcAlhFgmhFgIX54
 wcEgtRS4taeyANXAx34H1fg=
X-Google-Smtp-Source: APXvYqzmzG2WKTe1jNiIo2BiT/GlLQi460hdgzfwEvfzMBaCmxaGx6CtjBHyEi8A+RwRDCnYqtLXiQ==
X-Received: by 2002:ac8:2edc:: with SMTP id i28mr110375832qta.77.1561416355487; 
 Mon, 24 Jun 2019 15:45:55 -0700 (PDT)
Received: from matthewsmacbook.home (ool-457386fe.dyn.optonline.net.
 [69.115.134.254])
 by smtp.gmail.com with ESMTPSA id f9sm6186616qtl.75.2019.06.24.15.45.54
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 24 Jun 2019 15:45:54 -0700 (PDT)
From: Matthew Bauer <mjbauer95@HIDDEN>
Message-Id: <3FE84EF1-D1F2-4F8B-B89C-C147C922F32D@HIDDEN>
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_BAF05346-57A1-43BA-B7AD-4FA8EBCC3885"
Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3554.18.2\))
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
Date: Mon, 24 Jun 2019 18:45:51 -0400
In-Reply-To: <m3ftnyk46o.fsf@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87woi6e58r.fsf@HIDDEN> <m3lfxs6y59.fsf@HIDDEN>
 <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN> <m3ftnyk46o.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3554.18.2)
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 36034
Cc: 36034 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)


--Apple-Mail=_BAF05346-57A1-43BA-B7AD-4FA8EBCC3885
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> On Jun 24, 2019, at 6:51 AM, Lars Ingebrigtsen <larsi@HIDDEN> wrote:
>=20
> Matthew Bauer <mjbauer95@HIDDEN> writes:
>=20
>> +(defcustom comint-input-ring-file-prefix nil
>> +  "If non-nil, the prefix to skip when parsing the input ring file.
>> +This is useful in Zsh when the extended_history option is on."
>> +  :type 'boolean
>> +  :group 'comint)
>=20
> This doesn't really seem like a user-level variable, so it should just
> be a defvar, I think.

Seems reasonable, I updated the patch.

>=20
>>                  (setq start
>>                        (if (re-search-backward =
comint-input-ring-separator
>>                                                nil t)
>> -                           (match-end 0)
>> -                         (point-min)))
>> +                           (progn
>> +                             (when (and
>> +                                    comint-input-ring-file-prefix
>> +                                    (looking-at (concat =
comint-input-ring-separator
>> +                                                        =
comint-input-ring-file-prefix)))
>> +                               ;; Skip zsh extended_history stamps
>> +                               (re-search-forward =
comint-input-ring-file-prefix
>> +                                                  nil t))
>> +                             (match-end 0))
>=20
> The re-search-forward here doesn't seem necessary -- can't you just go
> to (match-end 0) here instead?

Without re-search-forward, the =E2=80=9Cstart=E2=80=9D integer would =
just be the character right after the newline. re-search-forward skips =
that prefix.

>> +                         (progn
>> +                           (goto-char (point-min))
>> +                           (if (and comint-input-ring-file-prefix
>> +                                    (looking-at =
comint-input-ring-file-prefix))
>> +                               (progn
>> +                                 (re-search-forward =
comint-input-ring-file-prefix
>> +                                                    nil t)
>> +                                 (match-end 0))
>> +                             (point-min)))))
>=20
> And I don't understand this bit.  This is when we didn't find
> comint-input-ring-separator, right?  But you still want to skip
> comint-input-ring-file-prefix?
>=20
> If you want to skip it anyway, then you can just have the check (and =
the
> skip) after the if statement=E2=80=A6
>=20

This is for the very first line which will not have a newline before it. =
In this case, we want to skip the prefix as well. This is part of why we =
need special handling for =E2=80=9Cprefix" and tricks like this don=E2=80=99=
t work:

https://emacs.stackexchange.com/a/22295 =
<https://emacs.stackexchange.com/a/22295>


--Apple-Mail=_BAF05346-57A1-43BA-B7AD-4FA8EBCC3885
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_C06798D8-295E-4113-9A8B-A6540778E10F"


--Apple-Mail=_C06798D8-295E-4113-9A8B-A6540778E10F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Jun 24, 2019, at 6:51 AM, Lars Ingebrigtsen &lt;<a =
href=3D"mailto:larsi@HIDDEN" class=3D"">larsi@HIDDEN</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div =
class=3D"">Matthew Bauer &lt;<a href=3D"mailto:mjbauer95@HIDDEN" =
class=3D"">mjbauer95@HIDDEN</a>&gt; writes:<br =
class=3D""></div></div></blockquote><blockquote type=3D"cite" =
class=3D""><div class=3D""><div class=3D""><br class=3D""><blockquote =
type=3D"cite" class=3D"">+(defcustom comint-input-ring-file-prefix =
nil<br class=3D"">+ &nbsp;"If non-nil, the prefix to skip when parsing =
the input ring file.<br class=3D"">+This is useful in Zsh when the =
extended_history option is on."<br class=3D"">+ &nbsp;:type 'boolean<br =
class=3D"">+ &nbsp;:group 'comint)<br class=3D""></blockquote><br =
class=3D"">This doesn't really seem like a user-level variable, so it =
should just<br class=3D"">be a defvar, I =
think.</div></div></blockquote><div><br class=3D""></div><div>Seems =
reasonable, I updated the patch.</div><br class=3D""><blockquote =
type=3D"cite" class=3D""><div class=3D""><div class=3D""><br =
class=3D""><blockquote type=3D"cite" class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;(setq start<br class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(if =
(re-search-backward comint-input-ring-separator<br class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nil t)<br =
class=3D"">- =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;(match-end 0)<br class=3D"">- =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(poi=
nt-min)))<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;(progn<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;(when (and<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comint-input=
-ring-file-prefix<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(looking-at =
(concat comint-input-ring-separator<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comint-input-ring-file-prefix)))<br =
class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;; Skip zsh extended_history stamps<br =
class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(re-search-forward =
comint-input-ring-file-prefix<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ni=
l t))<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;(match-end 0))<br class=3D""></blockquote><br =
class=3D"">The re-search-forward here doesn't seem necessary -- can't =
you just go<br class=3D"">to (match-end 0) here instead?<br =
class=3D""></div></div></blockquote><div><br class=3D""></div>Without =
re-search-forward, the =E2=80=9Cstart=E2=80=9D integer would just be the =
character right after the newline. re-search-forward skips that =
prefix.<br class=3D""><br class=3D""><blockquote type=3D"cite" =
class=3D""><div class=3D""><div class=3D""><blockquote type=3D"cite" =
class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(pro=
gn<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;(goto-char (point-min))<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;(if (and comint-input-ring-file-prefix<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(looking-at =
comint-input-ring-file-prefix))<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(progn<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(re-search-forward =
comint-input-ring-file-prefix<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;nil t)<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(match-end 0))<br class=3D"">+=
 =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;(point-min)))))<br class=3D""></blockquote><br =
class=3D"">And I don't understand this bit. &nbsp;This is when we didn't =
find<br class=3D"">comint-input-ring-separator, right? &nbsp;But you =
still want to skip<br class=3D"">comint-input-ring-file-prefix?<br =
class=3D""><br class=3D"">If you want to skip it anyway, then you can =
just have the check (and the<br class=3D"">skip) after the if =
statement=E2=80=A6<br class=3D""><br =
class=3D""></div></div></blockquote><div><br class=3D""></div>This is =
for the very first line which will not have a newline before it. In this =
case, we want to skip the prefix as well. This is part of why we need =
special handling for =E2=80=9Cprefix" and tricks like this don=E2=80=99t =
work:</div><div><br class=3D""></div><div><a =
href=3D"https://emacs.stackexchange.com/a/22295" =
class=3D"">https://emacs.stackexchange.com/a/22295</a></div><div><br =
class=3D""></div></body></html>=

--Apple-Mail=_C06798D8-295E-4113-9A8B-A6540778E10F
Content-Disposition: attachment;
	filename=0001-Add-zsh-extended_history-handling-for-comint.el-inpu.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-Add-zsh-extended_history-handling-for-comint.el-inpu.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20ad957ff66cb9d48a1ae7772758b40e534392f097=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Matthew=20Bauer=20<mjbauer95@HIDDEN>=0A=
Date:=20Sun,=2023=20Jun=202019=2018:08:32=20-0400=0ASubject:=20[PATCH]=20=
Add=20zsh=20extended_history=20handling=20for=20comint.el=20input=20ring=0A=
MIME-Version:=201.0=0AContent-Type:=20text/plain;=20charset=3DUTF-8=0A=
Content-Transfer-Encoding:=208bit=0A=0AAdds=20handling=20of=20the=20Zsh=20=
extended_history=20to=20comint.el=20input=0Aring.=20This=20means=20that=20=
the=20timestamp=20doesn=E2=80=99t=20show=20up=20when=20reading=0Athrough=20=
history=20from=20other=20shells.=20The=20lines=20look=20like=20this:=0A=0A=
:=20<beginning=20time>:<elapsed=20seconds>;<command>=0A=0AThis=20patch=20=
skips=20the=20part=20before=20<command>=20when=20the=20=E2=80=98shell=E2=80=
=99=20is=0Azsh.=20This=20is=20done=20through=20the=20=
comint-input-ring-file-prefix=0Avariable.=20When=20set,=20this=20will=20=
skip=20a=20prefix=20of=20the=20file=20when=20loading=0Ainto=20the=20=
input=20ring.=20This=20matches=20the=20behavior=20of=20Zsh.=20Zsh=20=
documents=0Ait=20here:=0A=0A=
http://zsh.sourceforge.net/Doc/Release/Options.html#History=0A---=0A=20=
lisp/comint.el=20|=2024=20++++++++++++++++++++++--=0A=20lisp/shell.el=20=20=
|=20=206=20+++++-=0A=202=20files=20changed,=2027=20insertions(+),=203=20=
deletions(-)=0A=0Adiff=20--git=20a/lisp/comint.el=20b/lisp/comint.el=0A=
index=2056e38e24ac..dbf239b463=20100644=0A---=20a/lisp/comint.el=0A+++=20=
b/lisp/comint.el=0A@@=20-249,6=20+249,10=20@@=20to=20set=20this=20in=20a=20=
mode=20hook,=20rather=20than=20customize=20the=20default=20value."=0A=20=09=
=09=20file)=0A=20=20=20:group=20'comint)=0A=20=0A+(defvar=20=
comint-input-ring-file-prefix=20nil=0A+=20=20"The=20prefix=20to=20skip=20=
when=20parsing=20the=20input=20ring=20file.=0A+This=20is=20useful=20in=20=
Zsh=20when=20the=20extended_history=20option=20is=20on.")=0A+=0A=20=
(defcustom=20comint-scroll-to-bottom-on-input=20nil=0A=20=20=20"Controls=20=
whether=20input=20to=20interpreter=20causes=20window=20to=20scroll.=0A=20=
If=20nil,=20then=20do=20not=20scroll.=20=20If=20t=20or=20`all',=20scroll=20=
all=20windows=20showing=20buffer.=0A@@=20-978,8=20+982,24=20@@=20See=20=
also=20`comint-input-ignoredups'=20and=20`comint-write-input-ring'."=0A=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20start=0A=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20=
(re-search-backward=20comint-input-ring-separator=0A=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20t)=0A-=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(match-end=200)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(point-min)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(progn=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(when=20(and=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(looking-at=20(concat=20comint-input-ring-separator=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
comint-input-ring-file-prefix)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Skip=20zsh=20=
extended_history=20stamps=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(re-search-forward=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20nil=20t))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(match-end=20=
0))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(progn=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(goto-char=20(point-min))=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20=
(and=20comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(looking-at=20comint-input-ring-file-prefix))=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(progn=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(re-search-forward=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20t)=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(match-end=200))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(point-min)))))=0A=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20(setq=20history=20(buffer-substring=20=
start=20end))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(goto-char=20start)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(when=20(and=20(not=20(string-match=20comint-input-history-ignore=0A=
diff=20--git=20a/lisp/shell.el=20b/lisp/shell.el=0Aindex=20=
e30825cd66..25f6892d96=20100644=0A---=20a/lisp/shell.el=0A+++=20=
b/lisp/shell.el=0A@@=20-600,7=20+600,11=20@@=20buffer."=0A=20=20=20=20=20=
=20=20;;=20Bypass=20a=20bug=20in=20certain=20versions=20of=20bash.=0A=20=20=
=20=20=20=20=20(when=20(string-equal=20shell=20"bash")=0A=20=20=20=20=20=20=
=20=20=20(add-hook=20'comint-preoutput-filter-functions=0A-=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20'shell-filter-ctrl-a-ctrl-b=20nil=20=
t)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
'shell-filter-ctrl-a-ctrl-b=20nil=20t))=0A+=0A+=20=20=20=20=20=20;;=20=
Skip=20extended=20history=20for=20zsh.=0A+=20=20=20=20=20=20(when=20=
(string-equal=20shell=20"zsh")=0A+=20=20=20=20=20=20=20=20(setq-local=20=
comint-input-ring-file-prefix=20":=20[[:digit:]]+:[[:digit:]]+;")))=0A=20=
=20=20=20=20(comint-read-input-ring=20t)))=0A=20=0A=20(defun=20=
shell-apply-ansi-color=20(beg=20end=20face)=0A--=20=0A2.21.0=0A=0A=

--Apple-Mail=_C06798D8-295E-4113-9A8B-A6540778E10F
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""></body></html>
--Apple-Mail=_C06798D8-295E-4113-9A8B-A6540778E10F--

--Apple-Mail=_BAF05346-57A1-43BA-B7AD-4FA8EBCC3885--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.

Message received at 36034 <at> debbugs.gnu.org:


Received: (at 36034) by debbugs.gnu.org; 24 Jun 2019 22:29:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 18:29:40 2019
Received: from localhost ([127.0.0.1]:58238 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfXT1-0000Mc-Ra
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2019 18:29:40 -0400
Received: from quimby.gnus.org ([80.91.231.51]:37600)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1hfXT0-0000MQ-CP
 for 36034 <at> debbugs.gnu.org; Mon, 24 Jun 2019 18:29:38 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories)
 by quimby.gnus.org with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <larsi@HIDDEN>)
 id 1hfXSx-00007I-F0; Tue, 25 Jun 2019 00:29:37 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Matthew Bauer <mjbauer95@HIDDEN>
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
In-Reply-To: <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN> (Matthew Bauer's
 message of "Sun, 23 Jun 2019 18:27:59 -0400")
Date: Mon, 24 Jun 2019 12:51:08 +0200
References: <87woi6e58r.fsf@HIDDEN> <m3lfxs6y59.fsf@HIDDEN>
 <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVVdZEXHjVZ0OYpMUpl
 j6xBUWsL3gelAAACPklEQVQ4jVWUsXbrIAyGVQJ7CTc7lc0erLLn+JCdgnn/V6mEHTdXnqJP0i8J
 CKTORqmX3lLp/MvAAx46w09q0VnXNygmG216K1qboiH1RmRvveAS0KPptMGjc1brLVpLdA/L19rR
 GCr62TpA782y3fw9qGISEbEc9S6l2O/83UC5WEeWGtMEcB8Jmv0Q2R9pWNdAxL9VATCSyMAdILpo
 NzDQ7OhBLIkEUELg8Mh+F0c0NZ4XIFX0RD92FHJWNKSpB9B6RQWTgDgyxo5KhhQqInqOPyT6AeLE
 flSW4qtTHrBDBhsErLvsDriZzMAPYCm1MwM0r91BfYE2xKUUCHiqHfCO2rsGeZxZnGeQgaVbKFxs
 aARQwBlOJmiizQtlgMEXI6Fj2WY0JRpWYSjm2faBJRg0+2ewCzZHF/aCKTBGyI+cEex1drRHi7FP
 bGXAti+OS4z4rDlBQF02bZIZmzgSdrB8hxA4gTeR8xtwVxPmKiInWXFk/Jvmuj2HvD79Am6TWia/
 y+9gZFB0fjG+Gun3PYP3ydd53UKHA8x/IPn6nF8Zw70DdcHNK7P75xP0VqfV4Lfnyf8SBPQl1KAM
 vksLSKl6/oLy+jX1AHw+31j4q/P/QC4l8hPj72j3DxBecFJnrVVuxwGmGhZf5T08Xkn8vqxdv65+
 1DvBPA9QwydGruaPM8/jzNmuM+EHV0P5w4DzaBmgxWlBwud+02XIARb8qSxyUf5Y5Ev8hh9Xjg/1
 bRTI/C4dfn1iYwn0g8i6fgEmpsN4L1MvjgAAAABJRU5ErkJggg==
Message-ID: <m3ftnyk46o.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Matthew Bauer <mjbauer95@HIDDEN> writes: > Yes, it does
 apply for any comint buffer that uses > comint-read-input-ring. i had
 originally
 thought this was only used by > shell-mode, but you are correct that it is
 used by others. Ive added > d [...] 
 Content analysis details:   (-1.4 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 1.5 DATE_IN_PAST_06_12     Date: is 6 to 12 hours before Received: date
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 1.1 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Matthew Bauer <mjbauer95@HIDDEN> writes: > Yes, it does
 apply for any comint buffer that uses > comint-read-input-ring. i had
 originally
 thought this was only used by > shell-mode, but you are correct that it is
 used by others. Ive added > d [...] 
 Content analysis details:   (1.1 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: ingebrigtsen.no]
 1.1 DATE_IN_PAST_06_12     Date: is 6 to 12 hours before Received: date
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 SPF_NONE               SPF: sender does not publish an SPF Record
X-Debbugs-Envelope-To: 36034
Cc: 36034 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.1 (/)

Matthew Bauer <mjbauer95@HIDDEN> writes:

> Yes, it does apply for any comint buffer that uses
> comint-read-input-ring. i had originally thought this was only used by
> shell-mode, but you are correct that it is used by others. Ive added
> defcustom handling to the patch to properly account for this.

Looks less dangerous now.  :-)

Some comments:

> +(defcustom comint-input-ring-file-prefix nil
> +  "If non-nil, the prefix to skip when parsing the input ring file.
> +This is useful in Zsh when the extended_history option is on."
> +  :type 'boolean
> +  :group 'comint)

This doesn't really seem like a user-level variable, so it should just
be a defvar, I think.

>                   (setq start
>                         (if (re-search-backward comint-input-ring-separator
>                                                 nil t)
> -                           (match-end 0)
> -                         (point-min)))
> +                           (progn
> +                             (when (and
> +                                    comint-input-ring-file-prefix
> +                                    (looking-at (concat comint-input-ring-separator
> +                                                        comint-input-ring-file-prefix)))
> +                               ;; Skip zsh extended_history stamps
> +                               (re-search-forward comint-input-ring-file-prefix
> +                                                  nil t))
> +                             (match-end 0))

The re-search-forward here doesn't seem necessary -- can't you just go
to (match-end 0) here instead?

> +                         (progn
> +                           (goto-char (point-min))
> +                           (if (and comint-input-ring-file-prefix
> +                                    (looking-at comint-input-ring-file-prefix))
> +                               (progn
> +                                 (re-search-forward comint-input-ring-file-prefix
> +                                                    nil t)
> +                                 (match-end 0))
> +                             (point-min)))))

And I don't understand this bit.  This is when we didn't find
comint-input-ring-separator, right?  But you still want to skip
comint-input-ring-file-prefix?

If you want to skip it anyway, then you can just have the check (and the
skip) after the if statement...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.

Message received at 36034 <at> debbugs.gnu.org:


Received: (at 36034) by debbugs.gnu.org; 24 Jun 2019 11:39:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 07:39:19 2019
Received: from localhost ([127.0.0.1]:55663 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfNJf-0002Zu-Ej
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2019 07:39:19 -0400
Received: from quimby.gnus.org ([80.91.231.51]:56564)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1hfNJe-0002Zk-0z
 for 36034 <at> debbugs.gnu.org; Mon, 24 Jun 2019 07:39:18 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories)
 by quimby.gnus.org with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <larsi@HIDDEN>)
 id 1hfNJZ-0002YP-HD; Mon, 24 Jun 2019 13:39:15 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Matthew Bauer <mjbauer95@HIDDEN>
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
In-Reply-To: <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN> (Matthew Bauer's
 message of "Sun, 23 Jun 2019 18:27:59 -0400")
Date: Mon, 24 Jun 2019 12:51:08 +0200
References: <87woi6e58r.fsf@HIDDEN> <m3lfxs6y59.fsf@HIDDEN>
 <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVVdZEXHjVZ0OYpMUpl
 j6xBUWsL3gelAAACPklEQVQ4jVWUsXbrIAyGVQJ7CTc7lc0erLLn+JCdgnn/V6mEHTdXnqJP0i8J
 CKTORqmX3lLp/MvAAx46w09q0VnXNygmG216K1qboiH1RmRvveAS0KPptMGjc1brLVpLdA/L19rR
 GCr62TpA782y3fw9qGISEbEc9S6l2O/83UC5WEeWGtMEcB8Jmv0Q2R9pWNdAxL9VATCSyMAdILpo
 NzDQ7OhBLIkEUELg8Mh+F0c0NZ4XIFX0RD92FHJWNKSpB9B6RQWTgDgyxo5KhhQqInqOPyT6AeLE
 flSW4qtTHrBDBhsErLvsDriZzMAPYCm1MwM0r91BfYE2xKUUCHiqHfCO2rsGeZxZnGeQgaVbKFxs
 aARQwBlOJmiizQtlgMEXI6Fj2WY0JRpWYSjm2faBJRg0+2ewCzZHF/aCKTBGyI+cEex1drRHi7FP
 bGXAti+OS4z4rDlBQF02bZIZmzgSdrB8hxA4gTeR8xtwVxPmKiInWXFk/Jvmuj2HvD79Am6TWia/
 y+9gZFB0fjG+Gun3PYP3ydd53UKHA8x/IPn6nF8Zw70DdcHNK7P75xP0VqfV4Lfnyf8SBPQl1KAM
 vksLSKl6/oLy+jX1AHw+31j4q/P/QC4l8hPj72j3DxBecFJnrVVuxwGmGhZf5T08Xkn8vqxdv65+
 1DvBPA9QwydGruaPM8/jzNmuM+EHV0P5w4DzaBmgxWlBwud+02XIARb8qSxyUf5Y5Ev8hh9Xjg/1
 bRTI/C4dfn1iYwn0g8i6fgEmpsN4L1MvjgAAAABJRU5ErkJggg==
Message-ID: <m3wohb2owu.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Matthew Bauer <mjbauer95@HIDDEN> writes: > Yes, it does
 apply for any comint buffer that uses > comint-read-input-ring. i had
 originally
 thought this was only used by > shell-mode, but you are correct that it is
 used by others. Ive added > d [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36034
Cc: 36034 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Matthew Bauer <mjbauer95@HIDDEN> writes:

> Yes, it does apply for any comint buffer that uses
> comint-read-input-ring. i had originally thought this was only used by
> shell-mode, but you are correct that it is used by others. Ive added
> defcustom handling to the patch to properly account for this.

Looks less dangerous now.  :-)

Some comments:

> +(defcustom comint-input-ring-file-prefix nil
> +  "If non-nil, the prefix to skip when parsing the input ring file.
> +This is useful in Zsh when the extended_history option is on."
> +  :type 'boolean
> +  :group 'comint)

This doesn't really seem like a user-level variable, so it should just
be a defvar, I think.

>                   (setq start
>                         (if (re-search-backward comint-input-ring-separator
>                                                 nil t)
> -                           (match-end 0)
> -                         (point-min)))
> +                           (progn
> +                             (when (and
> +                                    comint-input-ring-file-prefix
> +                                    (looking-at (concat comint-input-ring-separator
> +                                                        comint-input-ring-file-prefix)))
> +                               ;; Skip zsh extended_history stamps
> +                               (re-search-forward comint-input-ring-file-prefix
> +                                                  nil t))
> +                             (match-end 0))

The re-search-forward here doesn't seem necessary -- can't you just go
to (match-end 0) here instead?

> +                         (progn
> +                           (goto-char (point-min))
> +                           (if (and comint-input-ring-file-prefix
> +                                    (looking-at comint-input-ring-file-prefix))
> +                               (progn
> +                                 (re-search-forward comint-input-ring-file-prefix
> +                                                    nil t)
> +                                 (match-end 0))
> +                             (point-min)))))

And I don't understand this bit.  This is when we didn't find
comint-input-ring-separator, right?  But you still want to skip
comint-input-ring-file-prefix?

If you want to skip it anyway, then you can just have the check (and the
skip) after the if statement...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Jun 2019 22:28:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 18:28:07 2019
Received: from localhost ([127.0.0.1]:55267 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfAxz-0006k5-J1
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 18:28:07 -0400
Received: from lists.gnu.org ([209.51.188.17]:57300)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mjbauer95@HIDDEN>) id 1hfAxx-0006jx-Dw
 for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 18:28:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43532)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <mjbauer95@HIDDEN>) id 1hfAxw-0001An-BW
 for bug-gnu-emacs@HIDDEN; Sun, 23 Jun 2019 18:28:05 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50,
 FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,URIBL_BLOCKED autolearn=disabled
 version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mjbauer95@HIDDEN>) id 1hfAxv-0007JJ-9h
 for bug-gnu-emacs@HIDDEN; Sun, 23 Jun 2019 18:28:04 -0400
Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:39156)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <mjbauer95@HIDDEN>) id 1hfAxu-0007Hw-Ux
 for bug-gnu-emacs@HIDDEN; Sun, 23 Jun 2019 18:28:03 -0400
Received: by mail-qk1-x729.google.com with SMTP id i125so8397735qkd.6
 for <bug-gnu-emacs@HIDDEN>; Sun, 23 Jun 2019 15:28:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:message-id:mime-version:subject:date:in-reply-to:cc:to
 :references; bh=nCIU+OvVgKES5jBaBMzy7kpC40Oo1GqHA6eLby37Jo4=;
 b=YZvx6kRMiM6oIFsTLAyEqzU6RbJbCGOi2Ch75iQV2QT/app+1C8hrub6tCh7p5J9lA
 hIPksV+VrO+2mLzDqECQooFP0KQsrGJDtdkqQUkEc8lQWArogUuUJeq18f7ZamPE1X61
 39PMB/CDC+TwKvsv+tEa4p7dxYXruZcckmZpluom/3tw4SktvoIXbpRfQkYL8gA9yVjD
 VDPecjK0WPT7ZvXMyzzclqsZoTgFD/BiSnGKoO6giPeA9xc4757epdA8qW8CgA8owAG7
 WLYAA0Qx5/stqpbgZebjSk7LhKg1QIbSJ5g6uSEGQx5O2ih4oB3Y872cbygswxHu2iIi
 OUYg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:message-id:mime-version:subject:date
 :in-reply-to:cc:to:references;
 bh=nCIU+OvVgKES5jBaBMzy7kpC40Oo1GqHA6eLby37Jo4=;
 b=gk+CBsTAUwjqQnH4avmbL2reqNxoeZn9BbYtVNkzGGMJV3x8zbBhexSo47iHMobbuc
 aEIdeREERCg42ME9ZLfTipd9YPO2AOou2Ju8FiGNgPhVezvq6zVHkPCs0U5ZGJiWkJ38
 tYMdUW4/ppUyO6z2mDeKp3VRYGqQGZDcs2D4NaLmo6272iZce3e0/FCt0wFXk387vQwF
 nRYGNz6oT7N8Is7LYVFAt0d0Qm0OJYiyg3K0/I+zfnlusZO/8zF/1g7FP8k4pd/TrTbN
 DzmKsKNxKyGA1ibLvAnj9JhzviuTengKV49W9WToXU456+N6j6LM4oUCcrsZidI88vSR
 +XQg==
X-Gm-Message-State: APjAAAXOVCDA3JOhad2uOfRK8zj8H1t5jwTtWNUu+1wlJcrXVJ8mGzMd
 MrziMg0e2uqZRXgaoAoMhZp9IP+RpHE=
X-Google-Smtp-Source: APXvYqwUPhmTCQMCU2i4wXS5wuCYCgGyHWCfova8mHF3ai72UsZiP1eqzwqBu0OCdoPkqRxdZiNecA==
X-Received: by 2002:a05:620a:1661:: with SMTP id
 d1mr43881494qko.192.1561328881505; 
 Sun, 23 Jun 2019 15:28:01 -0700 (PDT)
Received: from matthewsmacbook.home (ool-457386fe.dyn.optonline.net.
 [69.115.134.254])
 by smtp.gmail.com with ESMTPSA id g53sm5325021qtk.65.2019.06.23.15.28.00
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 23 Jun 2019 15:28:00 -0700 (PDT)
From: Matthew Bauer <mjbauer95@HIDDEN>
Message-Id: <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_15F7823F-BACA-48FA-AACC-09FA7E1D6CE3"
Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3554.18.2\))
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
Date: Sun, 23 Jun 2019 18:27:59 -0400
In-Reply-To: <m3lfxs6y59.fsf@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87woi6e58r.fsf@HIDDEN> <m3lfxs6y59.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3554.18.2)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::729
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)


--Apple-Mail=_15F7823F-BACA-48FA-AACC-09FA7E1D6CE3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Jun 23, 2019, at 12:53 PM, Lars Ingebrigtsen <larsi@HIDDEN> =
wrote:
>=20
> I'm not that familiar with the comint/shell code...  but this is done
> in the central comint code, so it would do this for all the modes that
> use comint?  Couldn't that lead to problems in these other modes that
> aren't doing this timestamp thing?

Yes, it does apply for any comint buffer that uses =
comint-read-input-ring. i had originally thought this was only used by =
shell-mode, but you are correct that it is used by others. I=E2=80=99ve =
added defcustom handling to the patch to properly account for this. In =
addition, I have made some revisions to better account for the extended =
history prefix. Any additional help on this would be appreciate!



--Apple-Mail=_15F7823F-BACA-48FA-AACC-09FA7E1D6CE3
Content-Disposition: attachment;
	filename=0001-Add-zsh-extended_history-handling-for-comint.el-inpu.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-Add-zsh-extended_history-handling-for-comint.el-inpu.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=2054a0aa6a4de95f898cf13c67a5eb698dbfd9a46b=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Matthew=20Bauer=20<mjbauer95@HIDDEN>=0A=
Date:=20Sun,=2023=20Jun=202019=2018:08:32=20-0400=0ASubject:=20[PATCH]=20=
Add=20zsh=20extended_history=20handling=20for=20comint.el=20input=20ring=0A=
MIME-Version:=201.0=0AContent-Type:=20text/plain;=20charset=3DUTF-8=0A=
Content-Transfer-Encoding:=208bit=0A=0AAdds=20handling=20of=20the=20Zsh=20=
extended_history=20to=20comint.el=20input=0Aring.=20This=20means=20that=20=
the=20timestamp=20doesn=E2=80=99t=20show=20up=20when=20reading=0Athrough=20=
history=20from=20other=20shells.=20The=20lines=20look=20like=20this:=0A=0A=
:=20<beginning=20time>:<elapsed=20seconds>;<command>=0A=0AThis=20patch=20=
skips=20the=20part=20before=20<command>=20when=20the=20=E2=80=98shell=E2=80=
=99=20is=0Azsh.=20This=20is=20done=20through=20the=20=
comint-input-ring-file-prefix=0Avariable.=20When=20set,=20this=20will=20=
skip=20a=20prefix=20of=20the=20file=20when=20loading=0Ainto=20the=20=
input=20ring.=20This=20matches=20the=20behavior=20of=20Zsh.=20Zsh=20=
documents=0Ait=20here:=0A=0A=
http://zsh.sourceforge.net/Doc/Release/Options.html#History=0A---=0A=20=
lisp/comint.el=20|=2026=20++++++++++++++++++++++++--=0A=20lisp/shell.el=20=
=20|=20=206=20+++++-=0A=202=20files=20changed,=2029=20insertions(+),=203=20=
deletions(-)=0A=0Adiff=20--git=20a/lisp/comint.el=20b/lisp/comint.el=0A=
index=2056e38e24ac..fef874387a=20100644=0A---=20a/lisp/comint.el=0A+++=20=
b/lisp/comint.el=0A@@=20-249,6=20+249,12=20@@=20to=20set=20this=20in=20a=20=
mode=20hook,=20rather=20than=20customize=20the=20default=20value."=0A=20=09=
=09=20file)=0A=20=20=20:group=20'comint)=0A=20=0A+(defcustom=20=
comint-input-ring-file-prefix=20nil=0A+=20=20"If=20non-nil,=20the=20=
prefix=20to=20skip=20when=20parsing=20the=20input=20ring=20file.=0A+This=20=
is=20useful=20in=20Zsh=20when=20the=20extended_history=20option=20is=20=
on."=0A+=20=20:type=20'boolean=0A+=20=20:group=20'comint)=0A+=0A=20=
(defcustom=20comint-scroll-to-bottom-on-input=20nil=0A=20=20=20"Controls=20=
whether=20input=20to=20interpreter=20causes=20window=20to=20scroll.=0A=20=
If=20nil,=20then=20do=20not=20scroll.=20=20If=20t=20or=20`all',=20scroll=20=
all=20windows=20showing=20buffer.=0A@@=20-978,8=20+984,24=20@@=20See=20=
also=20`comint-input-ignoredups'=20and=20`comint-write-input-ring'."=0A=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20start=0A=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20=
(re-search-backward=20comint-input-ring-separator=0A=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20t)=0A-=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(match-end=200)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(point-min)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(progn=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(when=20(and=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(looking-at=20(concat=20comint-input-ring-separator=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
comint-input-ring-file-prefix)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Skip=20zsh=20=
extended_history=20stamps=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(re-search-forward=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20nil=20t))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(match-end=20=
0))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(progn=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(goto-char=20(point-min))=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20=
(and=20comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(looking-at=20comint-input-ring-file-prefix))=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(progn=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(re-search-forward=20=
comint-input-ring-file-prefix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20t)=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(match-end=200))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(point-min)))))=0A=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20(setq=20history=20(buffer-substring=20=
start=20end))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(goto-char=20start)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(when=20(and=20(not=20(string-match=20comint-input-history-ignore=0A=
diff=20--git=20a/lisp/shell.el=20b/lisp/shell.el=0Aindex=20=
e30825cd66..25f6892d96=20100644=0A---=20a/lisp/shell.el=0A+++=20=
b/lisp/shell.el=0A@@=20-600,7=20+600,11=20@@=20buffer."=0A=20=20=20=20=20=
=20=20;;=20Bypass=20a=20bug=20in=20certain=20versions=20of=20bash.=0A=20=20=
=20=20=20=20=20(when=20(string-equal=20shell=20"bash")=0A=20=20=20=20=20=20=
=20=20=20(add-hook=20'comint-preoutput-filter-functions=0A-=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20'shell-filter-ctrl-a-ctrl-b=20nil=20=
t)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
'shell-filter-ctrl-a-ctrl-b=20nil=20t))=0A+=0A+=20=20=20=20=20=20;;=20=
Skip=20extended=20history=20for=20zsh.=0A+=20=20=20=20=20=20(when=20=
(string-equal=20shell=20"zsh")=0A+=20=20=20=20=20=20=20=20(setq-local=20=
comint-input-ring-file-prefix=20":=20[[:digit:]]+:[[:digit:]]+;")))=0A=20=
=20=20=20=20(comint-read-input-ring=20t)))=0A=20=0A=20(defun=20=
shell-apply-ansi-color=20(beg=20end=20face)=0A--=20=0A2.21.0=0A=0A=

--Apple-Mail=_15F7823F-BACA-48FA-AACC-09FA7E1D6CE3--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.

Message received at 36034 <at> debbugs.gnu.org:


Received: (at 36034) by debbugs.gnu.org; 23 Jun 2019 16:54:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 12:54:00 2019
Received: from localhost ([127.0.0.1]:54366 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hf5ke-0003Fo-CI
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 12:54:00 -0400
Received: from quimby.gnus.org ([80.91.231.51]:43560)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1hf5kc-0003Fa-3S
 for 36034 <at> debbugs.gnu.org; Sun, 23 Jun 2019 12:53:58 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories)
 by quimby.gnus.org with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <larsi@HIDDEN>)
 id 1hf5kY-000882-TK; Sun, 23 Jun 2019 18:53:57 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Matthew Bauer <mjbauer95@HIDDEN>
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
References: <87woi6e58r.fsf@HIDDEN>
Date: Sun, 23 Jun 2019 18:53:54 +0200
In-Reply-To: <87woi6e58r.fsf@HIDDEN> (Matthew Bauer's message of "Fri, 31
 May 2019 16:30:44 -0400")
Message-ID: <m3lfxs6y59.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Matthew Bauer <mjbauer95@HIDDEN> writes: > The format of
 this line looks like this: > > : <beginning time>:<elapsed seconds>; <command>
 > > This patch just skips those timestamp to get the <command> part. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36034
Cc: 36034 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Matthew Bauer <mjbauer95@HIDDEN> writes:

> The format of this line looks like this:
>
> : <beginning time>:<elapsed seconds>;<command>
>
> This patch just skips those timestamp to get the <command> part.

[...]

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

I'm not that familiar with the comint/shell code...  but this is done
in the central comint code, so it would do this for all the modes that
use comint?  Couldn't that lead to problems in these other modes that
aren't doing this timestamp thing?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 31 May 2019 20:42:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 31 16:42:17 2019
Received: from localhost ([127.0.0.1]:36374 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hWoLw-0003gJ-GS
	for submit <at> debbugs.gnu.org; Fri, 31 May 2019 16:42:16 -0400
Received: from eggs.gnu.org ([209.51.188.92]:41365)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mjbauer95@HIDDEN>) id 1hWoLu-0003fq-CU
 for submit <at> debbugs.gnu.org; Fri, 31 May 2019 16:42:14 -0400
Received: from lists.gnu.org ([209.51.188.17]:46725)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <mjbauer95@HIDDEN>) id 1hWoLo-0004A7-Hn
 for submit <at> debbugs.gnu.org; Fri, 31 May 2019 16:42:09 -0400
Received: from eggs.gnu.org ([209.51.188.92]:55612)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mjbauer95@HIDDEN>) id 1hWoLn-0002D6-3t
 for bug-gnu-emacs@HIDDEN; Fri, 31 May 2019 16:42:08 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_40,
 FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mjbauer95@HIDDEN>) id 1hWoAp-0001ie-M3
 for bug-gnu-emacs@HIDDEN; Fri, 31 May 2019 16:30:48 -0400
Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:45343)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <mjbauer95@HIDDEN>) id 1hWoAp-0001hS-GD
 for bug-gnu-emacs@HIDDEN; Fri, 31 May 2019 16:30:47 -0400
Received: by mail-qt1-x835.google.com with SMTP id t1so2458393qtc.12
 for <bug-gnu-emacs@HIDDEN>; Fri, 31 May 2019 13:30:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=9Y2hjSvW9xZA5JZW2JUUiKaTBjyKRANbnn2CGI10tA4=;
 b=OEFtlda8z39eW29sKc7zqpbuD3FT8Do9OnCrfOjjZV+1Svn1etfJtnRI9nyVp1y3hR
 fU/oR3MKmoZG7pGqdZUw0DBRcShZGJym5BeW1NJ7Gh8fEHLtP/wOkaMIhozM8Hk7d83N
 VSL2UuylsSTsW4Riy86BBRDnfW/dw5QQS3k1YyfegOiYC6MkjVV/dVuKX9AjBvlYuTgG
 ePJ59Bmp9S0mksQ70wuNF6o9bwaN8mEdjOzDB13RncX+bUkM7/SCXqtxvbChX74cS+np
 hsNV6k8kj+kahWZtJQAgjSjwBT2W86ZNni5pFdXEGXudKtzaCx/S3KZHEBqdNPHddyoP
 83fg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=9Y2hjSvW9xZA5JZW2JUUiKaTBjyKRANbnn2CGI10tA4=;
 b=IxDKarRzarMHKvxK/dyroLLrbJFeENJ9rtVLF+9irJb5vJZmIcSaIFwOYdwlD1d7UD
 p3ugvTXz/oxb5q4D98FLRbR1AlnTdvtaZ6dtkuc4KQ7qNdK3lRNuIbO9i40v0zGm1GnN
 dydbqMiXtObLhikjj34c58ZqYlfnUSuaEg/bu2sO2hJhCkWlwzST0L/L/ZNSFMD4ShTn
 0+T4gNubucyYtyW9XMPbdsX3AF6ZugYbMR8EJQekBb2BP3QMl89dgHHdWj7XHpamvhIg
 9MTIoG7KmlUEqlV88XbCPWpnHacHvMRyewru6DjHF/mEyitFIKYQyNIa20hAUQMFzCx2
 kFgA==
X-Gm-Message-State: APjAAAWzWVi65AHth6QLp5DpauJbzyjXc1ay2N+tXXlyGHUYV9EP29XK
 ybO93v+6FkyqRmXDExhNh6l/c9/Iz9A=
X-Google-Smtp-Source: APXvYqy6ZVMQrqZwhb1jG32jScBtXKBlkukkf95Q7aUBoyOmTY/M3er/rCmLJvty7JM4zvoye7jodA==
X-Received: by 2002:ac8:2448:: with SMTP id d8mr11258319qtd.197.1559334645911; 
 Fri, 31 May 2019 13:30:45 -0700 (PDT)
Received: from dellbook (static-108-30-103-121.nycmny.fios.verizon.net.
 [108.30.103.121])
 by smtp.gmail.com with ESMTPSA id o71sm5831480qke.18.2019.05.31.13.30.44
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 31 May 2019 13:30:44 -0700 (PDT)
From: Matthew Bauer <mjbauer95@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Zsh extended_history shows up in comint input ring
Date: Fri, 31 May 2019 16:30:44 -0400
Message-ID: <87woi6e58r.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::835
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Currently, Zsh=E2=80=99s extended_history option is not handled well in Ema=
cs.
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.


--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: inline;
 filename=0001-Add-zsh-extended_history-handling-for-comint.el-inpu.patch
Content-Transfer-Encoding: quoted-printable

From b8a8857cd686fae1ebbeca79f4469ce878837b90 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@HIDDEN>
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=3DUTF-8
Content-Transfer-Encoding: 8bit

Adds handling of the Zsh extended_history to comint.el input
ring. This means that the timestamp doesn=E2=80=99t 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-i=
nput-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)
--=20
2.21.0


--=-=-=--




Acknowledgement sent to Matthew Bauer <mjbauer95@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#36034; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 4 Jul 2019 13:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.