0

I'm creating an Elisp function that basically copies the selected text to the clipboard and then it sends a signal to a TCP port that will trigger a TTS voice that reads aloud what's on the clipboard for me. The function I'm using is the following:

(defun read-aloud ()
  "Read aloud selected text."
  (interactive)
  (call-interactively 'evil-yank)
  (setq code "echo -n 'read-aloud' | netcat -q 2 localhost 7777")
  (shell-command-to-string code))

Even though it works fine... The function (call-interactively 'evil-yank) freezes for more than 10 seconds when I execute this read-aloud function. I don't get why it's happening because if I call it directly with :(call-interactively 'evil-yank) it works immediately. Is there anything wrong with my Elisp function? If not how can I debug what's happening and why is it so slow?

Drew
  • 75,699
  • 9
  • 109
  • 225
raylight
  • 217
  • 8
  • https://emacs.stackexchange.com/tags/elisp/info – Drew Dec 31 '22 at 19:10
  • Do you see the same problem if you start Emacs using `emacs -Q`? If not, bisect your init file to find the culprit. – Drew Dec 31 '22 at 19:11
  • @Drew Well, it's happening on a fresh Spacemacs install... I ended up removing the line `(call-interactively 'evil-yank)` from the function and then I just type `y SPC read-aloud-shortcut` to make it work. I haven't found the emacs equivalent to the `evil-yank` function (it only copies the selected text to the clipboard), but finding the equivalent command probably would be the best solution for this question. – raylight Jan 02 '23 at 07:20

0 Answers0