eshellプロンプトを中身を色分けして設定する
(setq eshell-prompt-function (lambda () (with-temp-buffer (let (p1 p2 p3 p4) (insert " [") (setq p1 (point)) (insert (abbreviate-file-name default-directory)) (setq p2 (point)) (insert "]\n") (setq p3 (point)) (insert user-login-name "@" (or (getenv "HOSTNAME") (substring (shell-command-to-string (or (executable-find "hostname") ":")) 0 -1))) (setq p4 (point)) (insert " " (format-time-string "%a, %d %b %Y %T %z") " ESHELL\n" "last:" (number-to-string eshell-last-command-status) (if (= (user-uid) 0) " # " " $ ")) (add-text-properties p1 p2 '(face ((foreground-color . "red")))) (add-text-properties p3 p4 '(face ((foreground-color . "blue")))) (buffer-substring (point-min) (point-max))))))
font-lock-modeが有効だとtext-propertyが隠されてしまう。
global-font-lockを使ってるなら、例えばこんな感じにしてfont-lockを無効にする。
(setq font-lock-global-modes '(not eshell-mode))