summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2014-02-01 20:13:32 +0100
committerGravatar Tom Willemse2014-02-01 20:13:32 +0100
commit46bd19ffd6992d3efc8d666c5f3dd69488d54eb0 (patch)
tree17f1277c384ae7b7fd5996ff7d12e22e0d0afd1a
parentebd7a2ae22bd5a1bff36bbfe7792c03483e752d7 (diff)
downloadeshell-fringe-status-46bd19ffd6992d3efc8d666c5f3dd69488d54eb0.tar.gz
eshell-fringe-status-46bd19ffd6992d3efc8d666c5f3dd69488d54eb0.zip
Extract function for easier testing
-rw-r--r--eshell-fringe-status.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/eshell-fringe-status.el b/eshell-fringe-status.el
index f41f03a..c89b408 100644
--- a/eshell-fringe-status.el
+++ b/eshell-fringe-status.el
@@ -112,6 +112,14 @@ which doesn't accept at least one space will break."
(setq eshell-prompt-regexp
(format "%c ?%s" first (substring eshell-prompt-regexp 1))))))
+(defun efs--propertized-text ()
+ "Return the propertized text to insert into the eshell bufffer."
+ (let ((face (efs--doc 'eshell-fringe-status-success
+ 'eshell-fringe-status-failure))
+ (bitmap (efs--doc eshell-fringe-status-success-bitmap
+ eshell-fringe-status-failure-bitmap)))
+ (propertize " " 'display `((left-fringe ,bitmap ,face)))))
+
(defun efs--revert-prompt-regexp ()
"The counterpart for `efs--extend-prompt-regexp', remove a space.
@@ -132,13 +140,8 @@ window."
(when eshell-last-command-name
(save-excursion
(beginning-of-line)
- (let ((face (if (zerop eshell-last-command-status)
- 'eshell-fringe-status-success
- 'eshell-fringe-status-failure))
- (inhibit-read-only t))
- (insert
- (propertize " " 'display
- `((left-fringe efs--arrow-bitmap ,face))))))))
+ (let ((inhibit-read-only t))
+ (insert (efs--propertized-text))))))
;;;###autoload
(define-minor-mode eshell-fringe-status-mode