- (cond ((and (memql switch '(nil 1))
- (not spray--running))
- (setq spray--running
- (run-with-timer 0 (/ 60.0 spray-wpm) 'spray--update)))
- ((memql switch '(nil -1))
- (cancel-timer spray--running)
- (setq spray--running nil))
- (t
- nil)))
+ (or (spray-stop) (spray-start)))
+
+(defun spray-stop ()
+ "Pause spray.
+Returns t if spray was unpaused."
+ (interactive)
+ (prog1 spray--running
+ (when spray--running
+ (cancel-timer spray--running)
+ (setq spray--running nil))))
+
+(defun spray-start ()
+ "Start / resume spray."
+ (interactive)
+ (setq spray--running
+ (run-with-timer 0 (/ 60.0 spray-wpm) 'spray--update)))
+