From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Matthew Bauer Newsgroups: gmane.emacs.bugs Subject: bug#36034: [PATCH] Zsh extended_history shows up in comint input ring Date: Sun, 23 Jun 2019 18:27:59 -0400 Message-ID: <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@gmail.com> References: <87woi6e58r.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3554.18.2\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_15F7823F-BACA-48FA-AACC-09FA7E1D6CE3" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="168274"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36034@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 24 00:29:25 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hfAzE-000hfQ-GY for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Jun 2019 00:29:24 +0200 Original-Received: from localhost ([::1]:47142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfAzD-0001PI-HP for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jun 2019 18:29:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43751) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfAz0-0001Ox-6J for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 18:29:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfAyx-0000C0-Mh for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 18:29:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41723) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hfAyr-00009t-R8 for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 18:29:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hfAyr-0006lX-Jf for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 18:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Matthew Bauer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Jun 2019 22:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36034 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156132888725925 (code B ref -1); Sun, 23 Jun 2019 22:29:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Jun 2019 22:28:07 +0000 Original-Received: from localhost ([127.0.0.1]:55267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfAxz-0006k5-J1 for submit@debbugs.gnu.org; Sun, 23 Jun 2019 18:28:07 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:57300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfAxx-0006jx-Dw for submit@debbugs.gnu.org; Sun, 23 Jun 2019 18:28:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43532) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfAxw-0001An-BW for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 18:28:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfAxv-0007JJ-9h for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 18:28:04 -0400 Original-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 ) id 1hfAxu-0007Hw-Ux for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 18:28:03 -0400 Original-Received: by mail-qk1-x729.google.com with SMTP id i125so8397735qkd.6 for ; 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) Original-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) In-Reply-To: X-Mailer: Apple Mail (2.3554.18.2) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161185 Archived-At: --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 = 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=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:;=0A=0AThis=20patch=20= skips=20the=20part=20before=20=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--