Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speak region, speak next paragraph #27

Open
wickedjargon opened this issue Dec 25, 2017 · 2 comments
Open

speak region, speak next paragraph #27

wickedjargon opened this issue Dec 25, 2017 · 2 comments

Comments

@wickedjargon
Copy link

i'm not interested in any of the automatic speaking features. I'd like to turn those off (the ones demonstrated in the video). I'd like to two features: 'speak region' and 'speak next paragraph'

@smythp
Copy link
Owner

smythp commented Dec 26, 2017

Here's a function to speak the active region, assuming you have espeak installed and accessible from Emacs:

(defun speak-my-text () "Speaks text in buffer."
  (interactive)
(if (region-active-p)
  (progn
    (kill-ring-save (region-beginning) (region-end))
      (start-process-shell-command "speakbuffvar" nil
        "bash -c \"killall espeak;xsel --clipboard|espeak -s 290\""))
  (progn
    (kill-ring-save (point-min) (point-max))
      (start-process-shell-command "speakbuffvar" nil
        "bash -c \"killall espeak;xsel --clipboard|espeak -s 290\""))))

Tested on Ubuntu, but should work on OSX, possibly with a tweak or two. Let me know if you can't get it working and I'll try to help. Remember that espeak will need to be accessible from your shell in Emacs.

@smythp
Copy link
Owner

smythp commented Dec 26, 2017

PS Just thinking this might not work on OSX because xsel doesn't work without running an x server. If you're on OSX, let me know and I'll try writing something that works for you. Also, if you're reading a text file, how do you define paragraph? I don't think Emacs has any functionality for moving between paragraphs. Go to next blank line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants