Navigation Menu

Skip to content

Commit

Permalink
Add hook for coloring eshell prompt on nonzero exit codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Dec 2, 2011
1 parent bf4c37f commit f91de49
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/starter-kit-eshell.el
Expand Up @@ -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
Expand Down

0 comments on commit f91de49

Please sign in to comment.