;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. #@123 Predefined alist of spinners. Each car is a symbol identifying the spinner, and each cdr is a vector, the spinner itself. (defconst spinner-types '((3-line-clock . ["┤" "┘" "┴" "└" "├" "┌" "┬" "┐"]) (2-line-clock . ["┘" "└" "┌" "┐"]) (flipping-line . ["_" "\\" "|" "/"]) (rotating-line . ["-" "\\" "|" "/"]) (progress-bar . ["[ ]" "[= ]" "[== ]" "[=== ]" "[====]" "[ ===]" "[ ==]" "[ =]"]) (progress-bar-filled . ["| |" "|█ |" "|██ |" "|███ |" "|████|" "| ███|" "| ██|" "| █|"]) (vertical-breathing . ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█" "▇" "▆" "▅" "▄" "▃" "▂" "▁" " "]) (vertical-rising . ["▁" "▄" "█" "▀" "▔"]) (horizontal-breathing . [" " "▏" "▎" "▍" "▌" "▋" "▊" "▉" "▉" "▊" "▋" "▌" "▍" "▎" "▏"]) (horizontal-breathing-long . [" " "▎ " "▌ " "▊ " "█ " "█▎" "█▌" "█▊" "██" "█▊" "█▌" "█▎" "█ " "▊ " "▋ " "▌ " "▍ " "▎ " "▏ "]) (horizontal-moving . [" " "▌ " "█ " "▐▌" " █" " ▐"]) (minibox . ["▖" "▘" "▝" "▗"]) (triangle . ["◢" "◣" "◤" "◥"]) (box-in-box . ["◰" "◳" "◲" "◱"]) (box-in-circle . ["◴" "◷" "◶" "◵"]) (half-circle . ["◐" "◓" "◑" "◒"]) (moon . ["🌑" "🌘" "🌗" "🌖" "🌕" "🌔" "🌓" "🌒"])) (#$ . 88)) #@262 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 surrounding brackets. CHAR is the character to use for the moving bar (defaults to =). (fn WIDTH &optional CHAR) (defalias 'spinner-make-progress-bar #[513 "\300S\301\"\300\302\206\f\303\"\300\301\"Q\304\305\306\307\310#\311\312\\\313\314#\"\"\207" [make-string 32 4 61 apply vector mapcar make-closure #[257 "\301\211\300\\O\207" [V0 V1] 5 "\n\n(fn N)"] number-sequence 3 0 -1] 11 (#$ . 1460)]) #@63 Spinner currently being displayed on the `mode-line-process'. (defvar spinner-current nil (#$ . 2021)) (make-variable-buffer-local 'spinner-current) #@61 Construct used to display a spinner in `mode-line-process'. (defconst spinner--mode-line-construct '(:eval (spinner-print spinner-current)) (#$ . 2176)) (put 'spinner--mode-line-construct 'risky-local-variable t) #@99 Default speed at which spinners spin, in frames per second. Each spinner can override this value. (defvar spinner-frames-per-second 10 (#$ . 2395)) #@662 Return a vector of frames corresponding to TYPE. The list of possible built-in spinner types is given by the `spinner-types' variable, but you can also use your own (see below). If TYPE is nil, the frames of this spinner are given by the first element of `spinner-types'. If TYPE is a symbol, it specifies an element of `spinner-types'. If TYPE is 'random, use a random element of `spinner-types'. If TYPE is a list, it should be a list of symbols, and a random one is chosen as the spinner type. If TYPE is a vector, it should be a vector of strings and these are used as the spinner's frames. This allows you to make your own spinner animations. (fn TYPE) (defalias 'spinner--type-to-frames #[257 "\301!\203\207\211\204@A\207\211\302=\203\302G!\234A\207\211<\203,\211\302G!\234\236A\207\2119\2036\211\236A\207\303\304\"\207" [spinner-types vectorp random error "Unknown spinner type: %s"] 4 (#$ . 2550)]) #@66 compiler-macro for inlining `spinner-p'. (fn CL-WHOLE-ARG CL-X) (defalias 'spinner-p--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block spinner-p (and (memq (type-of cl-x) cl-struct-spinner-tags) t)) nil] 9 (#$ . 3482)]) (put 'spinner-p 'compiler-macro 'spinner-p--cmacro) #@13 (fn CL-X) (defalias 'spinner-p #[257 "\301!>\205 \302\207" [cl-struct-spinner-tags type-of t] 3 (#$ . 3798)]) (byte-code "\300\301\302\303#\304\305\306\301#\207" [function-put spinner-p side-effect-free error-free put spinner cl-deftype-satisfies] 5) #@72 compiler-macro for inlining `spinner--frames'. (fn CL-WHOLE-ARG CL-X) (defalias 'spinner--frames--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block spinner--frames (progn (aref cl-x 1))) nil] 9 (#$ . 4060)]) (put 'spinner--frames 'compiler-macro 'spinner--frames--cmacro) #@59 Access slot "frames" of `spinner' struct CL-X. (fn CL-X) (defalias 'spinner--frames #[257 "\211\300H\207" [1] 3 (#$ . 4375)]) (byte-code "\300\301\302\303#\300\207" [function-put spinner--frames side-effect-free t] 4) #@73 compiler-macro for inlining `spinner--counter'. (fn CL-WHOLE-ARG CL-X) (defalias 'spinner--counter--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block spinner--counter (progn (aref cl-x 2))) nil] 9 (#$ . 4600)]) (put 'spinner--counter 'compiler-macro 'spinner--counter--cmacro) #@60 Access slot "counter" of `spinner' struct CL-X. (fn CL-X) (defalias 'spinner--counter #[257 "\211\300H\207" [2] 3 (#$ . 4920)]) (byte-code "\300\301\302\303#\300\207" [function-put spinner--counter side-effect-free t] 4) #@69 compiler-macro for inlining `spinner--fps'. (fn CL-WHOLE-ARG CL-X) (defalias 'spinner--fps--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block spinner--fps (progn (aref cl-x 3))) nil] 9 (#$ . 5148)]) (put 'spinner--fps 'compiler-macro 'spinner--fps--cmacro) #@56 Access slot "fps" of `spinner' struct CL-X. (fn CL-X) (defalias 'spinner--fps #[257 "\211\300H\207" [3] 3 (#$ . 5448)]) (byte-code "\300\301\302\303#\300\207" [function-put spinner--fps side-effect-free t] 4) #@71 compiler-macro for inlining `spinner--timer'. (fn CL-WHOLE-ARG CL-X) (defalias 'spinner--timer--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block spinner--timer (progn (aref cl-x 4))) nil] 9 (#$ . 5664)]) (put 'spinner--timer 'compiler-macro 'spinner--timer--cmacro) #@58 Access slot "timer" of `spinner' struct CL-X. (fn CL-X) (defalias 'spinner--timer #[257 "\211\300H\207" [4] 3 (#$ . 5974)]) (byte-code "\300\301\302\303#\300\207" [function-put spinner--timer side-effect-free t] 4) #@74 compiler-macro for inlining `spinner--active-p'. (fn CL-WHOLE-ARG CL-X) (defalias 'spinner--active-p--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block spinner--active-p (progn (aref cl-x 5))) nil] 9 (#$ . 6196)]) (put 'spinner--active-p 'compiler-macro 'spinner--active-p--cmacro) #@61 Access slot "active-p" of `spinner' struct CL-X. (fn CL-X) (defalias 'spinner--active-p #[257 "\211\300H\207" [5] 3 (#$ . 6521)]) (byte-code "\300\301\302\303#\300\207" [function-put spinner--active-p side-effect-free t] 4) #@72 compiler-macro for inlining `spinner--buffer'. (fn CL-WHOLE-ARG CL-X) (defalias 'spinner--buffer--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block spinner--buffer (progn (aref cl-x 6))) nil] 9 (#$ . 6752)]) (put 'spinner--buffer 'compiler-macro 'spinner--buffer--cmacro) #@59 Access slot "buffer" of `spinner' struct CL-X. (fn CL-X) (defalias 'spinner--buffer #[257 "\211\300H\207" [6] 3 (#$ . 7067)]) (byte-code "\300\301\302\303#\300\207" [function-put spinner--buffer side-effect-free t] 4) #@71 compiler-macro for inlining `spinner--delay'. (fn CL-WHOLE-ARG CL-X) (defalias 'spinner--delay--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block spinner--delay (progn (aref cl-x 7))) nil] 9 (#$ . 7292)]) (put 'spinner--delay 'compiler-macro 'spinner--delay--cmacro) #@58 Access slot "delay" of `spinner' struct CL-X. (fn CL-X) (defalias 'spinner--delay #[257 "\211\300H\207" [7] 3 (#$ . 7602)]) (byte-code "\300\301\302\303#\300\207" [function-put spinner--delay side-effect-free t] 4) #@129 compiler-macro for inlining `make-spinner'. (fn CL-WHOLE-ARG &optional TYPE BUFFER-LOCAL FRAMES-PER-SECOND DELAY-BEFORE-START) (defalias 'make-spinner--cmacro #[1281 "\300\301\302\303\211\211    & \207" [cl--defsubst-expand (type buffer-local frames-per-second delay-before-start) (cl-block make-spinner (record 'spinner (spinner--type-to-frames type) 0 (or frames-per-second spinner-frames-per-second) (timer-create) nil (when buffer-local (if (bufferp buffer-local) buffer-local (current-buffer))) (or delay-before-start 0))) nil] 15 (#$ . 7825)]) (put 'make-spinner 'compiler-macro 'make-spinner--cmacro) #@115 Constructor for objects of type `spinner'. (fn &optional TYPE BUFFER-LOCAL FRAMES-PER-SECOND DELAY-BEFORE-START) (defalias 'make-spinner #[1024 "\301\302\303!\304\206\f\305\306\307\211\211\211\211\211\211\211& \307 \205+\310\n!\203* \202+p\2061\304&\207" [spinner-frames-per-second record spinner spinner--type-to-frames 0 vector t nil bufferp] 19 (#$ . 8445)]) (cl-struct-define 'spinner nil 'cl-structure-object 'record nil '((cl-tag-slot) (frames (spinner--type-to-frames type)) (counter 0) (fps (or frames-per-second spinner-frames-per-second)) (timer (timer-create)) (active-p nil) (buffer (when buffer-local (if (bufferp buffer-local) buffer-local (current-buffer)))) (delay (or delay-before-start 0))) 'cl-struct-spinner-tags 'spinner t) #@916 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. Default is `spinner-frames-per-second'. If BUFFER-LOCAL is non-nil, the spinner will be automatically deactivated if the buffer is killed. If BUFFER-LOCAL is a buffer, use that instead of current buffer. When started, in order to function properly, the spinner runs a timer which periodically calls `force-mode-line-update' in the current 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. DELAY, if given, is the number of seconds to wait after starting the spinner before actually displaying it. It is safe to cancel the spinner before this time, in which case it won't display at all. (fn &optional TYPE BUFFER-LOCAL FPS DELAY) (defalias 'spinner-create #[1024 "\301\302\303!\304\206\f\305\306\307\211\211\211\211\211\211\211& \307 \205+\310\n!\203* \202+p\2061\304&\207" [spinner-frames-per-second record spinner spinner--type-to-frames 0 vector t nil bufferp] 19 (#$ . 9213)]) #@184 Return a string of the current frame of SPINNER. If SPINNER is nil, just return nil. Designed to be used in the mode-line with: (:eval (spinner-print some-spinner)) (fn SPINNER) (defalias 'spinner-print #[257 "\211\205\211\300H\205\211\301H\211\302Y\205\303H\234\262\207" [5 2 0 1] 4 (#$ . 10401)]) #@142 Function called to update SPINNER. If SPINNER is no longer active, or if its buffer has been killed, stop the SPINNER's timer. (fn SPINNER) (defalias 'spinner--timer-function #[257 "\211\300H\301H\203\211\203\302!\204\303!\207\211\304\304H\211\305W\203(\211T\2020\211T\306HG\246\262I\266\302!\203Cr\211q\210\307 )\207\307 \207" [6 5 buffer-live-p spinner-stop 2 0 1 force-mode-line-update] 9 (#$ . 10721)]) #@40 Start a SPINNER's timer. (fn SPINNER) (defalias 'spinner--start-timer #[257 "\211\300H\301!\203 \302!\210\211\303\304I\266\3051!\306H\307V0\202#\210\310\204*\311\312!\210\211\313\314\315H\2065\307\306H_[!I\266\316\306H\245\317\320 \"\300H\321#\210\322\323C#\210\324!\210\325\326\"\207" [4 timerp cancel-timer 5 t (error) 3 0 nil error "A spinner's FPS must be a positive number" 2 round 7 1.0 timer-next-integral-multiple-of-time current-time timer-set-time timer-set-function spinner--timer-function timer-activate make-closure #[0 "\301\300!\207" [V0 spinner-stop] 2]] 9 (#$ . 11154)]) #@1127 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. (fn &optional TYPE-OR-OBJECT FPS DELAY) (defalias 'spinner-start #[768 "\304!>\204c\304 !>\203 \211\305\306!I\266\202M\307\310\306!\311\206(\n\312\313\314\211\211\211\211\211\211\211& \314p\205D\315p!\203Cp\202Dp\206J\311& \262 <\203[\316 >\204c \206`\317\316D\203n\211\320I\266\211\203y\211\321I\266\322!\207" [cl-struct-spinner-tags spinner-current spinner-frames-per-second mode-line-process type-of 1 spinner--type-to-frames record spinner 0 vector t nil bufferp spinner--mode-line-construct "" 3 7 spinner--start-timer] 18 (#$ . 11778)]) #@80 Like `spinner-print', but also start SPINNER if it's not active. (fn SPINNER) (defalias 'spinner-start-print #[257 "\211\300H\204\n\301!\210\302!\207" [5 spinner-start spinner-print] 3 (#$ . 13449)]) #@160 Stop SPINNER, defaulting to the current buffer's spinner. It is always safe to call this function, even if there is no active spinner. (fn &optional SPINNER) (defalias 'spinner-stop #[256 "\211\206\302! >\205$\211\303H\304!\203\305!\210\210\211\211\306\307I\266\310 \207" [spinner-current cl-struct-spinner-tags type-of 4 timerp cancel-timer 5 nil force-mode-line-update] 6 (#$ . 13660)]) (provide 'spinner)