「Emacs」- 常见错误汇总

device is not a termcap terminal device

问题原因

在 ~/.emacs 中,存在如下配置:

(send-string-to-terminal "\033]12;#5C5CFF\007")

但是 send-string-to-terminal 只有在终端模式下运行时才会有效,否则会产生如上错误。

原因分析

整个问题的成因有很多,我遇到的只是其中之一。

解决方法

加入检查,判断当前环境是否启动图形界面:

(if (not (display-graphic-p))
    (send-string-to-terminal "\033]12;#5C5CFF\007")
  )