From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: eshell, subshells, and cursor control Date: Sat, 26 Apr 2014 00:42:10 +0200 Organization: Aioe.org NNTP Server Message-ID: <874n1h6ngd.fsf@nl106-137-194.student.uu.se> References: <16bb89d3-3633-48fd-9045-b44733202ecd@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1398465925 12276 80.91.229.3 (25 Apr 2014 22:45:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Apr 2014 22:45:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 26 00:45:20 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wdorv-0007eA-8r for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Apr 2014 00:45:19 +0200 Original-Received: from localhost ([::1]:60229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wdoru-0001zp-TY for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Apr 2014 18:45:18 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 70 Original-NNTP-Posting-Host: VVbyYd/iFZoeWNmD9i++cQ.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:b8hIruU7o/MF3IYgn4aHXRcUmHw= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:205109 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97375 Archived-At: ckhan 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