[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 709295d 07/10: * spinner: Rename constructor.
From: |
Artur Malabarba |
Subject: |
[elpa] master 709295d 07/10: * spinner: Rename constructor. |
Date: |
Tue, 11 Aug 2015 10:56:36 +0000 |
branch: master
commit 709295d6b9f28a94ffcbe73a96767bc675ec7ddd
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
* spinner: Rename constructor.
---
README.org | 10 ++++------
spinner.el | 39 +++++++++++++++++++++------------------
2 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/README.org b/README.org
index 0d830cc..87fa1cb 100644
--- a/README.org
+++ b/README.org
@@ -28,7 +28,7 @@ You can also define your own as a vector of strings (see the
examples
in ~spinner-types~).
** Minor-modes
-Minor-modes can create a spinner with ~make-spinner~ and then add it
+Minor-modes can create a spinner with ~spinner-create~ and then add it
to their mode-line lighter. They can then start the spinner by setting
a variable and calling ~spinner-start-timer~. Finally, they can stop
the spinner (and the timer) by just setting the same variable to nil.
@@ -37,7 +37,7 @@ Here’s an example for a minor-mode named ~foo~. Assuming that
~foo--lighter~ is used as the mode-line lighter, the following code
will add an *inactive* global spinner to the mode-line.
#+begin_src emacs-lisp
-(defvar foo--spinner (make-spinner 'rotating-line))
+(defvar foo--spinner (spinner-create 'rotating-line))
(defconst foo--lighter
'(" foo" (:eval (spinner-print foo--spinner))))
#+end_src
@@ -49,7 +49,7 @@ will add an *inactive* global spinner to the mode-line.
Some minor-modes will need spinners to be buffer-local. To achieve
that, just make the ~foo--spinner~ variable buffer-local and use the
-third argument of the ~make-spinner~ function. The snippet below is an
example.
+third argument of the ~spinner-create~ function. The snippet below is an
example.
#+begin_src emacs-lisp
(defvar-local foo--spinner nil)
@@ -58,7 +58,7 @@ third argument of the ~make-spinner~ function. The snippet
below is an example.
(defun foo--start-spinner ()
"Create and start a spinner on this buffer."
(unless foo--spinner
- (setq foo--spinner (make-spinner 'moon t)))
+ (setq foo--spinner (spinner-create 'moon t)))
(spinner-start foo--spinner))
#+end_src
@@ -67,5 +67,3 @@ third argument of the ~make-spinner~ function. The snippet
below is an example.
This will use the ~moon~ spinner, but you can use any of the names
defined in the ~spinner-types~ variable or even define your own.
-
-
diff --git a/spinner.el b/spinner.el
index 05f6707..bcdc16c 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.3
+;; Version: 1.3.1
;; URL: https://github.com/Malabarba/spinner.el
;; Keywords: processes mode-line
@@ -54,7 +54,7 @@
;; 1.2 Minor-modes
;; ───────────────
;;
-;; Minor-modes can create a spinner with `make-spinner' and then add it
+;; Minor-modes can create a spinner with `spinner-create' and then add it
;; to their mode-line lighter. They can then start the spinner by setting
;; a variable and calling `spinner-start-timer'. Finally, they can stop
;; the spinner (and the timer) by just setting the same variable to nil.
@@ -63,7 +63,7 @@
;; `foo--lighter' is used as the mode-line lighter, the following code
;; will add an *inactive* global spinner to the mode-line.
;; ┌────
-;; │ (defvar foo--spinner (make-spinner 'rotating-line))
+;; │ (defvar foo--spinner (spinner-create 'rotating-line))
;; │ (defconst foo--lighter
;; │ '(" foo" (:eval (spinner-print foo--spinner))))
;; └────
@@ -75,7 +75,7 @@
;;
;; Some minor-modes will need spinners to be buffer-local. To achieve
;; that, just make the `foo--spinner' variable buffer-local and use the
-;; third argument of the `make-spinner' function. The snippet below is an
+;; third argument of the `spinner-create' function. The snippet below is an
;; example.
;;
;; ┌────
@@ -85,7 +85,7 @@
;; │ (defun foo--start-spinner ()
;; │ "Create and start a spinner on this buffer."
;; │ (unless foo--spinner
-;; │ (setq foo--spinner (make-spinner 'moon t)))
+;; │ (setq foo--spinner (spinner-create 'moon t)))
;; │ (spinner-start foo--spinner))
;; └────
;;
@@ -165,12 +165,23 @@ own spinner animations."
((symbolp type) (cdr (assq type spinner-types)))
(t (error "Unknown spinner type: %s" type))))
-;;;###autoload
(defstruct (spinner
(:copier nil)
(:conc-name spinner--)
- (:constructor make-spinner (&optional type buffer-local fps)
- "Create a spinner of the given TYPE.
+ (:constructor make-spinner (&optional type buffer-local fps)))
+ (frames (spinner--type-to-frames type))
+ (counter 0)
+ (fps spinner-frames-per-second)
+ (timer (timer-create) :read-only)
+ (active-p nil)
+ (buffer (when buffer-local
+ (if (bufferp buffer-local)
+ buffer-local
+ (current-buffer)))))
+
+;;;###autoload
+(defun spinner-create (&optional type buffer-local fps)
+ "Create a spinner of the given TYPE.
The possible TYPEs are described in `spinner--type-to-frames'.
FPS, if given, is the number of desired frames per second.
@@ -184,16 +195,8 @@ When started, in order to function properly, the spinner
runs a
timer which periodically calls `force-mode-line-update' in the
curent buffer. If BUFFER-LOCAL was set at creation time, then
`force-mode-line-update' is called in that buffer instead. When
-the spinner is stopped, the timer is deactivated."))
- (frames (spinner--type-to-frames type))
- (counter 0)
- (fps spinner-frames-per-second)
- (timer (timer-create) :read-only)
- (active-p nil)
- (buffer (when buffer-local
- (if (bufferp buffer-local)
- buffer-local
- (current-buffer)))))
+the spinner is stopped, the timer is deactivated."
+ (make-spinner type buffer-local fps))
(defun spinner-print (spinner)
"Return a string of the current frame of SPINNER.
- [elpa] master updated (7695b59 -> 25a84ed), Artur Malabarba, 2015/08/11
- [elpa] master fb3fb96 01/10: 1.2, Artur Malabarba, 2015/08/11
- [elpa] master 7d222f4 02/10: spinner: Generalize to arbitrary variables, Artur Malabarba, 2015/08/11
- [elpa] master 59ef469 06/10: Implement spinner-start-print, Artur Malabarba, 2015/08/11
- [elpa] master 46c545b 04/10: spinner: Iron out some kinks in the minor-mode behavior, Artur Malabarba, 2015/08/11
- [elpa] master 709295d 07/10: * spinner: Rename constructor.,
Artur Malabarba <=
- [elpa] master 8d8c459 09/10: spinner: More doc, Artur Malabarba, 2015/08/11
- [elpa] master bd2c557 08/10: spinner: Add delay feature, Artur Malabarba, 2015/08/11
- [elpa] master b6dc924 03/10: spinner: Document new functionality, Artur Malabarba, 2015/08/11
- [elpa] master 60205a4 05/10: Rewrite spinners completely., Artur Malabarba, 2015/08/11
- [elpa] master 25a84ed 10/10: Merge commit '8d8c459d7757cf5774f11be9147d7a54f5f9bbd7', Artur Malabarba, 2015/08/11