emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 117b823 2/9: Offer a spinner-make-progress-bar function


From: Artur Malabarba
Subject: [elpa] master 117b823 2/9: Offer a spinner-make-progress-bar function
Date: Thu, 17 Nov 2016 13:00:47 +0000 (UTC)

branch: master
commit 117b8238bd9175f2af88347b1a516b38c9d4adce
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    Offer a spinner-make-progress-bar function
---
 spinner.el |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/spinner.el b/spinner.el
index ec0a64f..df59e10 100644
--- a/spinner.el
+++ b/spinner.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2015 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
-;; Version: 1.5
+;; Version: 1.6
 ;; URL: https://github.com/Malabarba/spinner.el
 ;; Keywords: processes mode-line
 
@@ -123,6 +123,18 @@
 Each car is a symbol identifying the spinner, and each cdr is a
 vector, the spinner itself.")
 
+(defun spinner-make-progress-bar (width &optional char)
+  "Return a vector of strings of the given WIDTH.
+The vector is a valid spinner type and is similar to the
+`progress-bar' spinner, except without the sorrounding brackets.
+CHAR is the character to use for the moving bar (defaults to =)."
+  (let ((whole-string (concat (make-string (1- width) ?\s)
+                              (make-string 4 (or char ?=))
+                              (make-string width ?\s))))
+    (thread-last (mapcar (lambda (n) (substring whole-string n (+ n width)))
+                         (number-sequence (+ width 3) 0 -1))
+      (apply #'vector))))
+
 (defvar spinner-current nil
   "Spinner curently being displayed on the `mode-line-process'.")
 (make-variable-buffer-local 'spinner-current)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]