unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: eshell, subshells, and cursor control
Date: Sat, 26 Apr 2014 00:42:10 +0200	[thread overview]
Message-ID: <874n1h6ngd.fsf@nl106-137-194.student.uu.se> (raw)
In-Reply-To: 16bb89d3-3633-48fd-9045-b44733202ecd@googlegroups.com

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


      reply	other threads:[~2014-04-25 22:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25 21:40 eshell, subshells, and cursor control ckhan
2014-04-25 22:42 ` Emanuel Berg [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=874n1h6ngd.fsf@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).