是否可以使用bash PS1变量在Emacs shell提示符(提示本身,而不是shell屏幕的其余部分)中使用颜色?我相信我的语法是正确的(例如,PS1='[\[email protected]\h \[\e[0;31m\]\W\[\e[m\]]\$ '
- 它可以在term或ansi-term中运行),但Emacs似乎正在应用comint-highlight-prompt face。我可以将其设置为某种颜色,并且它可以工作,但我希望能够将提示的各个部分设置为不同的颜色。我更喜欢使用shell或term-term,所以我宁愿不切换。Emacs shell提示中的颜色
谢谢。
由于Emacs bug https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20084已在git://git.sv.gnu上修复,因此在Ubuntu 16.04中无法使用Emacs 24.5 .org/emacs.git在提交792d44b3c31d2a682607ab8b79ae7d26b7402f41。要使您的解决方案有效,请使用https://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks-for-Loading.html和“comint”修复“comint-snapshot-last-prompt”和“comint-output-filter”和“font-lock”添加“font-lock-remove-face-from-text-property”。 – 2016-12-27 17:07:59