Open an Emacs buffer when a command tries to open an editor in shell-mode

Posted by Chris Conway on Stack Overflow See other posts from Stack Overflow or by Chris Conway
Published on 2008-09-22T18:18:58Z Indexed on 2010/04/20 16:53 UTC
Read the original article Hit count: 224

Filed under:
|
|

I like to use Emacs' shell mode, but it has a few deficiencies. One of those is that it's not smart enough to open a new buffer when a shell command tries to invoke an editor. For example with the environment variable VISUAL set to vim I get the following from svn propedit:

$ svn propedit svn:externals . 
"svn-prop.tmp" 2L, 149C[1;1H
~                                                                               [4;1H~                                                                               [5;1H~                                                                               [6;1H~                                                                               [7;1H~            
...

(It may be hard to tell from the representation, but it's a horrible, ugly mess.)

With VISUAL set to "emacs -nw", I get

$ svn propedit svn:externals .
emacs: Terminal type "dumb" is not powerful enough to run Emacs.
It lacks the ability to position the cursor.
If that is not the actual type of terminal you have,
use the Bourne shell command `TERM=... export TERM' (C-shell:
`setenv TERM ...') to specify the correct type.  It may be necessary
to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.svn: system('emacs -nw svn-prop.tmp') returned 256

(It works with VISUAL set to just emacs, but only from inside an Emacs X window, not inside a terminal session.)

Is there a way to get shell mode to do the right thing here and open up a new buffer on behalf of the command line process?

© Stack Overflow or respective owner

Related posts about unix

Related posts about emacs