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: Mon, 01 Jan 2018 20:29:20 -0500 Message-ID: <87wp11rqtr.fsf@users.sourceforge.net> References: <87fu8272h6.fsf@gmail.com> <87shbqto33.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1514856494 10198 195.159.176.226 (2 Jan 2018 01:28:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 2 Jan 2018 01:28:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 29821@debbugs.gnu.org, Jay Kamat To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 02 02:28:10 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 1eWBNC-0002Di-4a for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Jan 2018 02:28:10 +0100 Original-Received: from localhost ([::1]:51320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWBP9-0007N0-FN for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Jan 2018 20:30:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWBP3-0007Md-Tq for bug-gnu-emacs@gnu.org; Mon, 01 Jan 2018 20:30:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWBP0-0002zX-R9 for bug-gnu-emacs@gnu.org; Mon, 01 Jan 2018 20:30:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51665) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWBP0-0002yz-Nt for bug-gnu-emacs@gnu.org; Mon, 01 Jan 2018 20:30:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eWBP0-0003jH-BL for bug-gnu-emacs@gnu.org; Mon, 01 Jan 2018 20:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Jan 2018 01:30:02 +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.151485657114272 (code B ref 29821); Tue, 02 Jan 2018 01:30:02 +0000 Original-Received: (at 29821) by debbugs.gnu.org; 2 Jan 2018 01:29:31 +0000 Original-Received: from localhost ([127.0.0.1]:60346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWBOU-0003i7-6Z for submit@debbugs.gnu.org; Mon, 01 Jan 2018 20:29:30 -0500 Original-Received: from mail-it0-f48.google.com ([209.85.214.48]:40169) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWBOS-0003hr-9c for 29821@debbugs.gnu.org; Mon, 01 Jan 2018 20:29:28 -0500 Original-Received: by mail-it0-f48.google.com with SMTP id f190so37980219ita.5 for <29821@debbugs.gnu.org>; Mon, 01 Jan 2018 17:29:28 -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=LgpMAdgGFC+CWltvP++Ll4mZilZ4Inh7jKI/GMyilQM=; b=rJbrvnS4WBoPNr2UBi5ncQGkR1b7iGuC4ul3CjCpuVyNZT2VY1aTeewuLv3XmuTbnn AGNrUFGEz199qUOYreceK8nvEusNVz53yEMw/GSgos/PdrS5RYzq56CtFfRGkxJ18tu9 wmg6cv9SE4/mjkY6paHf1/kStRxwgxP+lKJRsiCGqjRJQ/JQXb4Db8RdQPkYcdBb8bL+ 09zN4e/vlmylOc0JkqKAC2ZZc9a1A+4yhebAD4lJHiaX+MeZ1WSgbWDTY+Lf2Hc8aCgK n6GEhJZBUaQbHo0ebSOQTdTXdSvCaxX1P6PVl6Rn/kBplqH0YIa0ZTTJpgTP9wTWluxJ jeQg== 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=LgpMAdgGFC+CWltvP++Ll4mZilZ4Inh7jKI/GMyilQM=; b=fgKE4WS4f9TKrjEmNvJvnNiWQEfYg7zLN4yTMhoy6Fopg+hhJaYOXr4NuhmkO/fvZL L7tbodO75+g+HMd6pjMyWVIOTaZ9t1kAVxrkITveOpoRbbDYtmnGEdwcIQVWvvKjb1sr 3xI3Rvn0N+QikiWJJFknfIF6U8tzYpaYR3zqS9G9urdky+BRwADKbDY4lAqEdrytwdIG UT2YYjyGpEqkaBxdfrG8agg8/nHVsY/JvvqtUZJ6VQ+ikF+QT8p20aqaZEp/qLjtcqGc 19NAzVxf3oQjbtS/NZnPltj4SDAAATMQ06kCo673ItEmJ4A6VLWN4ItSovcUHJYp5MUa /rQA== X-Gm-Message-State: AKGB3mJhP16tcqFioQUDFqnsSw/yh07c72I9TWfSJkFEkNb5+iaMQD08 FXL3cskdeaQoIZ3uELZBTEM= X-Google-Smtp-Source: ACJfBosaj4nfSxMOzaPyeoO8qu3kIMWAnHO6M8WtS4ByXnsK2yX30uZ+PuNaASEP73zTQxWuRVN8KQ== X-Received: by 10.36.101.16 with SMTP id u16mr57874252itb.90.1514856562515; Mon, 01 Jan 2018 17:29:22 -0800 (PST) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id g130sm23409685ioe.78.2018.01.01.17.29.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Jan 2018 17:29:21 -0800 (PST) In-Reply-To: (Andreas Schwab's message of "Mon, 01 Jan 2018 10:56:31 +0100") 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:141705 Archived-At: Andreas Schwab writes: > On Dez 31 2017, Noam Postavsky wrote: > >> Hmm, using history expansion would mean typing >> >> M-p DEL C-a M-f M-d M-d ! ! : $ >> >> to get >> >> mv !!:$ two.txt > > History expansion was invented when command line editing wasn't > available, it typically makes only sense for entering a new command line > (while referencing parts of the previous ones). Yes, but I didn't want to handicap the history expansion case unfairly by rejecting use of other history/editing commands. Jay Kamat writes: > I would much prefer a variable (perhaps defaulting to off) to tweak this > setting on or of rather than adding/removing a function to the hook. > Removing it in the current way makes it feel more 'deprecated' to me, > rather than 'disabled by default'. > > Would you mind if I submitted a patch to add a new > `eshell-history-expansion-enabled' variable (or similar)? Seems like pointless duplication to me. I think I would prefer having history expansion enabled by default to that (it wouldn't be that hard to disable it, after all). >> In eshell (with and without your patch) I get: >> >> ~/src/emacs $ echo foo bar >> ("foo" "bar") >> ~/src/emacs $ ^foo bar^blah^ >> ^foo: command not found > > I've attached a new patch which attempts to solve this as well. I'm > unfamiliar with eshell internals though, so I'm not sure if it's done > properly. Let me know if anyone sees any issues with it! With your patch, if I do ~/src/emacs $ ^this string not present in history^blah^ I get the latest entry in the history substituted and re-executed. In bash I get ~/tmp$ ^this string not present in history^blah^ bash: :s^this string not present in history^blah^: substitution failed (if it's easier, I think it would be okay if eshell prints an error using the !!:s/foo/bar/ syntax, but this case must be an error)