all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* eshell, subshells, and cursor control
@ 2014-04-25 21:40 ckhan
  2014-04-25 22:42 ` Emanuel Berg
  0 siblings, 1 reply; 2+ messages in thread
From: ckhan @ 2014-04-25 21:40 UTC (permalink / raw)
  To: help-gnu-emacs

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

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.

How can I get eshell-mode to behave more like shell-mode when I start interactive command line programs?

Thanks,
-ck



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: eshell, subshells, and cursor control
  2014-04-25 21:40 eshell, subshells, and cursor control ckhan
@ 2014-04-25 22:42 ` Emanuel Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Emanuel Berg @ 2014-04-25 22:42 UTC (permalink / raw)
  To: help-gnu-emacs

ckhan <charleykhan@gmail.com> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-25 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-25 21:40 eshell, subshells, and cursor control ckhan
2014-04-25 22:42 ` Emanuel Berg

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.