all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: 29821@debbugs.gnu.org, Jay Kamat <jaygkamat@gmail.com>
Subject: bug#29821: Ensure quick substitution only occurs at start of line
Date: Mon, 01 Jan 2018 20:29:20 -0500	[thread overview]
Message-ID: <87wp11rqtr.fsf@users.sourceforge.net> (raw)
In-Reply-To: <m2373phpgw.fsf@linux-m68k.org> (Andreas Schwab's message of "Mon, 01 Jan 2018 10:56:31 +0100")

Andreas Schwab <schwab@linux-m68k.org> writes:

> On Dez 31 2017, Noam Postavsky <npostavs@users.sourceforge.net> 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 <jaygkamat@gmail.com> 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)





  reply	other threads:[~2018-01-02  1:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 23:57 bug#29821: Ensure quick substitution only occurs at start of line Jay Kamat
2018-01-01  0:33 ` Noam Postavsky
2018-01-01  9:56   ` Andreas Schwab
2018-01-02  1:29     ` Noam Postavsky [this message]
2018-01-02  2:30       ` Jay Kamat
2018-01-02  3:58         ` Noam Postavsky
2018-01-02 17:48           ` Jay Kamat
2018-01-03  1:51             ` Noam Postavsky
2018-01-04  1:17               ` Jay Kamat
2018-01-04  3:10                 ` Noam Postavsky
2018-01-04 20:26                   ` Jay Kamat
2018-01-05  1:04                     ` Noam Postavsky
2018-01-05  1:53                       ` Jay Kamat
2018-01-05 14:31                         ` Noam Postavsky
2018-01-01 23:44   ` Jay Kamat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wp11rqtr.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=29821@debbugs.gnu.org \
    --cc=jaygkamat@gmail.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.