Skip to content

Instantly share code, notes, and snippets.

@jakebox
Last active August 31, 2021 01:36
Show Gist options
  • Save jakebox/92a04b99f13558c80192399d59e84d7d to your computer and use it in GitHub Desktop.
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.
(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