commit 126f2ebdb91ace89b50214890b25f0c85b94d99a
parent 134f9882a1bf6d6da46b710f4cf8fc18b01656d9
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Sat, 8 Jul 2023 18:22:34 +0300
Add a few docstrings. Also attempt to kill the non-running process.
Diffstat:
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/nano-tts.el b/nano-tts.el
@@ -9,6 +9,8 @@ nil when no text-to-speech engine is running.")
(defun nano-tts--get-region-as-string-to-speak ()
+ "Returns the string inside the region and concatenates a newline
+at its end for better espeak-ability."
(concat
(buffer-substring (region-beginning)
(region-end))
@@ -18,6 +20,10 @@ nil when no text-to-speech engine is running.")
(defun nano-tts-speak ()
+ "Starts a new TTS process and send the region's text into its
+stdin, otherwise send the same to the existing running TTS
+process. If the process is not running, make the system forget
+about the last process."
(interactive)
(if nano-tts--tts-process
@@ -33,9 +39,17 @@ nil when no text-to-speech engine is running.")
(nano-tts--get-region-as-string-to-speak)))
;; If the TTS process is not running.
(t
+
+ ;; TODO: Trying to also kill the process before making the
+ ;; system forget about it.
+ (nano-tts-kill)
+
+ ;; TODO: Commenting the previous way of dealing with
+ ;; non-running processes:
+ ;;
;; Make the system aware that the TTS process had stopped.
- (setq nano-tts--tts-process
- nil))))
+ ;; (setq nano-tts--tts-process nil)
+ )))
;; If there is no running TTS process.
(progn
@@ -51,6 +65,8 @@ nil when no text-to-speech engine is running.")
(defun nano-tts-kill ()
+ "Set the system's variable holding the process object to nil and
+kill the process."
(interactive)
;; If there is a TTS process object.