【问题标题】:Garbage characters in my Windows Emacs shell. . . not sure what's wrong我的 Windows Emacs shell 中的垃圾字符。 . .不知道出了什么问题
【发布时间】:2011-11-08 13:36:46
【问题描述】:

我在 Windows 上运行 GNU Emacs (23.1.1),当我在 emacs 中运行 cygwin shell 时,在每个命令之后都会得到如下垃圾:

^[]0;/cygdrive/c/emacs-23.1/bin
^[[32user@HOST [33m/cygdrive/c/emacs-23.1/bin[0m

注意:我已将我的真实用户名和主机名替换为 user/HOST。

我找到了一些链接,这些链接描述了如何在 Windows 上使用 cygwin 设置 emacs,包括 SO: How can I run Cygwin Bash Shell from within Emacs?

这没有帮助。截至目前,我的 .emacs 文件中没有任何引用 shell 的内容,除了这个:

;; For the interactive shell
(setq explicit-shell-file-name "bash")

所以我什至不确定 emacs 是如何找到我的 cygwin shell 的。任何帮助表示赞赏。谢谢。

【问题讨论】:

  • 你的TERM环境变量设置不正确;这些是生成颜色输出的转义序列,在 emacs shell 中不受支持。
  • 知道如何通过我的 .emacs 文件进行更改吗?

标签: bash shell emacs windows-shell


【解决方案1】:

尝试将这些行添加到您的 .emacs 文件中

(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

我不确定这些是否正确,但请告诉我(因为我的 .emacs 文件多年来变得相当大)

【讨论】:

  • 那只是改变了字体的颜色。不过谢谢。我知道这是我忘记设置的愚蠢的东西。我对 elisp 了解不多。
  • 是的,它应该是,这就是那些奇怪的符号所做的就是设置 ANSI 颜色。
  • 这解决了我在 Windows 10 上的问题
猜你喜欢
  • 1970-01-01
  • 2011-11-21
  • 1970-01-01
  • 2020-04-06
  • 2015-04-14
  • 1970-01-01
  • 2021-10-06
  • 1970-01-01
相关资源
最近更新 更多