加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-15 19:15:08 所属栏目:安全 来源:网络整理
导读:我喜欢使用Emacs的shell模式,但它有一些缺陷。其中之一是,当shell命令尝试调用编辑器时,打开新缓冲区不够聪明。例如,将环境变量VISUAL设置为vim,我从svn propedit得到以下内容: $ svn propedit svn:externals . "svn-prop.tmp" 2L,149C[1;1H~ [4;1H~ [
我喜欢使用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启动)),缓冲区将在最后一帧中创建以启动服务器。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读