微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

unix – 当命令尝试以shell模式打开编辑器时,打开Emacs缓冲区

我喜欢使用Emacs的shell模式,但它有一些缺陷。其中之一是,当shell命令尝试调用编辑器时,打开新缓冲区不够聪明。例如,将环境变量VISUAL设置为vim,我从svn propedit得到以下内容
$ svn propedit svn:externals . 
"svn-prop.tmp" 2L,149C[1;1H
~                                                                               [4;1H~                                                                               [5;1H~                                                                               [6;1H~                                                                               [7;1H~            
...

(从代表中可能很难说,但这是一个可怕的丑陋的混乱。)

使用VISUAL设置为“emacs -nw”,我得到

$ 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

(它与VISUAL设置为只是emacs,但只能从Emacs X窗口内部,而不是在终端会话内)。

有没有办法让shell模式在这里做正确的事情,代表命令行进程打开一个新的缓冲区?

您可以通过emacsclient附加到Emacs会话。首先,启动emacs服务器
M-x server-start

或者添加(服务器启动)到.emacs。然后,

export VISUAL=emacsclient

编辑。

注意:

> emacs和emacsclient的版本必须同意。如果安装了多个版本的Emacs,请确保调用与运行服务器的Emacs版本相对应的emacsclient版本。>如果您在多个Emacs进程/帧中启动服务器(例如,因为(.server启动)),缓冲区将在最后一帧中创建以启动服务器。

原文地址:https://www.jb51.cc/bash/387775.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐