help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eshell, subshells, and cursor control


From: Emanuel Berg
Subject: Re: eshell, subshells, and cursor control
Date: Sat, 26 Apr 2014 00:42:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

ckhan <address@hidden> writes:

> I love the convenience of eshell: M-x ehsell gives me
> a consistent environment, on any platform.

Right - for the record, you can get Emacs cursor
movement in a lot of places those days. I use zsh and
tmux on top of that (but read on, I get to eshell last
in this post), and the cursor behaves much like it does
in Emacs. If it wouldn't, I would have noticed, as I
use those keystrokes at both places.

To make it work in zsh, I had to put:

autoload -U select-word-style
select-word-style bash

in ~/.zshrc - yes, it says bash, but it is intended to
get the Emacs behavior (which perhaps is the same as in
bash) - as I recall, `forward-word' was where the shoe
hurt.

> But if I start any kind of interactive program from
> eshell (for the sake of example, lets say "nslookup")
>
> then I lose the ability to use M-p/M-n to browse
> command line history, and Ctrl-A will not take me to
> the beginning of the nslookup prompt, but rather to
> the left edge of the buffer.

If you solve this on a general basis I'll be *very*
impressed!

Problem is, the keystrokes get intercepted by the
programs you are running: be it <$in> in Perl, or scanf
in C, or whatever. So without changing those, this
seems to require some enclosement that would act as a
man-in-the-middle, and translate keystrokes to get the
desired outcome - again, if anyone ever pulls that off,
I'll be very impressed.

A somewhat less general solution would be to change
your favourite applications - perhaps there is some
Perl module, or C library, that can be applied to get
what you desire? Yes, a bit of work, it depends how
many applications you have, and how easy it is to apply
in each case, and how well it works...

But, I mentioned zsh and tmux earlier. Tmux has a
"scroll mode" in which you (temporarily) disassociate
input with the terminal, and instead you can move
around the (tmux) cursor, kill text (and/or dump it to
a file), etc. All that is configurable, so I have M-i
to enter scroll mode, i and k to scroll up/down, q to
exit, and in between I have setup shortcuts to emulate
the Emacs behaviour. While this is absolutely not what
you ask for, it makes life simpler sometimes: for
example, if you want to yank a command that is
displayed on the text. I imagine, this perhaps doesn't
require configuration at all in eshell, because it is a
buffer like anything else - if there is a command
(shortcut) to treat it as such (i.e., not a shell,
temporarily) that would allow you to get the same
thing.

Good luck!

-- 
underground experts united:
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]