svlug-advantages_of_using_emacs_for_your_shell

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Date: Thu, 12 Dec 2002 11:04:36 -0800
From: J C Lawrence <claw@kanga.nu>
To: "N. Thomas" <nthomas@cise.ufl.edu>
Cc: svlug@lists.svlug.org
Subject: Re: [svlug] Re: using vim in debian.... 

On Thu, 12 Dec 2002 10:07:01 -0500 
N Thomas <nthomas@cise.ufl.edu> wrote:
> * Matt Billenstein <matt@vazor.com> [2002-12-12 00:41:24 -0800]:

>> One of the things I've seen guys doing at work is running shell
>> programs inside of emacs which can be attractive since you get syntax
>> highlighting for some of them and the general editing features of the
>> editor.  I'd love to be able to do this with vim since I'm not
>> exactly an emacs guy, but I haven't seen if it's even possible yet.

> In Bash and Z Shell, one can set vi-like key bindings with "set -o vi"
> and "bindkey -v". The syntax coloring is not there, but for most vi
> enthusiasts, this is pretty much all they need.

Running a shell inside of (X)EMacs adds several features:

  Native emacs editing of the commandline and the entire scrollback of
  the session.

  Native editor access to the entire scrollback of the session (eg
  search, edit, cut'n'paste, relation to other buffers in the editor
  etc.

  Automatic binding of the shell behaviour and outputs to the rest of
  the editor (eg elisp automation).

===


Date: Thu, 12 Dec 2002 12:40:23 -0800
From: Rick Schultz <bloodyvikings@sbcglobal.net>
To: svlug@lists.svlug.org
Subject: Re: [svlug] Re: using vim in debian....

On Thu, Dec 12, 2002 at 11:35:07AM -0800, Matt Billenstein wrote:
> Some of our guys are actually able to run these sessions inside emacs
> to get the line editing features of emacs...  I've never done that
> myself so I'm not sure what the command in emacs is.

There are two commands: shell and term.  I don't know when each first
appeared, but they both came with 21.1.  Shell is good for some basic
tasks, while term mode "emulates (most of the features of) a
VT100/ANSI-style terminal."  (I.e., shell-mode can't run `top', but
term-mode can.)  

I find term-mode especially useful for running sqlplus.  By defining a
few functions, you can even have separate command histories for each of
the programs you run inside emacs.

      (defun term-mode-save-history (proc str)
        (term-write-input-ring))

      (defun sqlplus (connectstring)
        "run sqlplus in a new buffer."
        (interactive (list (read-from-minibuffer "Logon string: ")))
        (setq program "sqlplus" )
        (set-buffer (make-term connectstring program nil connectstring))
        (term-mode)
        (term-line-mode)
        (switch-to-buffer (concat "*" connectstring "*"))
        (setq term-input-ring-file-name "~/.sqlplus_history")
        (term-read-input-ring)
        (set-process-sentinel (get-buffer-process (concat "*"
                                                   connectstring "*"))
                              (function term-mode-save-history)))

HTH,
rick


===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu