Last active
August 31, 2021 01:36
-
-
Save jakebox/92a04b99f13558c80192399d59e84d7d to your computer and use it in GitHub Desktop.
Simple Emacs function to calculate the speaking time of a selection of text. Replace '150' with your average speaking time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun jib/calc-speaking-time () | |
"Calculate how long it would take me to speak aloud the selection." | |
(interactive) | |
(if (use-region-p) (let* ((wpm 150) | |
(word-count (float (count-words-region (region-beginning) (region-end)))) | |
(raw-time (* 60 (/ word-count wpm)))) | |
(message "%s minutes, %s seconds to speak at %d wpm" | |
(format-seconds "%m" raw-time) | |
(floor(mod raw-time 60)) wpm)) | |
(error "Error: select a region."))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment