From 46bd19ffd6992d3efc8d666c5f3dd69488d54eb0 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 1 Feb 2014 20:13:32 +0100 Subject: Extract function for easier testing --- eshell-fringe-status.el | 17 ++++++++++------- 1 file 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 -- cgit v1.2.3-54-g00ecf