From: 蛇崩乃音 Date: Thu, 3 Mar 2016 13:58:27 +0000 (+0100) Subject: added function to display current position and remaining time X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=5f807d1cf0b25dc2169bdba49c1f58efd6e5109d;p=spray added function to display current position and remaining time --- diff --git a/spray.el b/spray.el index c0d7808..e54de54 100644 --- a/spray.el +++ b/spray.el @@ -161,6 +161,7 @@ decreasing by one for each subsequent word." (define-key km (kbd "") 'spray-forward-word) (define-key km (kbd "f") 'spray-faster) (define-key km (kbd "s") 'spray-slower) + (define-key km (kbd "t") 'spray-time) (define-key km (kbd "q") 'spray-quit) (define-key km (kbd "") 'spray-quit) (define-key km [remap forward-char] 'spray-forward-word) @@ -349,6 +350,16 @@ Decreases the wpm (words per minute) parameter. See the variable (when was-running (spray-start)))) +(defun spray-time () + (interactive) + (widen) + (let ((position (progn (skip-chars-backward "^\s\t\n—") (point)))) + (message + "%d per cent done; ~%d minute(s) remaining" + (* 100 (/ position (+ 0.0 (point-max)))) + (fround (/ (count-words-region position (point-max)) (+ 0.0 spray-wpm))))) + (spray--word-at-point)) + ;; * provide (provide 'spray)