Merge remote-tracking branch 'oscarfv/faster-slower'
authorIan Kelling <ian@iankelling.org>
Thu, 26 Jun 2014 03:58:46 +0000 (23:58 -0400)
committerIan Kelling <ian@iankelling.org>
Thu, 26 Jun 2014 03:58:46 +0000 (23:58 -0400)
1  2 
spray.el

diff --combined spray.el
index bbc15bee2c0e22840e8fae2129ffe6bd6791e4f8,48819cb12ad2d42ea97c30bf760044f195ce00ef..77df087f748797441aa1651bdfebbe9a08ad1f08
+++ b/spray.el
@@@ -54,6 -54,8 +54,8 @@@
      (define-key km (kbd "l") 'spray-forward-word)
      (define-key km (kbd "<left>") 'spray-backward-word)
      (define-key km (kbd "<right>") 'spray-forward-word)
+     (define-key km (kbd "f") 'spray-faster)
+     (define-key km (kbd "s") 'spray-slower)
      km)
    "keymap for spray-mode buffers")
  
  (make-face 'spray-base-face)
  (set-face-attribute 'spray-base-face nil
                      :background (face-background 'default)
 -                    :foreground (face-foreground 'default))
 +                    :foreground (face-foreground 'default)
 +                    :slant 'normal)
  
  (make-face 'spray-orp-face)
  (set-face-attribute 'spray-orp-face nil
                      :foreground "red"
                      :overline (face-foreground 'default)
 -                    :underline (face-foreground 'default))
 +                    :underline (face-foreground 'default)
 +                    :slant 'normal)
  
  ;; * internal vars
  
@@@ -200,6 -200,32 +202,32 @@@ an integer or a float value.
    (skip-chars-backward "\s\t\n")
    (spray--word-at-point))
  
+ (defun spray-faster ()
+   "Increases speed.
+ Increases the wpm (words per minute) parameter. See the variable
+ `spray-wmp'."
+   (interactive)
+   (spray-inc-wpm 20))
+ (defun spray-slower ()
+   "Decreases speed.
+ Decreases the wpm (words per minute) parameter. See the variable
+ `spray-wmp'."
+   (interactive)
+   (spray-inc-wpm -20))
+ (defun spray-inc-wpm (delta)
+   (let ((was-running spray--running))
+     (spray-start/stop -1)
+     (when (< 10 (+ spray-wpm delta))
+       (setq spray-wpm (+ spray-wpm delta)))
+     (spray-backward-word)
+     (message "spray wpm: %d" spray-wpm)
+     (when was-running
+       (spray-start/stop 1))))
  ;; * provide
  
  (provide 'spray)