spinner
- Description
- Add spinners and progress-bars to the mode-line for ongoing operations
- Latest
- spinner-1.7.4.tar (.sig), 2024-Mar-31, 1.89 MiB
- Maintainer
- Artur Malabarba <emacs@endlessparentheses.com>
- Atom feed
- spinner.xml
- Website
- https://github.com/Malabarba/spinner.el
- Browse ELPA's repository
- CGit or Gitweb
- Badge
To install this package from Emacs, use package-install
or list-packages
.
Full description
Add spinners and progress-bars to the mode-line for ongoing operations.
1. Usage
First of all, don’t forget to add (spinner "VERSION")
to your package’s dependencies.
1.1. Major-modes
- Just call
(spinner-start)
and a spinner will be added to the mode-line. - Call
(spinner-stop)
on the same buffer when you want to remove it.
The default spinner is a line drawing that rotates. You can pass an
argument to spinner-start
to specify which spinner you want. All
possibilities are listed in the spinner-types
variable, but here are
a few examples for you to try:
(spinner-start 'vertical-breathing 10)
(spinner-start 'minibox)
(spinner-start 'moon)
(spinner-start 'triangle)
You can also define your own as a vector of strings (see the examples
in spinner-types
).
1.2. Minor-modes
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.
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.
(defvar foo--spinner (spinner-create 'rotating-line)) (defconst foo--lighter '(" foo" (:eval (spinner-print foo--spinner))))
- To activate the spinner, just call
(spinner-start foo--spinner)
. It will show up on the mode-line and start animating. - To get rid of it, call
(spinner-stop foo--spinner)
. It will then disappear again.
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 spinner-create
function. The snippet below is an example.
(defvar-local foo--spinner nil) (defconst foo--lighter '(" foo" (:eval (spinner-print foo--spinner)))) (defun foo--start-spinner () "Create and start a spinner on this buffer." (unless foo--spinner (setq foo--spinner (spinner-create 'moon t))) (spinner-start foo--spinner))
- To activate the spinner, just call
(foo--start-spinner)
. - To get rid of it, call
(spinner-stop foo--spinner)
.
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.
2. Extra options
Both spinner-start
and spinner-create
take extra options to configure the spinner, these are:
FPS
: The number of frames to display per second. Defaults tospinner-frames-per-second
.DELAY
: After starting a spinner, it still won’t be displayed for this many seconds.
Old versions
spinner-1.7.3.el.lz | 2016-Nov-17 | 4.95 KiB |
spinner-1.7.1.el.lz | 2016-Apr-02 | 4.76 KiB |
spinner-1.7.el.lz | 2016-Feb-09 | 4.74 KiB |
spinner-1.5.el.lz | 2016-Feb-07 | 4.44 KiB |
spinner-1.4.el.lz | 2015-Aug-12 | 4.41 KiB |
spinner-1.3.1.el.lz | 2015-May-03 | 4.16 KiB |
spinner-1.3.el.lz | 2015-Apr-30 | 4.14 KiB |
spinner-1.2.el.lz | 2015-Apr-10 | 2.75 KiB |
spinner-1.0.el.lz | 2015-Mar-08 | 2.65 KiB |