From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#29821: Ensure quick substitution only occurs at start of line Date: Thu, 04 Jan 2018 20:04:09 -0500 Message-ID: <877esxru9i.fsf@users.sourceforge.net> References: <87fu8272h6.fsf@gmail.com> <87shbqto33.fsf@users.sourceforge.net> <87wp11rqtr.fsf@users.sourceforge.net> <871sj96lgu.fsf@gmail.com> <87tvw4syi9.fsf@users.sourceforge.net> <87wp105ezz.fsf@gmail.com> <87o9mbso9j.fsf@users.sourceforge.net> <87po6q5sns.fsf@gmail.com> <87a7xus4hr.fsf@users.sourceforge.net> <877esxid5o.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1515114203 25731 195.159.176.226 (5 Jan 2018 01:03:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 5 Jan 2018 01:03:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 29821@debbugs.gnu.org, Andreas Schwab To: Jay Kamat Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 05 02:03:18 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXGPe-0005qk-4N for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Jan 2018 02:03:10 +0100 Original-Received: from localhost ([::1]:58880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXGRd-0001E7-AU for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Jan 2018 20:05:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXGRX-0001CN-6a for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 20:05:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXGRS-00073N-31 for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 20:05:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55713) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eXGRR-00073H-Vu for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 20:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eXGRR-0001ox-O2 for bug-gnu-emacs@gnu.org; Thu, 04 Jan 2018 20:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jan 2018 01:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29821 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29821-submit@debbugs.gnu.org id=B29821.15151142606941 (code B ref 29821); Fri, 05 Jan 2018 01:05:01 +0000 Original-Received: (at 29821) by debbugs.gnu.org; 5 Jan 2018 01:04:20 +0000 Original-Received: from localhost ([127.0.0.1]:36161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXGQm-0001nt-8Z for submit@debbugs.gnu.org; Thu, 04 Jan 2018 20:04:20 -0500 Original-Received: from mail-io0-f169.google.com ([209.85.223.169]:45750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXGQj-0001nf-Ds for 29821@debbugs.gnu.org; Thu, 04 Jan 2018 20:04:19 -0500 Original-Received: by mail-io0-f169.google.com with SMTP id e20so4107362iof.12 for <29821@debbugs.gnu.org>; Thu, 04 Jan 2018 17:04:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=DsSJ6uKqS/XpRQwAHYXdcX54GcggeJW+BviW8dWy/P0=; b=NyWnrsUSvxiwjG2X1B7W6vjFGftBu9uh3/HK/k48eb34SCj8/uXVk+VOWM1dRNTkjU S5L/aygfD5q3bwPQe7gi0fAO2uo98HuMBFiT2EqrfgY0GCgN6MAtcOH9SWjQRNSsmAcc bU7yonOQW/EjrV3O8ZAcahvXPj5TM7TvnpmMabmDINkf+fDYie//D9s9QJlvXchv5sd+ 0MOJXabLKwD/2iIgsd57L4ecghFvOc9kzQ1EXVkTxXEKRi1QkkVcHx2/EwPnC1Q1WtIE LdERs7IvPLhCGt5WyjMYAQkVA65qLVzsoxaSOsgzNIauc4FxGroGRwxaMaJwvRHOV4Jw McTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=DsSJ6uKqS/XpRQwAHYXdcX54GcggeJW+BviW8dWy/P0=; b=WPapf0bMgFHCHlo6z1oQbYl6/Pot+g2YWEEpUeT4fvU4XMlvQUFDz4FjlmaswVifRC Spe1g25gD14fIpRj4/X9+QYg6mjl1WKpU0HwUavWm46VrOLFUAZW60t7bdns1z0OUFS7 b6Y58CrYDlKgVI2yRRpCYf38qfrO1KdenYWfmrCv8g5q1uU5UgPOdrjpOOHbcr76IKQh VA0HXIE2w0m/kiJhSNCq2h0RQDTlCTBPgUTruquXKP3rJO2CZmj/IH6iXgBhI0EqJ2Q+ zN/hL7lFg6hdeJSCPf2Cdux2grB12hjCQjNPxH0y+uqB5zmtCKy6RnqWqWShC+R4FQI2 6XBA== X-Gm-Message-State: AKGB3mJ/vwzCVqP3/E3NQMtAbA+9F+62nk2Gi+lZ1EBAmVA1oxnKFElD aMSV83w49qYTg4bjZIPyBds= X-Google-Smtp-Source: ACJfBovNZhAVkxnBRLD+Pu1GDBsOvKLBBSBRUVHQ8xBlImKBA/qd7qArbBoH6aNe8j2lCNUtQI4bBA== X-Received: by 10.107.186.139 with SMTP id k133mr1629964iof.208.1515114251942; Thu, 04 Jan 2018 17:04:11 -0800 (PST) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id x72sm2675628ite.43.2018.01.04.17.04.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jan 2018 17:04:10 -0800 (PST) In-Reply-To: <877esxid5o.fsf@gmail.com> (Jay Kamat's message of "Thu, 04 Jan 2018 12:26:11 -0800") 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: 208.118.235.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:141786 Archived-At: Jay Kamat writes: > Ah, nice catch! I've updated the patch to handle that case as well. I've > tested it as well as I could and it seems good to me, but in order to > fix that case, I had to mess with the regexes a bit, so It's possible I > might have missed a few cases. There doesn't need to be trailing whitespace between the last "^" and subsequent text, bash: ~/tmp$ echo foo bar foo bar ~/tmp$ ^foo^blah^x echo blah barx blah barx eshell (with your patch): ~/src/emacs $ echo foo bar ("foo" "bar") ~/src/emacs $ ^foo^blah^x ^foo^blah^x: command not found And as far as I can tell, trailing whitespace should not be dropped (though it's hard to come up with cases where it matters): ~/tmp$ echo 'foo bar ' foo bar ~/tmp$ ^bar^zz echo 'foo zz ' foo zz So I think this should do it? ... (string-match "^\\^\\([^^]+\\)\\^\\([^^]+\\)\\(?:\\^\\(.*\\)\\)?$" line)) ;; Save trailing match as `eshell-history-reference' runs string-match. (let ((matched-end (match-string 3 line))) ...