[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Search]

[Emacspeak] [Patch] Ensure multistream servers correctly handle language changes



From fb4488cecc62fa3f55664b7db7fadd69d1b31d14 Mon Sep 17 00:00:00 2001
From: Krzysztof Drewniak <krzysdrewniak@xxxxxxxxxxx>
Date: Mon, 20 Jun 2022 21:54:01 -0500
Subject: [PATCH] Update dtk-set*-language to account for notification server.

As a note, user-facing documentation should be updated to ensure users
call dtk-initialize before calling language-related settings in order
to ensure all the processes are available to receive the setting.
---
 lisp/dtk-speak.el | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/dtk-speak.el b/lisp/dtk-speak.el
index be69108e6..34aac5d33 100644
--- a/lisp/dtk-speak.el
+++ b/lisp/dtk-speak.el
@@ -457,29 +457,41 @@ Uses a 5ms fade-in and fade-out. "
  voice, using the syntax language:voice , where language can be
  omitted."
   (interactive "sEnter language: \n")
-  (cl-declare (special dtk-speak-server-initialized))
+  (cl-declare (special dtk-speak-server-initialized dtk-speaker-process))
   (when dtk-speak-server-initialized
+    (unless (eq dtk-speaker-process (dtk-notify-process))
+      (let ((dtk-speaker-process (dtk-notify-process)))
+        (dtk-interp-language lang nil)))
     (dtk-interp-language lang (called-interactively-p 'interactive))))
 
 (defun dtk-set-next-language ()
   "Switch to  next  language"
   (interactive)
-  (cl-declare (special dtk-speak-server-initialized))
+  (cl-declare (special dtk-speak-server-initialized dtk-speaker-process))
   (when dtk-speak-server-initialized
+    (unless (eq dtk-speaker-process (dtk-notify-process))
+      (let ((dtk-speaker-process (dtk-notify-process)))
+        (dtk-interp-next-language nil)))
     (dtk-interp-next-language (called-interactively-p 'interactive))))
 
 (defun dtk-set-previous-language ()
   "Switch to  previous  language"
   (interactive)
-  (cl-declare (special dtk-speak-server-initialized))
+  (cl-declare (special dtk-speak-server-initialized dtk-speake-process))
   (when dtk-speak-server-initialized
+    (unless (eq dtk-speaker-process (dtk-notify-process))
+      (let ((dtk-speaker-process (dtk-notify-process)))
+        (dtk-interp-previous-language nil)))
     (dtk-interp-previous-language (called-interactively-p 'interactive))))
 
 (defun dtk-set-preferred-language (alias lang)
   "Set language by alias."
   (interactive "s")
-  (cl-declare (special dtk-speak-server-initialized))
+  (cl-declare (special dtk-speak-server-initialized dtk-speaker-process))
   (when dtk-speak-server-initialized
+    (unless (eq dtk-speaker-process (dtk-notify-process))
+      (let ((dtk-speaker-process (dtk-notify-process)))
+        (dtk-interp-preferred-language alias lang)))
     (dtk-interp-preferred-language alias lang)))
 
 ;; helper function:
-- 
2.25.1



|May 1995 - Last Year|Current Year|


If you have questions about this archive or had problems using it, please contact us.

Contact Info Page