Function: spinner-start

spinner-start is an autoloaded and byte-compiled function defined in spinner.el.

Signature

(spinner-start &optional TYPE-OR-OBJECT FPS DELAY)

Documentation

Start a mode-line spinner of given TYPE-OR-OBJECT.

If TYPE-OR-OBJECT is an object created with make-spinner, simply activate it. This method is designed for minor modes, so they can use the spinner as part of their lighter by doing:
    '(:eval (spinner-print THE-SPINNER))
To stop this spinner, call spinner-stop on it.

If TYPE-OR-OBJECT is anything else, a buffer-local spinner is created with this type, and it is displayed in the mode-line-process of the buffer it was created it. Both TYPE-OR-OBJECT and FPS are passed to make-spinner (which see). To stop this spinner, call spinner-stop in the same buffer.

Either way, the return value is a function which can be called anywhere to stop this spinner. You can also call spinner-stop in the same buffer where the spinner was created.

FPS, if given, is the number of desired frames per second. Default is spinner-frames-per-second.

DELAY, if given, is the number of seconds to wait until actually displaying the spinner. It is safe to cancel the spinner before this time, in which case it won't display at all.

Source Code

;; Defined in ~/.emacs.d/elpa/spinner-1.7.4/spinner.el
;;; The main functions
;;;###autoload
(defun spinner-start (&optional type-or-object fps delay)
  "Start a mode-line spinner of given TYPE-OR-OBJECT.
If TYPE-OR-OBJECT is an object created with `make-spinner',
simply activate it.  This method is designed for minor modes, so
they can use the spinner as part of their lighter by doing:
    '(:eval (spinner-print THE-SPINNER))
To stop this spinner, call `spinner-stop' on it.

If TYPE-OR-OBJECT is anything else, a buffer-local spinner is
created with this type, and it is displayed in the
`mode-line-process' of the buffer it was created it.  Both
TYPE-OR-OBJECT and FPS are passed to `make-spinner' (which see).
To stop this spinner, call `spinner-stop' in the same buffer.

Either way, the return value is a function which can be called
anywhere to stop this spinner.  You can also call `spinner-stop'
in the same buffer where the spinner was created.

FPS, if given, is the number of desired frames per second.
Default is `spinner-frames-per-second'.

DELAY, if given, is the number of seconds to wait until actually
displaying the spinner. It is safe to cancel the spinner before
this time, in which case it won't display at all."
  (unless (spinner-p type-or-object)
    ;; Choose type.
    (if (spinner-p spinner-current)
        (setf (spinner--frames spinner-current) (spinner--type-to-frames type-or-object))
      (setq spinner-current (make-spinner type-or-object (current-buffer) fps delay)))
    (setq type-or-object spinner-current)
    ;; Maybe add to mode-line.
    (unless (and (listp mode-line-process)
                 (memq 'spinner--mode-line-construct mode-line-process))
      (setq mode-line-process
            (list (or mode-line-process "")
                  'spinner--mode-line-construct))))

  ;; Create timer.
  (when fps (setf (spinner--fps type-or-object) fps))
  (when delay (setf (spinner--delay type-or-object) delay))
  (spinner--start-timer type-or-object))