Permalink
Browse files

Add hook for coloring eshell prompt on nonzero exit codes.

  • Loading branch information...
1 parent bf4c37f commit f91de499769e8f6076c00678b8784a7657785b0f @technomancy committed Dec 2, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 modules/starter-kit-eshell.el
@@ -101,6 +101,21 @@
(".*" "echo 'Could not extract the file:'")))))
(eshell-command-result (concat command " " file))))
+(defface esk-eshell-error-prompt-face
+ '((((class color) (background dark)) (:foreground "red" :bold t))
+ (((class color) (background light)) (:foreground "red" :bold t)))
+ "Face for nonzero prompt results"
+ :group 'eshell-prompt)
+
+(add-hook 'eshell-after-prompt-hook
+ (defun esk-eshell-exit-code-prompt-face ()
+ (when (and eshell-last-command-status
+ (not (zerop eshell-last-command-status)))
+ (let ((inhibit-read-only t))
+ (add-text-properties
+ (save-excursion (beginning-of-line) (point)) (point-max)
+ '(face esk-eshell-error-prompt-face))))))
+
;; Port features from
;; http://blog.peepcode.com/tutorials/2009/shell-method-missing/shell_method_missing.rb
;; * cloning git repos, github repos

0 comments on commit f91de49

Please sign in to comment.