From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#36034: [PATCH] Zsh extended_history shows up in comint input ring Date: Mon, 24 Jun 2019 12:51:08 +0200 Message-ID: References: <87woi6e58r.fsf@gmail.com> <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="45834"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 36034@debbugs.gnu.org To: Matthew Bauer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 25 00:36:30 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 1hfXZd-000Bkc-2M for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 00:36:29 +0200 Original-Received: from localhost ([::1]:55118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfXZb-0002Jw-VS for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Jun 2019 18:36:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34424) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfXTQ-0005Oo-Vu for bug-gnu-emacs@gnu.org; Mon, 24 Jun 2019 18:30:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfXTP-0006Ke-JJ for bug-gnu-emacs@gnu.org; Mon, 24 Jun 2019 18:30:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44695) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hfXTO-0006Ii-VA for bug-gnu-emacs@gnu.org; Mon, 24 Jun 2019 18:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hfXTO-0000Np-QJ for bug-gnu-emacs@gnu.org; Mon, 24 Jun 2019 18:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2019 22:30:02 +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 Original-Received: via spool by 36034-submit@debbugs.gnu.org id=B36034.15614153801406 (code B ref 36034); Mon, 24 Jun 2019 22:30:02 +0000 Original-Received: (at 36034) by debbugs.gnu.org; 24 Jun 2019 22:29:40 +0000 Original-Received: from localhost ([127.0.0.1]:58238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfXT1-0000Mc-Ra for submit@debbugs.gnu.org; Mon, 24 Jun 2019 18:29:40 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:37600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfXT0-0000MQ-CP for 36034@debbugs.gnu.org; Mon, 24 Jun 2019 18:29:38 -0400 Original-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 ) id 1hfXSx-00007I-F0; Tue, 25 Jun 2019 00:29:37 +0200 In-Reply-To: <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@gmail.com> (Matthew Bauer's message of "Sun, 23 Jun 2019 18:27:59 -0400") 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== 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:161289 Archived-At: Matthew Bauer 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