是否可以使用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