• Stars
    star
    102
  • Rank 325,154 (Top 7 %)
  • Language
    Emacs Lisp
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Emacs mode-line spinner for operations in progress

spinner.el

Add spinners and progress-bars to the mode-line for ongoing operations.

some-spinners.gif

all-spinners.gif

Usage

First of all, don’t forget to add (spinner "VERSION") to your package’s dependencies.

Major-modes

  1. Just call (spinner-start) and a spinner will be added to the mode-line.
  2. 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).

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))))
  1. To activate the spinner, just call (spinner-start foo--spinner). It will show up on the mode-line and start animating.
  2. 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))
  1. To activate the spinner, just call (foo--start-spinner).
  2. 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.

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 to spinner-frames-per-second.
  • DELAY: After starting a spinner, it still won’t be displayed for this many seconds.

More Repositories

1

smart-mode-line

A powerful and beautiful mode-line for Emacs.
Emacs Lisp
881
star
2

aggressive-indent-mode

Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
Emacs Lisp
827
star
3

beacon

A light that follows your cursor around so you don't lose it!
Emacs Lisp
641
star
4

paradox

Project for modernizing Emacs' Package Menu. With package ratings, usage statistics, customizability, and more.
Emacs Lisp
559
star
5

elisp-bug-hunter

Hunt down errors in elisp files.
Emacs Lisp
265
star
6

emacs-google-this

A set of emacs functions and bindings to google under point.
Emacs Lisp
259
star
7

names

A Namespace implementation for Emacs-Lisp
Emacs Lisp
244
star
8

Nameless

Less is more. Hide package namespace in your emacs-lisp code
Emacs Lisp
133
star
9

fancy-narrow

Emacs package to immitate narrow-to-region with more eye-candy
Emacs Lisp
129
star
10

rich-minority

Emacs package for hiding and/or highlighting the list of minor-modes in the mode-line.
Emacs Lisp
106
star
11

camcorder.el

Tool for capturing screencasts directly from Emacs.
Emacs Lisp
106
star
12

latex-extra

A series of usability improvements for Emacs latex-mode.
Emacs Lisp
69
star
13

speed-of-thought-lisp

Write elisp at the speed of thought. Emacs minor mode with abbrevs and keybinds.
Emacs Lisp
69
star
14

org-agenda-property

Display org properties in the agenda buffer.
Emacs Lisp
63
star
15

gmail-mode

A major-mode for editing gmail messages using markdown syntax (in emacs).
Emacs Lisp
57
star
16

lazy-map-clojure

Create Clojure maps whose values are only calculated when accessed, either from data or from java objects.
Clojure
48
star
17

ham-mode

Html As Markdown. Transparently edit an html file using markdown.
Emacs Lisp
42
star
18

control-pianobar

Pair of scripts that interact with pianobar entirely through notification bubbles and hotkeys. No terminal necessary.
Shell
34
star
19

ox-jekyll-subtree

Extension to ox-jexkyll for better export of subtrees
Emacs Lisp
30
star
20

audio-notes-mode

Emacs mode to play audio notes synced from somewhere else.
Emacs Lisp
26
star
21

speed-of-thought-clojure

Write clojure at the speed of thought.
Emacs Lisp
23
star
22

emacs-online-documentation

A project meant to keep an updated online documentation of ALL emacs' built-in functions and variables.
Emacs Lisp
22
star
23

validate.el

Schema validator for Emacs-lisp
Emacs Lisp
22
star
24

alpine-osd-notify

Script to run alpine mail client using a notify-osd notification system.
Shell
17
star
25

conkeror-minor-mode

Mode for editing conkeror javascript files.
Emacs Lisp
17
star
26

html-to-markdown

HTML to Markdown converter written in emacs-lisp.
Emacs Lisp
16
star
27

emacs-archive-tracker

A script in emacs-lisp to track some statistics about emacs package archives.
Emacs Lisp
14
star
28

org-bibtex

Simple example of combining a .bib file with org-mode.
8
star
29

comment-or-uncomment-sexp

Emacs-lisp command for inteligently commenting and commenting the sexp under point.
Emacs Lisp
8
star
30

emacs-documentation-android

Emacs Documentation android app. Search emacs variables/functions and view their documentations on android.
Java
5
star
31

HugeSQLiteCursor

A version of SQLiteCursor which remains fast even when the cursor is arbitrarily large.
Java
4
star
32

EndlessParentheses

Endless Parentheses blog. See http://endlessparentheses.com
HTML
4
star
33

lisp-assistant

A set of functions, variables, and snippets to assist in developing lisp code.
Emacs Lisp
3
star
34

threads-list-mode

tabulated-list-mode specialized at viewing threads
Emacs Lisp
3
star
35

Keystone

Play Hearthstone with the keyboard.
AutoHotkey
2
star
36

Zumi

Rails WebApp for apartment listings
Ruby
2
star
37

hdh

Ruby gem for rendering plain data into HTML
Ruby
2
star
38

Zumi-front

Frontend for https://github.com/Malabarba/Zumi
Vue
1
star
39

display-keys-emacs

Popup that displays keys pressed for certain commands
Emacs Lisp
1
star
40

greek-unicode-insert

Simple keymap to insert Unicode Greek characters in emacs.
Emacs Lisp
1
star