diff -Nru speechd-el-2.9/ANNOUNCE speechd-el-2.11/ANNOUNCE --- speechd-el-2.9/ANNOUNCE 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/ANNOUNCE 2021-07-03 08:56:35.000000000 +0000 @@ -1,5 +1,5 @@ -speechd-el 2.9 released -======================= +speechd-el 2.11 released +======================== * What is speechd-el? @@ -39,12 +39,26 @@ - Free Software, distributed under the GPL. More information about speechd-el (including comparison with - Emacspeak) can be found on its web page, see - http://devel.freebsoft.org/speechd-el . + Emacspeak) can be found on http://devel.freebsoft.org/speechd-el . -* What is new in the 2.9 version? +* What is new in the 2.11 version? - ** Bug fixes. + ** Index marking support + + Set speechd-speak-use-index-marks variable to `t' to enable index + marking. Note that it may have performance or other issues. How well + index marking actually works is also dependent on the speech + synthesizer used. + + ** Improvement of reading wrapped lines + + If truncate-lines is nil, lines are read only to their visual ends + (thanks to Nicolas Graner). + + ** Internal cleanup + + The code has been updated to match current Emacs practices and all + compilation warnings have been resolved. * Where to get it? @@ -56,9 +70,7 @@ https://github.com/brailcom/speechd-el The source package of the released version is available at - https://github.com/brailcom/speechd-el/releases/download/speechd-el-2.9/speechd-el-2.9.tar.gz . - - The home page of the project is http://devel.freebsoft.org/speechd-el . + https://github.com/brailcom/speechd-el/releases/download/speechd-el-2.11/speechd-el-2.11.tar.gz . Local Variables: diff -Nru speechd-el-2.9/braille.el speechd-el-2.11/braille.el --- speechd-el-2.9/braille.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/braille.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,7 +1,7 @@ -;;; braille.el --- Simple Emacs braille display emulator +;;; braille.el --- Simple Emacs braille display emulator -*- lexical-binding: t -*- +;; Copyright (C) 2012-2021 Milan Zamazal ;; Copyright (C) 2004 Brailcom, o.p.s. -;; Copyright (C) 2012 Milan Zamazal ;; Author: Milan Zamazal @@ -25,8 +25,7 @@ ;;; Code: -(eval-when-compile - (require 'cl)) +(require 'cl-lib) (defvar braille-buffer-name "*braille-monitor*") @@ -140,6 +139,7 @@ "Mode for displaying braille display emulator." (setq buffer-read-only t) (setq truncate-lines t) + (defvar speechd-speak-mode) (set (make-local-variable 'speechd-speak-mode) nil)) @@ -150,22 +150,20 @@ (erase-buffer) (insert "\n\n\n\n\n") (dolist (c (append string nil)) - (let ((code (cdr (or (assoc c braille-table) (assq t braille-table)))) - (suffix " ")) + (let ((code (cdr (or (assoc c braille-table) (assq t braille-table))))) (when cursor-position (if (= cursor-position 0) (setq code (cons 8 code) cursor-position nil) - (decf cursor-position))) - (cl-flet ((display-dot (dot) - (end-of-line) - (insert (if (member dot code) "o" " ") suffix) - (forward-line))) + (cl-decf cursor-position))) + (cl-flet ((display-dot (dot suffix) + (end-of-line) + (insert (if (member dot code) "o" " ") suffix) + (forward-line))) (goto-char (point-min)) - (mapc #'display-dot '(1 2 3 7)) + (mapc #'(lambda (d) (display-dot d " ")) '(1 2 3 7)) (goto-char (point-min)) - (let ((suffix " ")) - (mapc #'display-dot '(4 5 6 8))))) + (mapc #'(lambda (d) (display-dot d " ")) '(4 5 6 8)))) (goto-char (point-max)) (insert (format " %c " c))) (when (equal cursor-position 0) diff -Nru speechd-el-2.9/brltty.el speechd-el-2.11/brltty.el --- speechd-el-2.9/brltty.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/brltty.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,7 +1,7 @@ -;;; brltty.el --- Interface to BRLTTY +;;; brltty.el --- Interface to BRLTTY -*- lexical-binding: t -*- -;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Brailcom, o.p.s. -;; Copyright (C) 2012, 2013, 2020 Milan Zamazal +;; Copyright (C) 2012-2021 Milan Zamazal +;; Copyright (C) 2004-2008 Brailcom, o.p.s. ;; Author: Milan Zamazal @@ -25,7 +25,7 @@ ;;; Code: -(require 'cl) +(require 'cl-lib) (require 'speechd-common) @@ -36,7 +36,7 @@ (defgroup brltty () "BRLTTY interface." :group 'speechd-el) - + (defcustom brltty-default-host "localhost" "Default BRLTTY host to connect to." :type 'string @@ -131,7 +131,7 @@ (?K . key) (?C . credentials))) -(defstruct brltty--connection +(cl-defstruct brltty--connection process (protocol-version nil) (display-width nil) @@ -151,8 +151,8 @@ (unless brltty--emacs-process-ok (defvar brltty--process-connections '())) -(lexical-let ((last-selected-frame 'uninitialized) - (last-terminal-spec 'uninitialized)) +(let ((last-selected-frame 'uninitialized) + (last-terminal-spec 'uninitialized)) (defun brltty--terminal-spec () (if (eq (selected-frame) last-selected-frame) last-terminal-spec @@ -287,8 +287,8 @@ (brltty--disable-connection connection err)))) (defun brltty--read-input (connection) - (destructuring-bind (type . data) (brltty--read-packet connection) - (case type + (cl-destructuring-bind (type . data) (brltty--read-packet connection) + (cl-case type (err (let ((err-number (brltty--read-integer data))) (if (= err-number brltty--protocol-version-error) @@ -352,14 +352,14 @@ (cdr answer))) (defun brltty--send-packet (connection answer packet-id &rest data-list) - (let ((length (reduce #'+ data-list :initial-value 0 - :key #'(lambda (data) - (cond - ((integerp data) 4) - ((consp data) - (ecase (car data) - (integer64 8))) - (t (length data)))))) + (let ((length (cl-reduce #'+ data-list :initial-value 0 + :key #'(lambda (data) + (cond + ((integerp data) 4) + ((consp data) + (cl-ecase (car data) + (integer64 8))) + (t (length data)))))) (process (brltty--connection-process connection))) (when process (with-speechd-coding-protection @@ -370,10 +370,10 @@ (encode-coding-string (apply #'format "%c%c%c%c" (funcall #'reverse - (loop for i from 1 to 4 - for x = n then (/ x 256) - for rem = (% x 256) - collect rem))) + (cl-loop for i from 1 to 4 + for x = n then (/ x 256) + for rem = (% x 256) + collect rem))) brltty-coding)))) (send-integer length) (send-integer (cdr (assoc packet-id brltty--packet-types))) @@ -387,8 +387,8 @@ process (encode-coding-string (format "%c" (aref data i)) brltty-coding)))) ((consp data) - (destructuring-bind (n1 n2 n3) (cdr data) - (ecase (car data) + (cl-destructuring-bind (n1 n2 n3) (cdr data) + (cl-ecase (car data) (integer64 (process-send-string process @@ -412,7 +412,7 @@ (defun brltty--update-terminal-spec (connection) (let ((terminal-spec (brltty--terminal-spec)) (orig-terminal-spec (brltty--connection-terminal-spec connection))) - (unless (equalp terminal-spec orig-terminal-spec) + (unless (cl-equalp terminal-spec orig-terminal-spec) (when orig-terminal-spec (brltty--send-packet connection 'ack 'leavetty)) (apply 'brltty--send-packet @@ -437,7 +437,7 @@ ;; In protocol >= 8 server initiates communication, let's look if ;; there is any (let* ((connection (brltty--open-connection host port key-handler)) - (version (or (first (brltty--read-answer connection 'version t)) + (version (or (cl-first (brltty--read-answer connection 'version t)) 7))) (if (> version 7) (progn diff -Nru speechd-el-2.9/debian/changelog speechd-el-2.11/debian/changelog --- speechd-el-2.9/debian/changelog 2020-04-23 20:06:43.000000000 +0000 +++ speechd-el-2.11/debian/changelog 2021-09-22 13:46:24.000000000 +0000 @@ -1,3 +1,28 @@ +speechd-el (2.11-2) unstable; urgency=medium + + * Standards 4.6.0 (no real change). + * List the GitHub page as the upstream home page. + + -- Milan Zamazal Wed, 22 Sep 2021 15:46:24 +0200 + +speechd-el (2.11-1) experimental; urgency=medium + + * New upstream version. + * install-info added to build dependencies. + * debhelper build dependency updated. + * Use /usr/bin/perl in speechd-log-extractor. + * Remove generated speechd-el.cs.* files on cleanup. + + -- Milan Zamazal Sat, 03 Jul 2021 11:01:17 +0200 + +speechd-el (2.10-1) experimental; urgency=medium + + * New upstream version. + * debian/rules converted to dh. + * Standards 4.5.1. + + -- Milan Zamazal Fri, 11 Jun 2021 21:26:53 +0200 + speechd-el (2.9-2) unstable; urgency=medium * New, source-only, upload. diff -Nru speechd-el-2.9/debian/clean speechd-el-2.11/debian/clean --- speechd-el-2.9/debian/clean 1970-01-01 00:00:00.000000000 +0000 +++ speechd-el-2.11/debian/clean 2021-07-03 10:08:10.000000000 +0000 @@ -0,0 +1,2 @@ +speechd-el.cs.info +speechd-el.cs.tmp.texi diff -Nru speechd-el-2.9/debian/compat speechd-el-2.11/debian/compat --- speechd-el-2.9/debian/compat 2016-11-10 19:26:31.000000000 +0000 +++ speechd-el-2.11/debian/compat 2021-06-11 20:17:31.000000000 +0000 @@ -1 +1 @@ -9 \ No newline at end of file +12 \ No newline at end of file diff -Nru speechd-el-2.9/debian/control speechd-el-2.11/debian/control --- speechd-el-2.9/debian/control 2019-08-02 10:48:32.000000000 +0000 +++ speechd-el-2.11/debian/control 2021-09-22 13:46:24.000000000 +0000 @@ -2,11 +2,11 @@ Section: editors Priority: optional Maintainer: Milan Zamazal -Build-Depends: debhelper (>= 7) -Build-Depends-Indep: texinfo -Standards-Version: 3.9.8 -Homepage: http://www.freebsoft.org/speechd-el - +Build-Depends: debhelper (>= 12) +Build-Depends-Indep: install-info, texinfo +Standards-Version: 4.6.0 +Homepage: https://github.com/brailcom/speechd-el + Package: speechd-el Architecture: all Depends: emacs | emacs-gtk | emacs-lucid | emacs-nox | emacsen, make, base-files (>= 4.0.1), emacsen-common (>= 2.0.8), ${misc:Depends} diff -Nru speechd-el-2.9/debian/patches/accept-process-output.patch speechd-el-2.11/debian/patches/accept-process-output.patch --- speechd-el-2.9/debian/patches/accept-process-output.patch 2012-06-06 20:16:24.000000000 +0000 +++ speechd-el-2.11/debian/patches/accept-process-output.patch 2021-07-03 09:27:07.000000000 +0000 @@ -2,9 +2,9 @@ Index: speechd-el/brltty.el =================================================================== ---- speechd-el.orig/brltty.el 2012-06-06 22:06:15.000000001 +0200 -+++ speechd-el/brltty.el 2012-06-06 22:16:21.000000001 +0200 -@@ -82,8 +82,7 @@ +--- speechd-el.orig/brltty.el ++++ speechd-el/brltty.el +@@ -82,8 +82,7 @@ available, from the environment variabl ;;; Internal functions and data @@ -14,20 +14,3 @@ (defconst brltty--emacs-process-ok (fboundp 'process-put)) -Index: speechd-el/speechd.el -=================================================================== ---- speechd-el.orig/speechd.el 2012-06-06 22:06:15.000000001 +0200 -+++ speechd-el/speechd.el 2012-06-06 22:16:21.000000001 +0200 -@@ -450,11 +450,7 @@ - (let ((speechd-client-name name)) - (speechd-open))))) - --(defvar speechd--advanced-apo (condition-case _ -- (progn -- (accept-process-output nil 0 0 1) -- t) -- (error))) -+(defvar speechd--advanced-apo t) - - (defun speechd--call-spdsend (args &optional input) - (with-temp-buffer diff -Nru speechd-el-2.9/debian/patches/csdoc.texi speechd-el-2.11/debian/patches/csdoc.texi --- speechd-el-2.9/debian/patches/csdoc.texi 2013-08-24 20:59:17.000000000 +0000 +++ speechd-el-2.11/debian/patches/csdoc.texi 2021-07-03 09:27:26.000000000 +0000 @@ -1,7 +1,7 @@ Index: speechd-el/speechd-el.cs.texi =================================================================== ---- speechd-el.orig/speechd-el.cs.texi 2013-08-24 22:58:29.000000001 +0200 -+++ speechd-el/speechd-el.cs.texi 2013-08-24 22:58:50.000000001 +0200 +--- speechd-el.orig/speechd-el.cs.texi ++++ speechd-el/speechd-el.cs.texi @@ -1,6 +1,6 @@ \chyph \def\fontprefix{cs} @@ -10,7 +10,7 @@ @comment %**start of header @setfilename speechd-el.cs.info @documentlanguage cs -@@ -1636,7 +1636,14 @@ +@@ -1626,7 +1626,14 @@ sdělit, neváhejte se obrátit na adresu @ @c **************************************************************************** @node Kopírování tohoto manuálu, Index, Kontaktní informace, Top @@ -28,9 +28,9 @@ @center Version 1.2, November 2002 Index: speechd-el/Makefile =================================================================== ---- speechd-el.orig/Makefile 2013-08-24 22:58:46.000000001 +0200 -+++ speechd-el/Makefile 2013-08-24 22:59:12.000000001 +0200 -@@ -45,6 +45,7 @@ +--- speechd-el.orig/Makefile ++++ speechd-el/Makefile +@@ -45,6 +45,7 @@ uninstall: mostlyclean: rm -f *.aux *.cp *.cps *.fn *.ky *.log *.pg *.toc *.tp *.vr *~ @@ -38,7 +38,7 @@ clean: mostlyclean rm -f *.dvi *.elc speechd-el.pdf *.ps -@@ -61,12 +62,15 @@ +@@ -61,12 +62,15 @@ TAGS: doc: info pdf info: speechd-el.info dir diff -Nru speechd-el-2.9/debian/patches/logextractor-interpreter.patch speechd-el-2.11/debian/patches/logextractor-interpreter.patch --- speechd-el-2.9/debian/patches/logextractor-interpreter.patch 1970-01-01 00:00:00.000000000 +0000 +++ speechd-el-2.11/debian/patches/logextractor-interpreter.patch 2021-07-03 09:45:44.000000000 +0000 @@ -0,0 +1,10 @@ +Index: speechd-el/speechd-log-extractor +=================================================================== +--- speechd-el.orig/speechd-log-extractor ++++ speechd-el/speechd-log-extractor +@@ -1,4 +1,4 @@ +-#!/usr/bin/env perl ++#!/usr/bin/perl + + # Copyright (C) 2004 Brailcom, o.p.s. + # diff -Nru speechd-el-2.9/debian/patches/logextractor-path.patch speechd-el-2.11/debian/patches/logextractor-path.patch --- speechd-el-2.9/debian/patches/logextractor-path.patch 2012-06-06 20:16:19.000000000 +0000 +++ speechd-el-2.11/debian/patches/logextractor-path.patch 2021-07-03 09:27:46.000000000 +0000 @@ -1,10 +1,10 @@ Index: speechd-el/speechd-bug.el =================================================================== ---- speechd-el.orig/speechd-bug.el 2012-06-06 22:06:15.000000001 +0200 -+++ speechd-el/speechd-bug.el 2012-06-06 22:16:14.000000001 +0200 -@@ -27,7 +27,7 @@ +--- speechd-el.orig/speechd-bug.el ++++ speechd-el/speechd-bug.el +@@ -28,7 +28,7 @@ (require 'speechd-speak) - + -(defvar speechd-bug--log-extractor "speechd-log-extractor") +(defvar speechd-bug--log-extractor "/usr/share/emacs/site-lisp/speechd-el/speechd-log-extractor") diff -Nru speechd-el-2.9/debian/patches/series speechd-el-2.11/debian/patches/series --- speechd-el-2.9/debian/patches/series 2020-02-07 21:16:26.000000000 +0000 +++ speechd-el-2.11/debian/patches/series 2021-07-03 09:39:37.000000000 +0000 @@ -1,3 +1,4 @@ logextractor-path.patch accept-process-output.patch csdoc.texi +logextractor-interpreter.patch diff -Nru speechd-el-2.9/debian/rules speechd-el-2.11/debian/rules --- speechd-el-2.9/debian/rules 2012-04-07 12:40:02.000000000 +0000 +++ speechd-el-2.11/debian/rules 2021-07-03 10:03:38.000000000 +0000 @@ -4,58 +4,25 @@ #export DH_VERBOSE=1 package=speechd-el +ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS))) + DOC_TARGETS=info info-cs +endif -.NOTPARALLEL: +%: + dh $@ -build: build-arch build-indep -build-arch: build-stamp -build-indep: build-stamp -build-stamp: - dh_testdir - $(MAKE) info info-cs - touch build-stamp - -clean: - dh_testdir - dh_testroot - rm -f build-stamp - $(MAKE) distclean - rm -f speechd-el.cs.info* - dh_clean - -install: build - dh_testdir - dh_testroot - dh_prep - dh_installdirs +override_dh_auto_build: + $(MAKE) $(DOC_TARGETS) + +override_dh_install: dh_install Makefile *.el usr/share/emacs/site-lisp/speechd-el/ install speechd-log-extractor \ debian/$(package)/usr/share/emacs/site-lisp/speechd-el/ -# Build architecture-independent files here. -binary-indep: build install - dh_testdir - dh_testroot - dh_installchangelogs -A +override_dh_installdocs: dh_installdocs ANNOUNCE NEWS README speechd-speak.pdf dh_installdocs -p $(package)-doc-cs - dh_installexamples - dh_install -A - dh_installemacsen + +override_dh_installinfo: dh_installinfo speechd-el.info* dh_installinfo -p $(package)-doc-cs speechd-el.cs.info* - dh_link - dh_compress -A - dh_fixperms -A - dh_installdeb -A - dh_shlibdeps - dh_gencontrol -A - dh_md5sums -A - dh_builddeb -A - -# Build architecture-dependent files here. -binary-arch: build install -# We have nothing to do by default. - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff -Nru speechd-el-2.9/Makefile speechd-el-2.11/Makefile --- speechd-el-2.9/Makefile 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/Makefile 2021-07-03 08:56:35.000000000 +0000 @@ -1,6 +1,6 @@ # Makefile for speechd-el -# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Brailcom, o.p.s. -# Copyright (C) 2012, 2013, 2016 Milan Zamazal +# Copyright (C) 2012-2021 Milan Zamazal +# Copyright (C) 2003-2010 Brailcom, o.p.s. # COPYRIGHT NOTICE # @@ -20,7 +20,7 @@ EMACS = emacs NAME = speechd-el -VERSION = 2.9 +VERSION = 2.11 DISTDIR = $(NAME)-$(VERSION) TARFILE = $(NAME)-$(VERSION).tar diff -Nru speechd-el-2.9/mmanager.el speechd-el-2.11/mmanager.el --- speechd-el-2.9/mmanager.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/mmanager.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,5 +1,6 @@ -;;; mmanager.el --- Message manager +;;; mmanager.el --- Message manager -*- lexical-binding: t -*- +;; Copyright (C) 2021 Milan Zamazal ;; Copyright (C) 2004, 2005 Brailcom, o.p.s. ;; Author: Milan Zamazal @@ -22,7 +23,7 @@ ;;; Code: -(require 'cl) +(require 'cl-lib) ;;; User customization @@ -38,7 +39,7 @@ ;;; Data structures -(defstruct mmanager--manager +(cl-defstruct mmanager--manager (queue '()) (current-message nil) (message-blocks '()) @@ -53,7 +54,7 @@ (history '()) (history-cursor nil)) -(defstruct mmanager--message +(cl-defstruct mmanager--message messages priority client @@ -101,7 +102,7 @@ (defun mmanager--prune-queue (manager condition) (setf (mmanager--manager-queue manager) - (remove-if condition (mmanager--manager-queue manager)))) + (cl-remove-if condition (mmanager--manager-queue manager)))) (defun mmanager--update-queue (manager message* priority) (let* ((queue (mmanager--manager-queue manager)) @@ -123,28 +124,27 @@ (defun mmanager--enqueue* (manager message* priority) (when (mmanager--message-messages message*) - (let ((queue (mmanager--manager-queue manager))) - (ecase priority - (important - (mmanager--pause manager)) - ((message text) - (mmanager--prune-queue - manager - #'(lambda (m) (memq (mmanager--message-priority m) - '(text notification)))) - (when (not (memq (mmanager--current-priority manager) - '(important message))) - (mmanager--stop manager))) - (notification - (when (and (or (not (mmanager--busy manager)) - (eq (mmanager--current-priority manager) - 'notification)) - (not (mmanager--manager-queue manager))) - (mmanager--stop manager))) - (progress - (mmanager--prune-queue - manager - #'(lambda (m) (eq (mmanager--message-priority m) 'progress)))))) + (cl-ecase priority + (important + (mmanager--pause manager)) + ((message text) + (mmanager--prune-queue + manager + #'(lambda (m) (memq (mmanager--message-priority m) + '(text notification)))) + (when (not (memq (mmanager--current-priority manager) + '(important message))) + (mmanager--stop manager))) + (notification + (when (and (or (not (mmanager--busy manager)) + (eq (mmanager--current-priority manager) + 'notification)) + (not (mmanager--manager-queue manager))) + (mmanager--stop manager))) + (progress + (mmanager--prune-queue + manager + #'(lambda (m) (eq (mmanager--message-priority m) 'progress))))) (mmanager--update-queue manager message* priority) (mmanager-next manager))) @@ -217,8 +217,8 @@ (let ((message (mmanager--client-block manager client))) (when message (setf (mmanager--manager-message-blocks manager) - (remove* client (mmanager--manager-message-blocks manager) - :key #'car :test #'string=)) + (cl-remove client (mmanager--manager-message-blocks manager) + :key #'car :test #'string=)) (unless (eq message 'canceled) (mmanager--enqueue* manager message (mmanager--message-priority message)))))) @@ -233,20 +233,20 @@ (defun mmanager-history (manager which) (let ((history (mmanager--manager-history manager)) (cursor (mmanager--manager-history-cursor manager))) - (ecase which + (cl-ecase which (current - (find cursor history :test #'eq)) + (cl-find cursor history :test #'eq)) (next - (let ((next (rest (member* cursor history :test #'eq)))) + (let ((next (cl-rest (cl-member cursor history :test #'eq)))) (when next - (setf (mmanager--manager-history-cursor manager) (first next))))) + (setf (mmanager--manager-history-cursor manager) (cl-first next))))) (previous - (let ((pos (position cursor history :test #'eq))) + (let ((pos (cl-position cursor history :test #'eq))) (when (and pos (> pos 0)) (setf (mmanager--manager-history-cursor manager) (nth (1- pos) history))))) (first - (setf (mmanager--manager-history-cursor manager) (first history))) + (setf (mmanager--manager-history-cursor manager) (cl-first history))) (last (setf (mmanager--manager-history-cursor manager) (car (last history))))))) diff -Nru speechd-el-2.9/NEWS speechd-el-2.11/NEWS --- speechd-el-2.9/NEWS 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/NEWS 2021-07-03 08:56:35.000000000 +0000 @@ -1,5 +1,34 @@ User-visible changes to speechd-el: +* Changes in speechd-el 2.11 + +** Index marking support + +Set speechd-speak-use-index-marks variable to `t' to enable index +marking. Note that it may have performance or other issues. How well +index marking actually works is also dependent on the speech +synthesizer used. + +** Improvement of reading wrapped lines + +If truncate-lines is nil, lines are read only to their visual ends +(thanks to Nicolas Graner). + +** Internal cleanup + +The code has been updated to match current Emacs practices and all +compilation warnings have been resolved. + + +* Changes in speechd-el 2.10 + +** New user option speechd-speak-emacs-language. + +It sets the language for messages read in English by default. + +** Bug fixes. + + * Changes in speechd-el 2.9 ** Bug fixes. diff -Nru speechd-el-2.9/speechd-braille.el speechd-el-2.11/speechd-braille.el --- speechd-el-2.9/speechd-braille.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-braille.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,7 +1,7 @@ -;;; speechd-braille.el --- Emacs braille emulator driver +;;; speechd-braille.el --- Emacs braille emulator driver -*- lexical-binding: t -*- -;; Copyright (C) 2004, 2005, 2006, 2008 Brailcom, o.p.s. -;; Copyright (C) 2012 Milan Zamazal +;; Copyright (C) 2012-2021 Milan Zamazal +;; Copyright (C) 2004-2008 Brailcom, o.p.s. ;; Author: Milan Zamazal @@ -74,12 +74,12 @@ (run-at-time speechd-braille-display-time nil #'mmanager-next manager)))) -(defun speechd-braille--stop (manager) +(defun speechd-braille--stop (_manager) (when speechd-braille--display-timer - (cancel-timer speechd-braille--display-timer)) + (cancel-timer speechd-braille--display-timer)) (setq speechd-braille--display-timer nil)) -(defun speechd-braille--pause (manager) +(defun speechd-braille--pause (_manager) (push speechd-braille--last-message speechd-braille--paused-messages)) (defun speechd-braille--resume (manager) @@ -87,7 +87,7 @@ (when message (speechd-braille--display manager message)))) -(defun speechd-braille--busy (manager) +(defun speechd-braille--busy (_manager) (and speechd-braille--display-timer (< (- (speechd-braille--time) speechd-braille--last-message-time) speechd-braille-display-time))) @@ -103,13 +103,13 @@ (defun speechd-braille--maybe-enqueue (driver text message) (with-slots (manager priority) driver - (if speechd.update + (if speechd-update (mmanager-enqueue manager speechd-client-name (speechd-braille--make-message driver - (speechd-out-update-text speechd.update) - (speechd-out-update-cursor speechd.update)) - priority (speechd-out-update-group speechd.update)) + (speechd-out-update-text speechd-update) + (speechd-out-update-cursor speechd-update)) + priority (speechd-out-update-group speechd-update)) (unless (string= text "") (mmanager-enqueue manager speechd-client-name message priority))))) @@ -121,30 +121,30 @@ (priority))) (cl-defmethod initialize-instance :after - ((this speechd-braille-emu-driver) slots) + ((this speechd-braille-emu-driver) _slots) (progn (oset this priority speechd-default-text-priority) (oset this manager (speechd-braille--create-manager #'speechd-braille--display)))) (cl-defmethod speechd-braille--make-message - ((driver speechd-braille-emu-driver) text cursor) + ((_driver speechd-braille-emu-driver) text cursor) (list text cursor)) -(cl-defmethod speechd.cancel ((driver speechd-braille-emu-driver) all) +(cl-defmethod speechd.cancel ((driver speechd-braille-emu-driver) _all) (mmanager-cancel (slot-value driver 'manager) speechd-client-name)) -(cl-defmethod speechd.stop ((driver speechd-braille-emu-driver) all) +(cl-defmethod speechd.stop ((driver speechd-braille-emu-driver) _all) (mmanager-next (slot-value driver 'manager))) -(cl-defmethod speechd.pause ((driver speechd-braille-emu-driver) all) +(cl-defmethod speechd.pause ((_driver speechd-braille-emu-driver) _all) ;; do nothing ) -(cl-defmethod speechd.resume ((driver speechd-braille-emu-driver) all) +(cl-defmethod speechd.resume ((_driver speechd-braille-emu-driver) _all) ;; do nothing ) -(cl-defmethod speechd.repeat ((driver speechd-braille-emu-driver)) +(cl-defmethod speechd.repeat ((_driver speechd-braille-emu-driver)) ;; do nothing ) @@ -152,9 +152,9 @@ (mmanager-start-block (slot-value driver 'manager) speechd-client-name (slot-value driver 'priority)) (unwind-protect (funcall function) - (mmanager-finish-block (slot-value driver 'manager) speechd-client-name))) + (mmanager-finish-block (slot-value driver 'manager) speechd-client-name))) -(cl-defmethod speechd.text ((driver speechd-braille-emu-driver) text cursor) +(cl-defmethod speechd.text ((driver speechd-braille-emu-driver) text cursor _markers) (speechd-braille--maybe-enqueue driver text (speechd-braille--make-message driver text cursor))) @@ -177,7 +177,7 @@ (when (eq parameter 'priority) (setf (slot-value driver 'priority) value))) -(cl-defmethod speechd.shutdown ((driver speechd-braille-emu-driver)) +(cl-defmethod speechd.shutdown ((_driver speechd-braille-emu-driver)) ;; do nothing ) diff -Nru speechd-el-2.9/speechd-brltty.el speechd-el-2.11/speechd-brltty.el --- speechd-el-2.9/speechd-brltty.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-brltty.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,6 +1,7 @@ -;;; speechd-brltty.el --- BRLTTY output driver +;;; speechd-brltty.el --- BRLTTY output driver -*- lexical-binding: t -*- -;; Copyright (C) 2004, 2005, 2006, 2008 Brailcom, o.p.s. +;; Copyright (C) 2021 Milan Zamazal +;; Copyright (C) 2004-2008 Brailcom, o.p.s. ;; Author: Milan Zamazal @@ -24,8 +25,7 @@ ;;; Code: -(eval-when-compile - (require 'cl)) +(require 'cl-lib) (require 'brltty) (require 'mmanager) @@ -93,8 +93,8 @@ (let ((first-time (eq connection 'uninitialized))) (if dont-open (setq connection nil) - (lexical-let ((driver driver)) - (setq connection (condition-case err + (let ((driver driver)) + (setq connection (condition-case err (brltty-open nil nil (lambda (key) @@ -109,7 +109,7 @@ connection)) (defun speechd-brltty--display (manager message &optional scroll) - (multiple-value-bind (connection text cursor) message + (cl-multiple-value-bind (connection text cursor) message (let ((display-width (car (brltty-display-size connection)))) (when display-width (when (and cursor (>= cursor display-width) (not scroll)) @@ -153,8 +153,10 @@ (mmanager-put manager 'scrolling (if bolp 0 - (max (- scrolling (or (car (brltty-display-size connection)) 0)) - 0))) + (let ((display-size (car (brltty-display-size + (speechd-brltty--connection driver))))) + (max (- scrolling (or display-size 0)) + 0)))) (speechd-brltty--display manager (mmanager-history manager 'current) t)))) (defun speechd-brltty-scroll-to-bol (driver) @@ -168,7 +170,7 @@ (message (mmanager-history manager 'current))) (when scrolling (speechd-braille--stop manager) - (destructuring-bind (connection text cursor) message + (cl-destructuring-bind (connection text _cursor) message (let ((display-width (or (car (brltty-display-size connection)) 0))) (when display-width (setq scrolling (if eolp @@ -212,7 +214,7 @@ "Discard all messages from the display queue." (speechd.cancel driver 'all)) -(defun speechd-brltty-command-key (driver key) +(defun speechd-brltty-command-key (_driver key) "Put given key to the command queue." (setq unread-command-events (append unread-command-events (list key)))) @@ -242,7 +244,7 @@ (brltty-last-try-time :initform 0))) (cl-defmethod initialize-instance :after - ((this speechd-brltty-driver) slots) + ((this speechd-brltty-driver) _slots) (oset this manager (speechd-brltty--create-manager))) (cl-defmethod speechd-braille--make-message diff -Nru speechd-el-2.9/speechd-bug.el speechd-el-2.11/speechd-bug.el --- speechd-el-2.9/speechd-bug.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-bug.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,7 +1,7 @@ -;;; speechd-bug.el --- reporting speechd-el and speechd bugs +;;; speechd-bug.el --- reporting speechd-el and speechd bugs -*- lexical-binding: t -*- +;; Copyright (C) 2012, 2021 Milan Zamazal ;; Copyright (C) 2003, 2004, 2005 Brailcom, o.p.s. -;; Copyright (C) 2012 Milan Zamazal ;; Author: Milan Zamazal @@ -23,9 +23,10 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(require 'cl-lib) +(require 'reporter) (require 'speechd-speak) - + (defvar speechd-bug--log-extractor "speechd-log-extractor") @@ -35,7 +36,7 @@ '(("festival-czech") ("festival-freebsoft-utils") ("sbts") ("speech-dispatcher") ("speechd-el") ("unknown"))) - + (defvar speechd-bug--repro-id nil) (defvar speechd-bug--marker nil) @@ -72,7 +73,7 @@ (setq directories (cdr directories))))) found)) - + ;;; General information insertion @@ -81,19 +82,19 @@ (speechd-bug--insert (format "Version of `%s':" program)) (shell-command (format "%s --version | head -1" program) t)) -(defun speechd-bug--insert-config-file (file directories comment-start) +(defun speechd-bug--insert-config-file (file directories comment-prefix) (speechd-bug--ensure-empty-line) (speechd-bug--insert "===" file ":begin===") (let ((file-name (or (speechd-bug--look-for-file file directories) - (condition-case c + (condition-case _c (read-file-name (format "Configuration file `%s' not found, please type its location manually: " file)) (quit))))) (if file-name (let ((point (point))) (insert-file-contents file-name) - (flush-lines (format "^[ \t]*\\(%s.*\\)?$" comment-start) + (flush-lines (format "^[ \t]*\\(%s.*\\)?$" comment-prefix) point (point-max-marker))) (speechd-bug--insert "---not-found---"))) (speechd-bug--insert "===" file ":end===")) @@ -176,7 +177,7 @@ (unwind-protect (progn (set-process-filter process - #'(lambda (p str) + #'(lambda (_p str) (setq output (concat output str)))) (process-send-string process "server_log_file\n") (while output @@ -199,8 +200,8 @@ (defun speechd-bug--generate-repro-id () (let ((time (current-time))) - (format "speechd-el-%d-%d-%d" (first time) (second time) (third time)))) - + (format "speechd-el-%d-%d-%d" (cl-first time) (cl-second time) (cl-third time)))) + (defun speechd-bug-reproduce () "Start reproducing a speechd-el or Speech Dispatcher bug. All user and speechd actions are watched from this moment. @@ -245,7 +246,6 @@ (defun speechd-bug () "Send a bug report on speechd-el or Speech Dispatcher." (interactive) - (require 'reporter) (let ((package (completing-read "Package: " speechd-bug-packages)) (reporter-prompt-for-summary-p t)) (reporter-submit-bug-report diff -Nru speechd-el-2.9/speechd-common.el speechd-el-2.11/speechd-common.el --- speechd-el-2.9/speechd-common.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-common.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,4 +1,4 @@ -;;; speechd-common.el --- Code common to all parts of speechd-el +;;; speechd-common.el --- Code common to all parts of speechd-el -*- lexical-binding: t -*- ;; Copyright (C) 2004, 2005, 2008 Brailcom, o.p.s. diff -Nru speechd-el-2.9/speechd-compile.el speechd-el-2.11/speechd-compile.el --- speechd-el-2.9/speechd-compile.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-compile.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,6 +1,6 @@ -;;; speechd-compile.el --- Maintenance utilities +;;; speechd-compile.el --- Maintenance utilities -*- lexical-binding: t -*- -;; Copyright (C) 2004, 2013 Milan Zamazal +;; Copyright (C) 2004, 2013, 2021 Milan Zamazal ;; Author: Milan Zamazal @@ -22,7 +22,7 @@ ;;; Code: -(require 'cl) +(require 'cl-lib) (defun speechd-compile () (let ((load-path (cons default-directory load-path))) diff -Nru speechd-el-2.9/speechd.el speechd-el-2.11/speechd.el --- speechd-el-2.9/speechd.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,7 +1,7 @@ -;;; speechd.el --- Library for accessing Speech Dispatcher +;;; speechd.el --- Library for accessing Speech Dispatcher -*- lexical-binding: t -*- -;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010 Brailcom, o.p.s. -;; Copyright (C) 2012, 2013 Milan Zamazal +;; Copyright (C) 2012-2021 Milan Zamazal +;; Copyright (C) 2003-2010 Brailcom, o.p.s. ;; Author: Milan Zamazal @@ -24,7 +24,7 @@ ;; This library allows you to communicate with Speech Dispatcher. ;; Usually, the communication goes like this: -;; +;; ;; (speechd-open) ;; ... ;; (speechd-say-text "Hello, world!") @@ -39,7 +39,8 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(require 'cl-lib) +(require 'xml) (require 'speechd-common) @@ -78,14 +79,6 @@ :type 'integer :group 'speechd) -(defcustom speechd-spdsend nil - "If string, it names the spdsend binary to be used to talk to SSIP. -If the new version of accept-process-output is available or the value of this -variable is nil, Emacs talks to an SSIP server (Speech Dispatcher) directly." - :type '(choice (const :tag "Don't use spdsend" nil) - (string :tag "spdsend binary")) - :group 'speechd) - (defcustom speechd-autospawn t "If non-nil, Emacs will attempt to automatically start Speech Dispatcher. This means that if speechd-el gets a speech request and the @@ -118,7 +111,7 @@ (defmacro speechd--generate-customization-options (var) (let ((value (symbol-value var))) - `(quote (choice :value ,(cdr (first value)) + `(quote (choice :value ,(cdr (cl-first value)) ,@(mapcar #'(lambda (o) `(const :tag ,(car o) ,(cdr o))) value))))) @@ -131,6 +124,13 @@ ("spell" . spell) ("icon" . icon))) +(defun speechd--set-variable-and-reopen (name value) + (let ((orig-value (when (default-boundp name) (default-value name)))) + (set-default name value) + (when (and (not (equal orig-value value)) + (fboundp 'speechd-reopen)) + (speechd-reopen)))) + (defcustom speechd-voices '() "Alist of voice identifiers and their parameters. @@ -199,10 +199,7 @@ (speechd-priority-tag :value text)) (cons :tag "Output module" (const :format "" output-module) string)))) - :set #'(lambda (name value) - (set-default name value) - (when (fboundp 'speechd-reopen) - (speechd-reopen))) + :set #'speechd--set-variable-and-reopen :group 'speechd) (defcustom speechd-connection-voices '() @@ -217,10 +214,7 @@ You must reopen the connections to apply the changes to this variable." :type '(alist :key-type (string :tag "Connection name") :value-type (speechd-voice-tag :tag "Voice")) - :set #'(lambda (name value) - (set-default name value) - (when (fboundp 'speechd-reopen) - (speechd-reopen))) + :set #'speechd--set-variable-and-reopen :group 'speechd) (defcustom speechd-cancelable-connections '() @@ -272,7 +266,9 @@ voice male1 rate 0 pitch 0 - volume 100)) + volume 100 + index-marks t + ssml-mode nil)) (defconst speechd--coding-system (if (featurep 'xemacs) 'no-conversion-dos ;; No utf yet @@ -291,6 +287,8 @@ (pitch . "PITCH") (volume . "VOLUME") (spelling-mode . "SPELLING") + (index-marks . "NOTIFICATION INDEX_MARKS") + (ssml-mode . "SSML_MODE") (output-module . "OUTPUT_MODULE") ; TODO: to be removed sometimes )) @@ -298,7 +296,7 @@ '((voices "VOICES" identity) (synthesis-voices - "SYNTHESIS_VOICES" (lambda (line) (first (split-string line)))))) + "SYNTHESIS_VOICES" (lambda (line) (cl-first (split-string line)))))) (defconst speechd--parameter-value-mappings '((message-priority @@ -318,6 +316,12 @@ (icon . "icon")) (spelling-mode (t . "on") + (nil . "off")) + (index-marks + (t . "on") + (nil . "off")) + (ssml-mode + (t . "on") (nil . "off")))) (defconst speechd--volatile-parameters '(output-module)) @@ -326,7 +330,7 @@ ;;; Internal variables -(defstruct speechd--connection +(cl-defstruct speechd--connection name host port @@ -340,7 +344,7 @@ (forced-priority nil) (last-command nil)) -(defstruct speechd--request +(cl-defstruct speechd--request string) (defvar speechd--connections (make-hash-table :test 'equal) @@ -348,15 +352,25 @@ (defvar speechd--retry-time 1.0) +(defvar speechd-client-name) + +(defvar speechd--current-connection) + ;;; Utilities (defmacro speechd--iterate-connections (&rest body) - `(maphash #'(lambda (_ connection) ,@body) speechd--connections)) + `(maphash #'(lambda (_ connection) + (let ((speechd--current-connection connection)) + ,@body)) + speechd--connections)) (defmacro speechd--iterate-clients (&rest body) - `(maphash #'(lambda (speechd-client-name _) ,@body) speechd--connections)) + `(maphash #'(lambda (name _) + (let ((speechd-client-name name)) + ,@body)) + speechd--connections)) (defun speechd-connection-names () "Return the list of all present connection names." @@ -366,13 +380,13 @@ names)) (defmacro speechd--with-current-connection (&rest body) - `(let ((connection (speechd--connection))) - (when (and (speechd--connection-failure-p connection) - (>= (- (float-time) (speechd--connection-last-try-time connection)) + `(let ((speechd--current-connection (speechd--connection))) + (when (and (speechd--connection-failure-p speechd--current-connection) + (>= (- (float-time) (speechd--connection-last-try-time speechd--current-connection)) speechd--retry-time)) (ignore-errors (speechd-reopen t)) - (setq connection (speechd--connection))) - (unless (speechd--connection-failure-p connection) + (setq speechd--current-connection (speechd--connection))) + (unless (speechd--connection-failure-p speechd--current-connection) ,@body))) (defmacro speechd--with-connection-setting (var value &rest body) @@ -396,10 +410,10 @@ `(let* ((,$parameters ,parameters) (,$orig-parameters ())) (unwind-protect - (let ((,$cparameters (speechd--connection-parameters connection))) + (let ((,$cparameters (speechd--connection-parameters speechd--current-connection))) (while ,$parameters - (let* ((,$p (first ,$parameters)) - (,$v (second ,$parameters)) + (let* ((,$p (cl-first ,$parameters)) + (,$v (cl-second ,$parameters)) (,$orig-v (plist-get ,$cparameters ,$p))) (when (and (not (equal ,$v ,$orig-v)) (or ,$v @@ -443,81 +457,84 @@ ;;; Process management functions -(defun* speechd--connection (&optional (name speechd-client-name) - (create-if-needed t)) +(cl-defun speechd--connection (&optional (name speechd-client-name) (create-if-needed t)) (or (gethash name speechd--connections) (and create-if-needed (let ((speechd-client-name name)) (speechd-open))))) -(defvar speechd--advanced-apo (condition-case _ - (progn - (accept-process-output nil 0 0 1) - t) - (error))) - -(defun speechd--call-spdsend (args &optional input) - (with-temp-buffer - (if input - (with-speechd-coding-protection - (insert input) - (let ((default-process-coding-system - (cons speechd--coding-system speechd--coding-system)) - (process-coding-system-alist nil)) - (apply #'call-process-region (point-min) (point-max) - speechd-spdsend t t nil args))) - (apply #'call-process speechd-spdsend nil t nil args)) - (buffer-string))) +(defun speechd--jump-to-marker (index-mark) + (let ((marker (cdr (assoc index-mark speechd--markers)))) + (when marker + (let ((buffer (marker-buffer marker)) + (position (marker-position marker))) + (when buffer + (select-window (or (get-buffer-window buffer) (selected-window))) + (unless (eq (window-buffer) buffer) + (switch-to-buffer buffer)) + (goto-char position)))))) + +(defun speechd--process-notifications (output) + ;; 700-msg_id + ;; 700-client_id + ;; 700-index_mark + ;; 700 END + (let ((notifications '()) + (pos 0)) + (while (string-match speechd--notification-regexp output pos) + (push (list (match-string 1 output) (match-string 2 output) (match-string 3 output)) + notifications) + (setq pos (match-end 0))) + ;; There can be additional index marks inserted by Speech Dispatcher, + ;; let's skip them and find the first meaningful index mark. + (while notifications + (cl-destructuring-bind (code separator _message) (car notifications) + (setq notifications (cdr notifications)) + (when (and (equal code speechd--index-mark-code) + (equal separator " ")) + (when notifications + (cl-destructuring-bind (code separator message) (car notifications) + (when (and (equal code speechd--index-mark-code) + (equal separator "-")) + (speechd--jump-to-marker message) + (setq notifications nil)))))))) + output) -(defun speechd--process-filter (process output) - (when speechd--advanced-apo - (speechd--with-current-connection - (setf (speechd--connection-process-output connection) - (concat (speechd--connection-process-output connection) output))))) - -(defun speechd--use-spdsend () - (and (not speechd--advanced-apo) speechd-spdsend)) +(defun speechd--process-filter (_process output) + (speechd--with-current-connection + (setf (speechd--connection-process-output speechd--current-connection) + (speechd--process-notifications + (concat (speechd--connection-process-output speechd--current-connection) output))))) (defun speechd--open-connection (method host port socket-name) - (if (speechd--use-spdsend) - (let* ((answer (speechd--call-spdsend - (list "--open" host (format "%d" port)))) - (alen (and answer (length answer)))) - (when (and alen (> alen 1)) - (setq answer (substring answer 0 (1- alen)))) - answer) - (let ((process - (cond - ((eq method 'unix-socket) - (make-network-process - :name "speechd" :family "local" - :remote (or socket-name - (or (getenv "SPEECHD_SOCK") - (expand-file-name - (let ((runtime-dir (getenv "XDG_RUNTIME_DIR"))) - (concat (if runtime-dir (concat runtime-dir "/") "~/.") - "speech-dispatcher/speechd.sock"))))))) - ((eq method 'inet-socket) - (open-network-stream "speechd" nil host port)) - (t (error "Invalid communication method: `%s'" method))))) - (when process - (set-process-coding-system process - speechd--coding-system - (if speechd--advanced-apo - speechd--coding-system - 'raw-text)) - (if (fboundp 'set-process-query-on-exit-flag) - (set-process-query-on-exit-flag process nil) - (set-process-query-on-exit-flag process nil)) - (set-process-filter process #'speechd--process-filter)) - process))) + (let ((process + (cond + ((eq method 'unix-socket) + (make-network-process + :name "speechd" :family "local" + :remote (or socket-name + (or (getenv "SPEECHD_SOCK") + (expand-file-name + (let ((runtime-dir (getenv "XDG_RUNTIME_DIR"))) + (concat (if runtime-dir (concat runtime-dir "/") "~/.") + "speech-dispatcher/speechd.sock"))))))) + ((eq method 'inet-socket) + (open-network-stream "speechd" nil host port)) + (t (error "Invalid communication method: `%s'" method))))) + (when process + (set-process-coding-system process + speechd--coding-system + speechd--coding-system) + (if (fboundp 'set-process-query-on-exit-flag) + (set-process-query-on-exit-flag process nil) + (set-process-query-on-exit-flag process nil)) + (set-process-filter process #'speechd--process-filter)) + process)) (defun speechd--close-connection (connection) (let ((process (speechd--connection-process connection))) (when process - (if (speechd--use-spdsend) - (speechd--call-spdsend (list "--close" process)) - (delete-process (speechd--connection-process connection))) + (delete-process (speechd--connection-process connection)) (setf (speechd--connection-process connection) nil)))) (defun speechd--send-connection (connection command) @@ -525,22 +542,22 @@ (when process (with-speechd-coding-protection (condition-case _ - (if (speechd--use-spdsend) - (speechd--call-spdsend (list "--send" process) command) - (process-send-string - process - (if speechd--advanced-apo - command - (encode-coding-string command speechd--coding-system))) - (when speechd--advanced-apo - (while (not (string-match - speechd--end-regexp - (speechd--connection-process-output connection))) + (progn + (process-send-string process command) + (let ((output (speechd--connection-process-output connection))) + (while (not (string-match speechd--end-regexp output)) (unless (accept-process-output process speechd-timeout nil 1) (signal 'ssip-connection-error - "Timeout in communication with Speech Dispatcher")))) - (prog1 (speechd--connection-process-output connection) - (setf (speechd--connection-process-output connection) ""))) + "Timeout in communication with Speech Dispatcher")) + (setq output (speechd--connection-process-output connection))) + (let ((pos (match-end 0))) + ;; If there are more responses, try to get in sync: + (while (string-match speechd--end-regexp output pos) + (setq output (substring output pos)) + (setq pos (- (match-end 0) pos))) + (setf (speechd--connection-process-output connection) + (substring output pos)) + (substring output 0 pos)))) (error (speechd--permanent-connection-failure connection) (signal 'ssip-connection-error @@ -552,7 +569,7 @@ "Error on opening Speech Dispatcher connection") ;;;###autoload -(defun* speechd-open (&optional method &key host port socket-name quiet force-reopen) +(cl-defun speechd-open (&optional method &key host port socket-name quiet force-reopen) "Open connection to Speech Dispatcher using the given method. If the connection corresponding to the current `speechd-client-name' value already exists, close it and reopen again, with the same connection parameters. @@ -605,33 +622,29 @@ (t default-parameters))) (connection-error nil) - (id (cond - ((or (not connection) - (not (speechd--connection-failure-p connection)) - force-reopen) - (condition-case err (speechd--open-connection - (or method 'unix-socket) - host port socket-name) - (file-error - (setq connection-error err) - nil))) - ((and connection - (not (speechd--connection-failure-p connection))) - (speechd--connection-id connection))))) - (when (or id (not quiet)) + (process (when (or (not connection) + (not (speechd--connection-failure-p connection)) + force-reopen) + (condition-case err (speechd--open-connection + (or method 'unix-socket) + host port socket-name) + (file-error + (setq connection-error err) + nil))))) + (when (or process (not quiet)) (setq connection (make-speechd--connection - :name name :host host :port port :process id)) + :name name :host host :port port :process process)) (puthash name connection speechd--connections)) - (when (and (not id) (not quiet)) + (when (and (not process) (not quiet)) (speechd--permanent-connection-failure connection) (signal 'ssip-connection-error connection-error)) - (when id + (when process (speechd--set-connection-name name) (setq parameters (append parameters (list 'language speechd--default-language))) (let ((already-set '(client-name))) (while parameters - (destructuring-bind (parameter value . next) parameters + (cl-destructuring-bind (parameter value . next) parameters (unless (memq parameter already-set) (push parameter already-set) (speechd--set-parameter parameter value)) @@ -644,7 +657,7 @@ (setf (speechd--connection-forced-priority connection) t))))) connection)) -(defun* speechd-close (&optional (name speechd-client-name)) +(cl-defun speechd-close (&optional (name speechd-client-name)) "Close speechd connection named NAME." (interactive) (let ((connection (speechd--connection name nil))) @@ -665,8 +678,8 @@ (maphash #'(lambda (name _) (let ((speechd-client-name name)) (if (speechd-open nil :quiet t :force-reopen t) - (incf number-of-connections) - (incf number-of-failures)))) + (cl-incf number-of-connections) + (cl-incf number-of-failures)))) speechd--connections) (unless quiet (message (format "%d connections successfully reopened, %d failures" @@ -677,11 +690,14 @@ (defconst speechd--eol "\n") -(defconst speechd--end-regexp (format "^[0-9][0-9][0-9] .*%s" speechd--eol)) +(defconst speechd--end-regexp (format "^[0-6][0-9][0-9] .*%s" speechd--eol)) (defconst speechd--result-regexp (format "\\`[0-9][0-9][0-9]-\\(.*\\)%s" speechd--eol)) (defconst speechd--success-regexp (format "^[1-2][0-9][0-9] .*%s" speechd--eol)) +(defconst speechd--notification-regexp + (format "^\\(7[0-9][0-9]\\)\\([- ]\\)\\(.*\\)%s" speechd--eol)) +(defconst speechd--index-mark-code "700") (defun speechd--permanent-connection-failure (connection) (speechd--close-connection connection) @@ -694,26 +710,21 @@ (speechd--with-current-connection (save-match-data (let ((answer (speechd--send-connection - connection (speechd--request-string request)))) + speechd--current-connection (speechd--request-string request)))) (let ((data '()) success) (while (and answer (string-match speechd--result-regexp answer)) (push (match-string 1 answer) data) (setq answer (substring answer (match-end 0)))) - (if (or speechd--advanced-apo (speechd--use-spdsend)) - (progn - (setq success (and answer - (string-match speechd--success-regexp - answer))) - (unless success - (setq data nil)) - (list success - data - (and success (substring answer 0 3)) - (and success (substring answer 4)))) - '(t nil nil nil))))))) - + (setq success (and answer + (string-match speechd--success-regexp answer))) + (unless success + (setq data nil)) + (list success + data + (and success (substring answer 0 3)) + (and success (substring answer 4)))))))) (defconst speechd--block-commands '(("speak") @@ -723,30 +734,31 @@ ("key") ("quit") ("block" ("end")) - ("set" ("self" ("rate") ("pitch") ("volume") ("voice") ("language"))))) + ("set" ("self" ("rate") ("pitch") ("volume") ("voice") ("language") + ("punctuation") ("cap_let_recogn") ("ssml_mode"))))) (defun speechd--block-command-p (command &optional allowed) (unless allowed (setq allowed speechd--block-commands)) - (let* ((match (assoc (downcase (first command)) allowed)) + (let* ((match (assoc (downcase (cl-first command)) allowed)) (rest-allowed (cdr match))) (and match (or (not rest-allowed) - (speechd--block-command-p (rest command) rest-allowed))))) + (speechd--block-command-p (cl-rest command) rest-allowed))))) -(defun* speechd--send-command (command) +(cl-defun speechd--send-command (command) (unless (listp command) (setq command (list command))) (speechd--with-current-connection - (when (or (not (speechd--connection-in-block connection)) + (when (or (not (speechd--connection-in-block speechd--current-connection)) (speechd--block-command-p command)) - (setf (speechd--connection-last-command connection) command) + (setf (speechd--connection-last-command speechd--current-connection) command) (speechd--send-request (make-speechd--request :string (concat (mapconcat #'identity command " ") speechd--eol)))))) (defun speechd--send-text (text) - (when (first (or (speechd--send-command "SPEAK") '(t))) + (when (cl-first (or (speechd--send-command "SPEAK") '(t))) ;; We must be careful here. There is no answer from SSIP until all data ;; including the terminator is sent. Thus, if we send the data in pieces, ;; there may be noticeable delays when waiting for TCP packet @@ -756,9 +768,8 @@ (let ((i 0)) (while (string-match "[\200-\377]" text i) (let ((char (string-to-char (match-string 0 text)))) - (if (memq (char-charset char) - '(eight-bit-control eight-bit-graphic)) - (setq text (replace-match (format "\\%o" char) t t text)) + (if (char-charset char '(eight-bit)) + (setq text (replace-match (format "\\%o" (encode-char char 'eight-bit)) t t text)) (setq i (match-end 0)))))) (let ((i 0)) (while (and (> (length text) 0) @@ -770,10 +781,10 @@ ;; We must remove text properties from the string, otherwise Emacs does ;; strange things when recoding non-ASCII characters to UTF-8. (set-text-properties 0 (length text) nil text) - (unless (first (or (speechd--send-request - (make-speechd--request - :string (concat text speechd--eol "." speechd--eol))) - '(t))) + (unless (cl-first (or (speechd--send-request + (make-speechd--request + :string (concat text speechd--eol "." speechd--eol))) + '(t))) ;; We must reset the connection on failure, to bring it back to the ;; command state from the text reading state. (speechd-close)))) @@ -783,9 +794,9 @@ (defun speechd--list (parameter) - (multiple-value-bind (command processor) + (cl-multiple-value-bind (command processor) (cdr (assoc parameter speechd--list-parameters)) - (mapcar processor (second (speechd--send-command (list "LIST" command)))))) + (mapcar processor (cl-second (speechd--send-command (list "LIST" command)))))) ;;; Parameter setting functions @@ -814,7 +825,7 @@ (speechd--send-command (list "SET" (if globally "all" "self") p v)))) (defun speechd--set-connection-parameter (parameter value) - (let* ((plist (speechd--connection-parameters connection)) + (let* ((plist (speechd--connection-parameters speechd--current-connection)) (orig-value (if (plist-member plist parameter) (plist-get plist parameter) 'unknown))) @@ -822,17 +833,17 @@ (and (not (equal orig-value value)) (or (not (eq parameter 'message-priority)) - (not (speechd--connection-forced-priority connection))))) + (not (speechd--connection-forced-priority speechd--current-connection))))) (let ((answer (speechd--call-set-parameter parameter value nil))) - (setq connection (speechd--connection)) - (when (first answer) - (setf (speechd--connection-parameters connection) - (plist-put (speechd--connection-parameters connection) + (setq speechd--current-connection (speechd--connection)) + (when (cl-first answer) + (setf (speechd--connection-parameters speechd--current-connection) + (plist-put (speechd--connection-parameters speechd--current-connection) parameter value)))) ;; Speech Dispatcher bug work-around (when (eq parameter 'language) (let ((output-module (plist-get - (speechd--connection-parameters connection) + (speechd--connection-parameters speechd--current-connection) 'output-module))) (when output-module (speechd--set-connection-parameter 'output-module @@ -862,6 +873,11 @@ (interactive (list (read-string "Language: "))) (speechd--set-parameter 'language language)) +(defun speechd-set-ssml-mode (value) + "Set SSML mode value. +SSML is reset to \"off\" when connection is reopened." + (speechd--set-parameter 'ssml-mode value)) + (defmacro speechd--generate-set-command (parameter prompt argdesc) (let* ((prompt* (concat prompt ": ")) (argdesc* (eval argdesc)) @@ -930,17 +946,17 @@ (cons voice (let ((voice-parameters ()) (connection-parameters - (speechd--connection-parameters connection))) + (speechd--connection-parameters speechd--current-connection))) (while connection-parameters - (destructuring-bind (p v . next) connection-parameters + (cl-destructuring-bind (p v . next) connection-parameters (unless (memq p '(client-name message-priority spelling-mode)) (push (cons - (case p + (cl-case p (voice 'name) (t p)) - (case p + (cl-case p (punctuation-mode (cdr (assoc v speechd--punctuation-modes))) @@ -969,19 +985,20 @@ "Call FUNCTION inside an SSIP block. FUNCTION is called without any arguments." (speechd--with-current-connection - (let ((%block-connection connection) - (nested (and connection (speechd--connection-in-block connection)))) + (let ((%block-connection speechd--current-connection) + (nested (and speechd--current-connection + (speechd--connection-in-block speechd--current-connection)))) (speechd--with-connection-parameters parameters - (let ((speechd-client-name (speechd--connection-name connection))) + (let ((speechd-client-name (speechd--connection-name speechd--current-connection))) (unless nested (speechd--send-command '("BLOCK BEGIN")) - (when connection - (setf (speechd--connection-in-block connection) t))) + (when speechd--current-connection + (setf (speechd--connection-in-block speechd--current-connection) t))) (unwind-protect (funcall function) (unless nested - (let ((connection %block-connection)) - (when connection - (setf (speechd--connection-in-block connection) nil) + (let ((speechd--current-connection %block-connection)) + (when speechd--current-connection + (setf (speechd--connection-in-block speechd--current-connection) nil) (speechd--send-command '("BLOCK END"))))))))))) (defmacro speechd-block* (parameters &rest body) @@ -997,9 +1014,28 @@ ;;; Speaking functions +(defconst speechd--index-mark-prefix "index-") +(defvar speechd--markers '()) ; assoc list of (INDEX . MARKER) + +(defun speechd--ssml (text beg markers) + (let ((end (1- (+ beg (length text))))) + (dolist (m markers) + (cl-destructuring-bind (pos index _marker) m + (when (<= beg pos end) + (let ((text-pos (- pos beg))) + (put-text-property text-pos (1+ text-pos) 'index index text)))))) + (setq text (xml-escape-string text)) + (let ((pos 0)) + (while (setq pos (next-single-property-change pos 'index text)) + (let ((mark (format "" + speechd--index-mark-prefix + (get-text-property pos 'index text)))) + (setq text (concat (substring text 0 pos) mark (substring text pos))) + (setq pos (+ pos (length mark) 1))))) + (concat "" text "")) + ;;;###autoload -(defun* speechd-say-text (text &key (priority speechd-default-text-priority) - say-if-empty) +(cl-defun speechd-say-text (text &key (priority speechd-default-text-priority) say-if-empty markers) "Speak the given TEXT, represented by a string. The key argument `priority' defines the priority of the message and must be one of the symbols `important', `message', `text', `notification' or @@ -1031,14 +1067,23 @@ (properties change-point))))) change-point)) (substring (substring text beg end))) + (when markers + (setq speechd--markers + (mapcar #'(lambda (m) + (cons (format "%s%s" speechd--index-mark-prefix + (cl-second m)) + (cl-third m))) + markers)) + (setq substring (speechd--ssml substring beg markers))) (speechd-block* `(message-priority ,priority language ,(speechd--current-language) spelling-mode ,speechd-spell + ssml-mode ,(not (null markers)) ,@properties) (speechd--send-text substring)) (setq beg end))))))) -(defun* speechd-say-sound (name &key (priority speechd-default-sound-priority)) +(cl-defun speechd-say-sound (name &key (priority speechd-default-sound-priority)) "Ask speechd to play an auditory icon. NAME is the name of the icon, any string acceptable by speechd. The key argument `priority' defines the priority of the message and must be one @@ -1047,7 +1092,7 @@ (speechd--set-parameter 'message-priority priority) (speechd--send-command (list "SOUND_ICON" name))) -(defun* speechd-say-char (char &key (priority speechd-default-char-priority)) +(cl-defun speechd-say-char (char &key (priority speechd-default-char-priority)) "Speak the given CHAR, any UTF-8 character. The key argument `priority' defines the priority of the message and must be one of the symbols `important', `message', `text', `notification' or @@ -1057,12 +1102,12 @@ (speechd--with-connection-parameters `(language ,(speechd--current-language)) (speechd--send-command - (list "CHAR" (format "%s" (case char + (list "CHAR" (format "%s" (cl-case char (? "space") (?\n "linefeed") (t (char-to-string char))))))))) -(defun* speechd-say-key (key &key (priority speechd-default-key-priority)) +(cl-defun speechd-say-key (key &key (priority speechd-default-key-priority)) "Speak the given KEY, represented by a key event. The key argument `priority' defines the priority of the message and must be one of the symbols `important', `message', `text', `notification' or @@ -1077,7 +1122,7 @@ ((and (>= character 128) (< character 160)) "?") ((= character ? ) "space") ((= character ?_) "underscore") - ((= character ?_) "double-quote") + ((= character ?\") "double-quote") ((= character 127) "backspace") (t (format "%c" character))) (format "%s" character)))) @@ -1097,8 +1142,8 @@ (cond ((not all) (when (or repeatable - (not (equal (first (speechd--connection-last-command - (speechd--connection))) + (not (equal (cl-first (speechd--connection-last-command + (speechd--connection))) command))) (speechd--send-command (list command "self")))) ((eq all 'some) @@ -1108,7 +1153,7 @@ (member speechd-client-name speechd-cancelable-connections)) (speechd--control-command command nil repeatable))))) ((numberp all) - (speechd--iterate-clients + (speechd--iterate-clients (speechd--control-command command nil repeatable))) (t (speechd--send-command (list command "all"))))) @@ -1140,9 +1185,9 @@ (interactive "P") (if all (speechd--iterate-connections - (setf (speechd--connection-paused-p connection) t)) + (setf (speechd--connection-paused-p speechd--current-connection) t)) (speechd--with-current-connection - (setf (speechd--connection-paused-p connection) t))) + (setf (speechd--connection-paused-p speechd--current-connection) t))) (speechd--control-command "PAUSE" (not (not all)))) ;;;###autoload @@ -1152,12 +1197,12 @@ clients." (interactive "P") (speechd--with-current-connection - (when (or all (speechd--connection-paused-p connection)) + (when (or all (speechd--connection-paused-p speechd--current-connection)) (speechd--control-command "RESUME" (not (not all))) (if all - (setf (speechd--connection-paused-p connection) nil) + (setf (speechd--connection-paused-p speechd--current-connection) nil) (speechd--iterate-connections - (setf (speechd--connection-paused-p connection) nil)))))) + (setf (speechd--connection-paused-p speechd--current-connection) nil)))))) ;;;###autoload (defun speechd-repeat () @@ -1165,8 +1210,8 @@ (interactive) (if t (message "Not yet implemented in speechd") - (let ((id (car (second (speechd--send-command - '("HISTORY" "GET" "LAST")))))) + (let ((id (car (cl-second (speechd--send-command + '("HISTORY" "GET" "LAST")))))) (when id (speechd--send-command (list "HISTORY" "SAY" id)))))) diff -Nru speechd-el-2.9/speechd-el.cs.texi speechd-el-2.11/speechd-el.cs.texi --- speechd-el-2.9/speechd-el.cs.texi 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-el.cs.texi 2021-07-03 08:56:35.000000000 +0000 @@ -720,16 +720,6 @@ na příkazu protokolu okamľitě, avąak pokud se připojujete na Speech Dispatcher nějakým zvláątním způsobem po pomalé síti, můľete potřebovat tento limit zvýąit. - -@item speechd-spdsend -@cindex spdsend -Je-li hodnotou proměnné něco jiného neľ @code{nil}, musí to být -řetězec určující jméno binárky @emph{spdsend} (obvykle -@code{"spdsend"}), která má být pouľita pro komunikaci se Speech -Dispatcher. Je-li hodnotou proměnné @code{nil} nebo pokud je verze -Emacsu vyąąí neľ 21.3, spdsend se nepouľívá. - -O@tie{}hodnotu této proměnné se obvykle nemusíte starat. @end vtable @node Implicitní priority, Základní mluvení, Konfigurace serveru, Konfigurace diff -Nru speechd-el-2.9/speechd-el.info speechd-el-2.11/speechd-el.info --- speechd-el-2.9/speechd-el.info 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-el.info 2021-07-03 08:56:35.000000000 +0000 @@ -1,10 +1,10 @@ -This is speechd-el.info, produced by makeinfo version 6.5 from +This is speechd-el.info, produced by makeinfo version 6.7 from speechd-el.texi. -This manual is for speechd-el, 2.9. +This manual is for speechd-el, 2.11. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010 Brailcom, -o.p.s. Copyright (C) 2012, 2013, 2016 Milan Zamazal + Copyright (C) 2012-2021 Milan Zamazal Copyright (C) 2003-2010 +Brailcom, o.p.s. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -35,10 +35,10 @@ speechd-el ********** -This manual is for speechd-el, 2.9. +This manual is for speechd-el, 2.11. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010 Brailcom, -o.p.s. Copyright (C) 2012, 2013, 2016 Milan Zamazal + Copyright (C) 2012-2021 Milan Zamazal Copyright (C) 2003-2010 +Brailcom, o.p.s. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -399,7 +399,8 @@ 'C-e l' Read current line ('speechd-speak-read-line'). With the prefix argument, read the line only from the current cursor position to - the end of line. + the end of line. If 'truncate-lines' is 'nil', read the line only + to its visual end. 'C-e b' Read current buffer ('speechd-speak-read-buffer'). @@ -684,6 +685,7 @@ * Reading State:: Speaking Emacs state changes. * Signalling:: Signalling empty lines, etc. * Text Properties:: Handling faces and special pieces of text. +* Index marking:: Moving cursor when speaking. * Languages:: Using multiple languages. * Voices:: Defining different voices. * Connection Voices:: Setting connection parameters. @@ -762,13 +764,6 @@ if you talk to a Speech Dispatcher in a strange way through a lagging network, you may want to increase the limit. -'speechd-spdsend' - If non-'nil', it is a string naming the _spdsend_ binary (normally - '"spdsend"') to use for communication with Speech Dispatcher. If - 'nil' or if you use Emacs 22 or higher, spdsend is not used. - - Usually you shouldn't care about this variable. - BRLTTY connection options: 'brltty-default-host' @@ -1064,7 +1059,7 @@ plain texts are displayed instead.  -File: speechd-el.info, Node: Text Properties, Next: Languages, Prev: Signalling, Up: Customization +File: speechd-el.info, Node: Text Properties, Next: Index marking, Prev: Signalling, Up: Customization 2.4.8 Text Properties --------------------- @@ -1121,10 +1116,34 @@ enabled.  -File: speechd-el.info, Node: Languages, Next: Voices, Prev: Text Properties, Up: Customization +File: speechd-el.info, Node: Index marking, Next: Languages, Prev: Text Properties, Up: Customization + +2.4.9 Index marking +------------------- -2.4.9 Using multiple languages ------------------------------- +Reading a text with index marking means the cursor is moved over the +text as the text is read, whenever an inserted index mark is reached. +Index marking is switched off by default but you can set it up for +'speechd-speak-read-buffer' and 'speechd-speak-read-rest-of-buffer' +commands using the following variables: + +'speechd-speak-use-index-marks' + If non-'nil', index marking is enabled for + 'speechd-speak-read-buffer' and 'speechd-speak-read-rest-of-buffer' + commands. + +'speechd-speak-index-mark-regexp' + Regular expression defining the places where to put index marks to. + An index mark is put at the end of the regexp at each of the + places. If the regular expression is empty (the default), it's + taken from 'sentence-end' variable. If 'sentence-end' is 'nil', a + default regular expression matching common punctuation is used. + + +File: speechd-el.info, Node: Languages, Next: Voices, Prev: Index marking, Up: Customization + +2.4.10 Using multiple languages +------------------------------- You can use speechd-el with multiple languages. However, the process can't be easily automated, since ordinary text does not contain any @@ -1170,10 +1189,20 @@ corresponding language is selected unless overridden by another setting. + Some texts in Emacs, such as messages, minibuffer prompts or +completions, are typically in English. speechd-el reads them in English +by default, but it can be instructed to use another language for them: + +'speechd-speak-emacs-language' + Language to use for texts originating from Emacs. It's a string + containing an RFC 1766 language code accepted by SSIP, 'en' by + default. It can be also 'nil', meaning the language should be + unchanged and the current language should be used. +  File: speechd-el.info, Node: Voices, Next: Connection Voices, Prev: Languages, Up: Customization -2.4.10 Defining voices +2.4.11 Defining voices ---------------------- You can define special voices in speechd-el that can be used in @@ -1221,7 +1250,7 @@  File: speechd-el.info, Node: Connection Voices, Next: Multiple Connections, Prev: Voices, Up: Customization -2.4.11 Connection Voices +2.4.12 Connection Voices ------------------------ With the help of the following variable you can let set various @@ -1258,7 +1287,7 @@  File: speechd-el.info, Node: Multiple Connections, Next: Keys, Prev: Connection Voices, Up: Customization -2.4.12 Multiple Connections +2.4.13 Multiple Connections --------------------------- You can arrange speechd-el to use separate connections to Speech @@ -1311,7 +1340,7 @@  File: speechd-el.info, Node: Keys, Next: Braille Display Keys, Prev: Multiple Connections, Up: Customization -2.4.13 Keys +2.4.14 Keys ----------- The command keys of speechd-el are defined by the 'speechd-speak-prefix' @@ -1337,7 +1366,7 @@  File: speechd-el.info, Node: Braille Display Keys, Next: Modes, Prev: Keys, Up: Customization -2.4.14 Braille Display Keys +2.4.15 Braille Display Keys --------------------------- When using Braille display output, speechd-el can bind actions to the @@ -1425,7 +1454,7 @@  File: speechd-el.info, Node: Modes, Next: Debugging, Prev: Braille Display Keys, Up: Customization -2.4.15 Minor mode hooks +2.4.16 Minor mode hooks ----------------------- speechd-el provides a minor mode that enables and disables the reading, @@ -1438,7 +1467,7 @@  File: speechd-el.info, Node: Debugging, Prev: Modes, Up: Customization -2.4.16 Debugging speechd-el +2.4.17 Debugging speechd-el --------------------------- When you try to debug speechd-speak functions, you can experience the @@ -2922,19 +2951,19 @@ * BRLTTY: speechd-el User Manual. (line 19) * BRLTTY <1>: Installation. (line 35) -* brltty-authentication-file: Connection Setup. (line 62) -* brltty-coding: Connection Setup. (line 67) -* brltty-default-host: Connection Setup. (line 52) -* brltty-default-port: Connection Setup. (line 56) -* brltty-timeout: Connection Setup. (line 80) -* brltty-tty: Connection Setup. (line 73) +* brltty-authentication-file: Connection Setup. (line 55) +* brltty-coding: Connection Setup. (line 60) +* brltty-default-host: Connection Setup. (line 45) +* brltty-default-port: Connection Setup. (line 49) +* brltty-timeout: Connection Setup. (line 73) +* brltty-tty: Connection Setup. (line 66) * buffer: Informatory Commands. (line 7) * buffer names: Basic Speaking. (line 23) * buffers: Auto-Reading Buffers. (line 6) * bug reporting: Bug Reporting. (line 6) * bugs: Contact Information. (line 6) -* C-e ': Reading Commands. (line 42) -* C-e .: Reading Commands. (line 32) +* C-e ': Reading Commands. (line 43) +* C-e .: Reading Commands. (line 33) * C-e 1: Control Commands. (line 41) * C-e 2: Control Commands. (line 41) * C-e 3: Control Commands. (line 41) @@ -2944,16 +2973,16 @@ * C-e 7: Control Commands. (line 41) * C-e 8: Control Commands. (line 41) * C-e 9: Control Commands. (line 41) -* C-e >: Reading Commands. (line 15) -* C-e b: Reading Commands. (line 12) -* C-e c: Reading Commands. (line 46) +* C-e >: Reading Commands. (line 16) +* C-e b: Reading Commands. (line 13) +* C-e c: Reading Commands. (line 47) * C-e C-a: Connection Voices. (line 30) * C-e C-b k: Braille Display Keys. (line 82) * C-e C-f: Bug Reporting. (line 19) * C-e C-l: Spelling. (line 14) -* C-e C-n: Reading Commands. (line 50) -* C-e C-p: Reading Commands. (line 53) -* C-e C-r: Reading Commands. (line 26) +* C-e C-n: Reading Commands. (line 51) +* C-e C-p: Reading Commands. (line 54) +* C-e C-r: Reading Commands. (line 27) * C-e C-s: Starting Alternative Output. (line 14) * C-e C-x: Other Commands. (line 12) @@ -2975,25 +3004,25 @@ (line 33) * C-e d V: Parameter Setting Commands. (line 56) -* C-e i: Reading Commands. (line 64) +* C-e i: Reading Commands. (line 65) * C-e l: Reading Commands. (line 7) -* C-e m: Reading Commands. (line 56) -* C-e o: Reading Commands. (line 19) +* C-e m: Reading Commands. (line 57) +* C-e o: Reading Commands. (line 20) * C-e p: Control Commands. (line 24) * C-e q: Control Commands. (line 7) -* C-e r: Reading Commands. (line 23) -* C-e RET: Reading Commands. (line 59) +* C-e r: Reading Commands. (line 24) +* C-e RET: Reading Commands. (line 60) * C-e s: Control Commands. (line 11) * C-e SPC: Control Commands. (line 29) -* C-e w: Reading Commands. (line 29) +* C-e w: Reading Commands. (line 30) * C-e x: Control Commands. (line 17) * C-e z: Other Commands. (line 19) -* C-e [: Reading Commands. (line 39) -* C-e {: Reading Commands. (line 35) +* C-e [: Reading Commands. (line 40) +* C-e {: Reading Commands. (line 36) * C-x C-c: Other Commands. (line 6) * capital character mode: Parameter Setting Commands. (line 26) -* character reading prompts: Reading Commands. (line 68) +* character reading prompts: Reading Commands. (line 69) * coding systems: Informatory Commands. (line 24) * command keys: Basic Speaking. (line 39) * command keys <1>: Basic Speaking. (line 61) @@ -3001,6 +3030,7 @@ * connections: Multiple Connections. (line 6) * contact: Contact Information. (line 6) * cursor: Text Properties. (line 6) +* cursor movement: Index marking. (line 6) * day in calendar: Tips. (line 15) * debugging: Debugging. (line 6) * delays: Problems. (line 52) @@ -3026,6 +3056,7 @@ * hooks: Modes. (line 6) * host: Connection Setup. (line 18) * icons: Signalling. (line 6) +* index marking: Index marking. (line 6) * Info: Problems. (line 6) * input method: Informatory Commands. (line 28) * inserted text: Auto-Reading Buffers. (line 6) @@ -3049,7 +3080,7 @@ * minor modes: Starting Alternative Output. (line 28) * minor modes <1>: Modes. (line 6) -* mode line: Reading Commands. (line 59) +* mode line: Reading Commands. (line 60) * modes: Informatory Commands. (line 20) * movement: Text Properties. (line 6) * output module: Parameter Setting Commands. @@ -3070,14 +3101,13 @@ * rate: Control Commands. (line 41) * rate <1>: Parameter Setting Commands. (line 46) -* read-char: Reading Commands. (line 68) +* read-char: Reading Commands. (line 69) * recovery: Other Commands. (line 12) * repeated reading: Problems. (line 38) * repeating: Basic Speaking. (line 69) * resume: Control Commands. (line 29) * RFC 1766: Languages. (line 17) * shutting up: Control Commands. (line 7) -* spdsend: Connection Setup. (line 44) * Speech Dispatcher: Installation. (line 32) * speechd-add-connection-settings: Connection Voices. (line 30) * speechd-autospawn: Connection Setup. (line 30) @@ -3136,11 +3166,10 @@ (line 33) * speechd-set-volume: Parameter Setting Commands. (line 56) -* speechd-spdsend: Connection Setup. (line 43) * speechd-speak: Starting Alternative Output. (line 14) * speechd-speak-align-buffer-insertions: Auto-Reading Buffers. (line 55) -* speechd-speak-allow-prompt-commands: Reading Commands. (line 84) +* speechd-speak-allow-prompt-commands: Reading Commands. (line 85) * speechd-speak-auto-speak-buffers: Auto-Reading Buffers. (line 13) * speechd-speak-buffer-info: Informatory Commands. (line 7) * speechd-speak-buffer-insertions: Auto-Reading Buffers. (line 28) @@ -3155,6 +3184,8 @@ * speechd-speak-deleted-char: Basic Speaking. (line 17) * speechd-speak-display-modes: Reading State. (line 33) * speechd-speak-echo: Basic Speaking. (line 6) +* speechd-speak-emacs-language: Languages. (line 50) +* speechd-speak-emacs-language <1>: Languages. (line 54) * speechd-speak-faces: Text Properties. (line 36) * speechd-speak-force-auto-speak-buffers: Auto-Reading Buffers. (line 18) @@ -3164,14 +3195,15 @@ * speechd-speak-header-line-info: Informatory Commands. (line 14) * speechd-speak-ignore-command-keys: Basic Speaking. (line 60) * speechd-speak-in-debugger: Debugging. (line 10) +* speechd-speak-index-mark-regexp: Index marking. (line 17) * speechd-speak-input-method-info: Informatory Commands. (line 28) * speechd-speak-input-method-languages: Languages. (line 41) * speechd-speak-insertions-in-buffers: Auto-Reading Buffers. (line 44) * speechd-speak-key-set-predefined-rate: Control Commands. (line 41) -* speechd-speak-last-insertions: Reading Commands. (line 64) -* speechd-speak-last-insertions <1>: Reading Commands. (line 78) -* speechd-speak-last-message: Reading Commands. (line 56) -* speechd-speak-last-message <1>: Reading Commands. (line 74) +* speechd-speak-last-insertions: Reading Commands. (line 65) +* speechd-speak-last-insertions <1>: Reading Commands. (line 79) +* speechd-speak-last-message: Reading Commands. (line 57) +* speechd-speak-last-message <1>: Reading Commands. (line 75) * speechd-speak-message-time-interval: Basic Speaking. (line 68) * speechd-speak-mode: Starting Alternative Output. (line 35) @@ -3184,23 +3216,23 @@ * speechd-speak-priority-insertions-in-buffers: Auto-Reading Buffers. (line 49) * speechd-speak-process-info: Informatory Commands. (line 32) -* speechd-speak-read-buffer: Reading Commands. (line 12) -* speechd-speak-read-char: Reading Commands. (line 46) +* speechd-speak-read-buffer: Reading Commands. (line 13) +* speechd-speak-read-char: Reading Commands. (line 47) * speechd-speak-read-command-keys: Basic Speaking. (line 38) * speechd-speak-read-command-name: Basic Speaking. (line 63) * speechd-speak-read-line: Reading Commands. (line 7) -* speechd-speak-read-mode-line: Reading Commands. (line 59) -* speechd-speak-read-next-line: Reading Commands. (line 50) -* speechd-speak-read-other-window: Reading Commands. (line 19) -* speechd-speak-read-page: Reading Commands. (line 39) -* speechd-speak-read-paragraph: Reading Commands. (line 35) -* speechd-speak-read-previous-line: Reading Commands. (line 53) -* speechd-speak-read-rectangle: Reading Commands. (line 26) -* speechd-speak-read-region: Reading Commands. (line 23) -* speechd-speak-read-rest-of-buffer: Reading Commands. (line 15) -* speechd-speak-read-sentence: Reading Commands. (line 32) -* speechd-speak-read-sexp: Reading Commands. (line 42) -* speechd-speak-read-word: Reading Commands. (line 29) +* speechd-speak-read-mode-line: Reading Commands. (line 60) +* speechd-speak-read-next-line: Reading Commands. (line 51) +* speechd-speak-read-other-window: Reading Commands. (line 20) +* speechd-speak-read-page: Reading Commands. (line 40) +* speechd-speak-read-paragraph: Reading Commands. (line 36) +* speechd-speak-read-previous-line: Reading Commands. (line 54) +* speechd-speak-read-rectangle: Reading Commands. (line 27) +* speechd-speak-read-region: Reading Commands. (line 24) +* speechd-speak-read-rest-of-buffer: Reading Commands. (line 16) +* speechd-speak-read-sentence: Reading Commands. (line 33) +* speechd-speak-read-sexp: Reading Commands. (line 43) +* speechd-speak-read-word: Reading Commands. (line 30) * speechd-speak-set-language: Parameter Setting Commands. (line 16) * speechd-speak-signal-events: Signalling. (line 13) @@ -3209,6 +3241,7 @@ * speechd-speak-state-changes: Reading State. (line 11) * speechd-speak-toggle-braille-keys: Braille Display Keys. (line 82) * speechd-speak-toggle-speaking: Control Commands. (line 7) +* speechd-speak-use-index-marks: Index marking. (line 12) * speechd-speak-whole-line: Basic Speaking. (line 29) * speechd-stop: Control Commands. (line 11) * speechd-timeout: Connection Setup. (line 36) @@ -3224,6 +3257,7 @@ * TAB characters: Problems. (line 26) * text properties: Text Properties. (line 6) * timeout: Connection Setup. (line 37) +* truncate-lines: Reading Commands. (line 7) * URL speaking: Problems. (line 18) * voice: Parameter Setting Commands. (line 33) @@ -3238,48 +3272,54 @@  Tag Table: -Node: Top1238 -Node: Introduction2763 -Node: Design Goals3964 -Node: Feature List6264 -Node: Components8744 -Node: speechd-el User Manual9988 -Node: Installation11478 -Node: Starting Alternative Output12872 -Node: Commands14759 -Node: Reading Commands15856 -Node: Informatory Commands18306 -Node: Control Commands19234 -Node: Parameter Setting Commands20747 -Node: Spelling23373 -Node: Other Commands24008 -Node: Customization24680 -Node: Driver Selection25970 -Node: Connection Setup26841 -Node: Default Priorities30595 -Node: Basic Speaking31693 -Node: Auto-Reading Buffers34573 -Node: Reading State37461 -Node: Signalling38827 -Ref: Signalling-Footnote-140000 -Node: Text Properties40106 -Node: Languages42315 -Node: Voices44689 -Node: Connection Voices46996 -Node: Multiple Connections48526 -Node: Keys50664 -Node: Braille Display Keys51646 -Node: Modes55669 -Node: Debugging56096 -Node: Advanced Customization56537 -Node: Problems58826 -Node: Tips62065 -Node: Bug Reporting63388 -Node: speechd-el Elisp Library66449 -Node: Contact Information68241 -Node: Copying This Manual69034 -Node: GNU Free Documentation License69306 -Node: GNU General Public License91762 -Node: Index129333 +Node: Top1200 +Node: Introduction2687 +Node: Design Goals3888 +Node: Feature List6188 +Node: Components8668 +Node: speechd-el User Manual9912 +Node: Installation11402 +Node: Starting Alternative Output12796 +Node: Commands14683 +Node: Reading Commands15780 +Node: Informatory Commands18304 +Node: Control Commands19232 +Node: Parameter Setting Commands20745 +Node: Spelling23371 +Node: Other Commands24006 +Node: Customization24678 +Node: Driver Selection26029 +Node: Connection Setup26900 +Node: Default Priorities30372 +Node: Basic Speaking31470 +Node: Auto-Reading Buffers34350 +Node: Reading State37238 +Node: Signalling38604 +Ref: Signalling-Footnote-139777 +Node: Text Properties39883 +Node: Index marking42096 +Node: Languages43114 +Node: Voices45991 +Node: Connection Voices48298 +Node: Multiple Connections49828 +Node: Keys51966 +Node: Braille Display Keys52948 +Node: Modes56971 +Node: Debugging57398 +Node: Advanced Customization57839 +Node: Problems60128 +Node: Tips63367 +Node: Bug Reporting64690 +Node: speechd-el Elisp Library67751 +Node: Contact Information69543 +Node: Copying This Manual70336 +Node: GNU Free Documentation License70608 +Node: GNU General Public License93064 +Node: Index130635  End Tag Table + + +Local Variables: +coding: utf-8 +End: diff -Nru speechd-el-2.9/speechd-el-pkg.el speechd-el-2.11/speechd-el-pkg.el --- speechd-el-2.9/speechd-el-pkg.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-el-pkg.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,6 +1,6 @@ -;;; speechd-el-pkg.el --- speechd-el package definition +;;; speechd-el-pkg.el --- speechd-el package definition -*- lexical-binding: t -*- -;; Copyright (C) 2013, 2016 Milan Zamazal +;; Copyright (C) 2013-2021 Milan Zamazal ;; Author: Milan Zamazal @@ -21,7 +21,7 @@ ;;; Code: -(define-package "speechd-el" "2.9" +(define-package "speechd-el" "2.11" "Client to speech synthesizers and Braille displays.") ;;; Announce diff -Nru speechd-el-2.9/speechd-el.texi speechd-el-2.11/speechd-el.texi --- speechd-el-2.9/speechd-el.texi 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-el.texi 2021-07-03 08:56:35.000000000 +0000 @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- @comment %**start of header @setfilename speechd-el.info -@set VERSION 2.9 +@set VERSION 2.11 @settitle speechd-el @value{VERSION} @syncodeindex fn cp @syncodeindex ky cp @@ -10,8 +10,8 @@ @copying This manual is for speechd-el, @value{VERSION}. -Copyright @copyright{} 2003, 2004, 2005, 2006, 2007, 2008, 2010 Brailcom, o.p.s. -Copyright @copyright{} 2012, 2013, 2016 Milan Zamazal +Copyright @copyright{} 2012-2021 Milan Zamazal +Copyright @copyright{} 2003-2010 Brailcom, o.p.s. @quotation Permission is granted to copy, distribute and/or modify this document @@ -429,10 +429,12 @@ @table @kbd @item C-e l @kindex C-e l +@cindex truncate-lines @findex speechd-speak-read-line Read current line (@code{speechd-speak-read-line}). With the prefix argument, read the line only from the current cursor position to the -end of line. +end of line. If @code{truncate-lines} is @code{nil}, read the line +only to its visual end. @item C-e b @kindex C-e b @@ -836,6 +838,7 @@ * Reading State:: Speaking Emacs state changes. * Signalling:: Signalling empty lines, etc. * Text Properties:: Handling faces and special pieces of text. +* Index marking:: Moving cursor when speaking. * Languages:: Using multiple languages. * Voices:: Defining different voices. * Connection Voices:: Setting connection parameters. @@ -919,15 +922,6 @@ Dispatcher should answer protocol commands immediately, but if you talk to a Speech Dispatcher in a strange way through a lagging network, you may want to increase the limit. - -@item speechd-spdsend -@cindex spdsend -If non-@code{nil}, it is a string naming the @emph{spdsend} binary -(normally @code{"spdsend"}) to use for communication with Speech -Dispatcher. If @code{nil} or if you use Emacs@tie{}22 or higher, -spdsend is not used. - -Usually you shouldn't care about this variable. @end vtable BRLTTY connection options: @@ -1250,7 +1244,7 @@ @end table @end vtable -@node Text Properties, Languages, Signalling, Customization +@node Text Properties, Index marking, Signalling, Customization @subsection Text Properties @cindex text properties @cindex faces @@ -1314,7 +1308,33 @@ enabled. @end vtable -@node Languages, Voices, Text Properties, Customization +@node Index marking, Languages, Text Properties, Customization +@subsection Index marking +@cindex index marking +@cindex cursor movement + +Reading a text with index marking means the cursor is moved over the +text as the text is read, whenever an inserted index mark is reached. +Index marking is switched off by default but you can set it up for +@code{speechd-speak-read-buffer} and +@code{speechd-speak-read-rest-of-buffer} commands using the following +variables: + +@vtable @code +@item speechd-speak-use-index-marks +If non-@code{nil}, index marking is enabled for +@code{speechd-speak-read-buffer} and +@code{speechd-speak-read-rest-of-buffer} commands. + +@item speechd-speak-index-mark-regexp +Regular expression defining the places where to put index marks to. +An index mark is put at the end of the regexp at each of the places. +If the regular expression is empty (the default), it's taken from +@code{sentence-end} variable. If @code{sentence-end} is @code{nil}, a +default regular expression matching common punctuation is used. +@end vtable + +@node Languages, Voices, Index marking, Customization @subsection Using multiple languages @cindex languages @@ -1369,6 +1389,20 @@ overridden by another setting. @end vtable +@vindex speechd-speak-emacs-language +Some texts in Emacs, such as messages, minibuffer prompts or +completions, are typically in English. speechd-el reads them in +English by default, but it can be instructed to use another language +for them: + +@vtable @code +@item speechd-speak-emacs-language +Language to use for texts originating from Emacs. It's a string +containing an RFC 1766 language code accepted by SSIP, @code{en} by +default. It can be also @code{nil}, meaning the language should be +unchanged and the current language should be used. +@end vtable + @node Voices, Connection Voices, Languages, Customization @subsection Defining voices @cindex voices diff -Nru speechd-el-2.9/speechd-out.el speechd-el-2.11/speechd-out.el --- speechd-el-2.9/speechd-out.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-out.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,5 +1,6 @@ -;;; speechd-out.el --- Alternative output interface +;;; speechd-out.el --- Alternative output interface -*- lexical-binding: t -*- +;; Copyright (C) 2018-2021 Milan Zamazal ;; Copyright (C) 2004, 2005, 2006, 2008 Brailcom, o.p.s. ;; Author: Milan Zamazal @@ -22,7 +23,7 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(require 'cl-lib) (require 'eieio) (require 'speechd-common) @@ -63,8 +64,8 @@ (push ,$err ,$speechd-out-errors))))) (when ,$speechd-out-errors ;; How to signal all the errors? - (destructuring-bind - (,$error . ,$error-data) (first ,$speechd-out-errors) + (cl-destructuring-bind + (,$error . ,$error-data) (cl-first ,$speechd-out-errors) (setq ,$speechd-out-errors (cdr ,$speechd-out-errors)) (while (and ,$speechd-out-errors (eq (caar ,$speechd-out-errors) ,$error)) @@ -91,7 +92,7 @@ :reader speechd-driver.name))) (cl-defmethod initialize-instance :after - ((this speechd-driver) slots) + ((this speechd-driver) _slots) (if (not (slot-boundp this 'name)) (error "Driver name not given"))) @@ -107,43 +108,43 @@ (cons (car list) (replace (cdr list))))))) (setq speechd-out--drivers (replace speechd-out--drivers))))) -(cl-defmethod speechd.cancel ((driver speechd-driver) all)) +(cl-defmethod speechd.cancel ((_driver speechd-driver) _all)) -(cl-defmethod speechd.stop ((driver speechd-driver) all)) +(cl-defmethod speechd.stop ((_driver speechd-driver) _all)) -(cl-defmethod speechd.pause ((driver speechd-driver) all)) +(cl-defmethod speechd.pause ((_driver speechd-driver) _all)) -(cl-defmethod speechd.resume ((driver speechd-driver) all)) +(cl-defmethod speechd.resume ((_driver speechd-driver) _all)) -(cl-defmethod speechd.repeat ((driver speechd-driver))) +(cl-defmethod speechd.repeat ((_driver speechd-driver))) -(cl-defmethod speechd.block ((driver speechd-driver) function)) +(cl-defmethod speechd.block ((_driver speechd-driver) _function)) -(cl-defmethod speechd.text ((driver speechd-driver) text cursor)) +(cl-defmethod speechd.text ((_driver speechd-driver) _text _cursor _markers)) -(cl-defmethod speechd.icon ((driver speechd-driver) icon)) +(cl-defmethod speechd.icon ((_driver speechd-driver) _icon)) -(cl-defmethod speechd.char ((driver speechd-driver) char)) +(cl-defmethod speechd.char ((_driver speechd-driver) _char)) -(cl-defmethod speechd.key ((driver speechd-driver) key)) +(cl-defmethod speechd.key ((_driver speechd-driver) _key)) -(cl-defmethod speechd.set ((driver speechd-driver) parameter value)) +(cl-defmethod speechd.set ((_driver speechd-driver) _parameter _value)) -(cl-defmethod speechd.shutdown ((driver speechd-driver))) +(cl-defmethod speechd.shutdown ((_driver speechd-driver))) -(defvar speechd.update nil) +(defvar speechd-update nil) ;;; Interface functions and variables -(defstruct speechd-out-update +(cl-defstruct speechd-out-update text cursor group) (defmacro speechd-out-with-updated-text (spec &rest body) - `(let ((speechd.update ,spec)) + `(let ((speechd-update ,spec)) ,@body)) (defun speechd-out-cancel (&optional all) @@ -166,52 +167,50 @@ (interactive) (speechd-out--loop-drivers-op #'speechd.repeat)) -(defun* speechd-out-icon (icon &key (priority speechd-default-sound-priority)) +(cl-defun speechd-out-icon (icon &key (priority speechd-default-sound-priority)) (let ((icon-name (speechd-out--icon-name icon))) (when icon-name (speechd-out--loop-drivers (driver) (speechd.set driver 'priority priority) (speechd.icon driver icon-name))))) -(defun* speechd-out-char (char &key (priority speechd-default-char-priority) - icon) +(cl-defun speechd-out-char (char &key (priority speechd-default-char-priority) icon) (let ((icon-name (speechd-out--icon-name icon))) (speechd-out--loop-drivers (driver) (speechd.set driver 'priority priority) - (lexical-let ((icon-name% icon-name) - (driver% driver) - (char% char)) + (let ((icon-name% icon-name) + (driver% driver) + (char% char)) (speechd.block driver (lambda () (when icon-name% (speechd.icon driver% icon-name%)) (speechd.char driver% char%))))))) -(defun* speechd-out-keys (keys &key (priority speechd-default-key-priority) - text) +(cl-defun speechd-out-keys (keys &key (priority speechd-default-key-priority) text) (speechd-out--loop-drivers (driver) (speechd.set driver 'priority priority) - (lexical-let ((driver% driver) - (keys% keys) - (text% text)) + (let ((driver% driver) + (keys% keys) + (text% text)) (speechd.block driver (lambda () (dolist (k keys%) (speechd.key driver% k)) (when text% - (speechd.text driver% text% nil))))))) + (speechd.text driver% text% nil nil))))))) -(defun* speechd-out-text (text &key (priority speechd-default-text-priority) - icon cursor) +(cl-defun speechd-out-text (text &key (priority speechd-default-text-priority) icon cursor markers) (let ((icon-name (speechd-out--icon-name icon))) (speechd-out--loop-drivers (driver) (speechd.set driver 'priority priority) - (lexical-let ((icon-name% icon-name) - (driver% driver) - (text% text) - (cursor% cursor)) + (let ((icon-name% icon-name) + (driver% driver) + (text% text) + (cursor% cursor) + (markers% markers)) (speechd.block driver (lambda () (when icon-name% (speechd.icon driver% icon-name%)) - (speechd.text driver% text% cursor%))))))) + (speechd.text driver% text% cursor% markers%))))))) (defun speechd-out-set (parameter value) (speechd-out--loop-drivers (driver) @@ -231,7 +230,7 @@ (completing-read "Enable driver: " (mapcar 'list (mapcar 'symbol-name - (set-difference + (cl-set-difference (mapcar 'speechd-driver.name speechd-out--drivers) speechd-out-active-drivers))) diff -Nru speechd-el-2.9/speechd-speak.el speechd-el-2.11/speechd-speak.el --- speechd-el-2.9/speechd-speak.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-speak.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,7 +1,7 @@ -;;; speechd-speak.el --- simple speechd-el based Emacs client +;;; speechd-speak.el --- simple speechd-el based Emacs client -*- lexical-binding: t -*- -;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010 Brailcom, o.p.s. -;; Copyright (C) 2012, 2013, 2016, 2019 Milan Zamazal +;; Copyright (C) 2012-2021 Milan Zamazal +;; Copyright (C) 2003-2010 Brailcom, o.p.s. ;; Author: Milan Zamazal @@ -28,7 +28,8 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(require 'cl-lib) +(require 'wid-edit) (require 'speechd) (require 'speechd-common) @@ -175,6 +176,19 @@ :type 'boolean :group 'speechd-speak) +(defcustom speechd-speak-use-index-marks nil + "If non-nil, move point over text in spoken buffers." + :type 'boolean + :group 'speechd-speak) + +(defcustom speechd-speak-index-mark-regexp "" + "Regular expression defining the places where to put index marks to. +An index mark is put at the end of the regexp at each of the places. +If the regexp is empty, `sentence-end' is used. If `sentence-end' is nil, +a default regexp matching common punctuation is used." + :type 'regexp + :group 'speechd-speak) + (defcustom speechd-speak-by-properties-on-movement t "Method of selection of the piece of text to be spoken on movement. Unless a command provides its speechd feedback in a different way, it speaks @@ -314,7 +328,18 @@ is selected unless overridden by another setting." :type '(alist :key-type (string :tag "Input method") :value-type (string :tag "Language code")) - :group 'speechd) + :group 'speechd-speak) + +(defcustom speechd-speak-emacs-language "en" + "Language to use for texts originating from Emacs. +Messages, minibuffer prompts, completions often contain English texts, +so it is desirable to speak them in English. This variable allows to +speak them in English, in another language or in the current language. +The value is an ISO language code string accepted by SSIP. +If nil, use the current language." + :type '(choice (string :tag "Language code") + (const :tag "Current" nil)) + :group 'speechd-speak) (defcustom speechd-speak-in-debugger t "If nil, speechd-speak functions won't speak in Elisp debuggers. @@ -339,11 +364,13 @@ :group 'speechd-speak) -;;; Internal constants +;;; Internal constants and variables (defconst speechd-speak--c-buffer-name "*Completions*") +(defvar speechd-speak--info) + ;;; Debugging support @@ -425,7 +452,7 @@ nil (cons major-mode (buffer-name))))) (cond - (speechd-speak--client-name-set + (speechd-speak--client-name-set speechd-client-name) ((and (not speechd-speak--client-name-set) (eq speechd-speak-connections speechd-speak--last-connections) @@ -451,9 +478,9 @@ result) ;; buffer name (let ((buffer-name (buffer-name))) - (assoc-if (lambda (key) - (when (stringp key) (string-match key buffer-name))) - speechd-speak-connections)) + (cl-assoc-if (lambda (key) + (when (stringp key) (string-match key buffer-name))) + speechd-speak-connections)) ;; minibuffer (and (speechd-speak--in-minibuffer-p) (assoc :minibuffer speechd-speak-connections)) @@ -512,7 +539,7 @@ ((eq invisibility-spec t) invisibility) ((consp invisibility) - (intersection invisibility-spec invisibility)) + (cl-intersection invisibility-spec invisibility)) (t (memq invisibility buffer-invisibility-spec))))) (push (substring text pos next-pos) pieces)) @@ -560,12 +587,13 @@ (speechd-speak--interactive (speechd-speak--char (or char (following-char))))) -(defun speechd-speak-read-region (&optional beg end empty-text) +(defun speechd-speak-read-region (&optional beg end empty-text index-marks) "Output region of the current buffer between BEG and END. If BEG is nil, current mark is used instead. If END is nil, current point is used instead. EMPTY-TEXT is a text to output if the region is empty; if nil, empty text icon -is output." +is output. +If INDEX-MARKS is non-nil, insert index marks to the spoken text." (interactive "r") (speechd-speak--interactive (let* ((beg (or beg (mark))) @@ -580,8 +608,9 @@ :priority speechd-default-text-priority)) (t (let* ((point (point)) - (cursor (and (>= point beg) (<= point end) (- (point) beg)))) - (speechd-speak--text text :cursor cursor))))))) + (cursor (and (>= point beg) (<= point end) (- (point) beg))) + (markers (when index-marks (speechd-speak--markers beg end)))) + (speechd-speak--text text :cursor cursor :markers markers))))))) (defun speechd-speak-read-line (&optional rest-only) "Output current line. @@ -592,7 +621,9 @@ (let* ((inhibit-field-text-motion t) (in-isearch-p (and isearch-mode (not (called-interactively-p 'interactive)))) (beg (if (and rest-only (not in-isearch-p)) (point) (line-beginning-position))) - (end (line-end-position))) + (end (if truncate-lines + (line-end-position) + (save-excursion (end-of-visual-line) (point))))) (when speechd-speak-separator-regexp (save-match-data (save-excursion @@ -632,13 +663,15 @@ (save-excursion (when buffer (set-buffer buffer)) - (speechd-speak-read-region (point-min) (point-max))))) + (speechd-speak-read-region (point-min) (point-max) nil + speechd-speak-use-index-marks)))) (defun speechd-speak-read-rest-of-buffer () "Read current buffer from the current point to the end of the buffer." (interactive) (speechd-speak--interactive - (speechd-speak-read-region (point) (point-max)))) + (speechd-speak-read-region (point) (point-max) nil + speechd-speak-use-index-marks))) (defun speechd-speak-read-rectangle (beg end) "Read text in the region-rectangle." @@ -701,7 +734,7 @@ (speechd-speak--def-speak-object page) (speechd-speak--def-speak-object sexp) -(defstruct speechd-speak--command-info-struct +(cl-defstruct speechd-speak--command-info-struct marker modified (changes '()) @@ -717,13 +750,13 @@ (defmacro speechd-speak--cinfo (slot) `(,(speechd-speak--name 'speechd-speak--command-info-struct slot) - info)) + speechd-speak--info)) -(defun speechd-speak--command-info-struct-buffer (info) +(defun speechd-speak--command-info-struct-buffer (_info) (let ((marker (speechd-speak--cinfo marker))) (and marker (marker-buffer marker)))) -(defun speechd-speak--command-info-struct-point (info) +(defun speechd-speak--command-info-struct-point (_info) (let ((marker (speechd-speak--cinfo marker))) (and marker (marker-position marker)))) @@ -775,21 +808,28 @@ (speechd-speak--set-command-start-info t)) (defmacro speechd-speak--with-command-start-info (&rest body) - `(let ((info (speechd-speak--command-start-info))) - (when info + `(let ((speechd-speak--info (speechd-speak--command-start-info))) + (when speechd-speak--info ,@body))) (defmacro speechd-speak--defadvice (function class &rest body) (let* ((function* function) (functions (if (listp function*) function* (list function*))) + (class* class) + (where (intern (concat ":" (symbol-name class*)))) + (aroundp (eq class* 'around)) + (lambda-list (if aroundp '(orig-fun &rest args) '(&rest args))) (aname (if (listp function*) 'speechd-speak 'speechd-speak-user))) `(progn ,@(mapcar (lambda (fname) - `(defadvice ,fname (,class ,aname activate preactivate compile) - (if (not speechd-speak--started) - ,(when (eq class 'around) 'ad-do-it) - ,@body))) + `(define-advice ,fname (,where ,lambda-list ,aname) + (cl-flet ,(when aroundp `((call-orig-func () (apply orig-fun args)))) + (if (not speechd-speak--started) + ,(if aroundp + `(call-orig-func) + 'args) ;; not nil, to silence warnings about unused `args' + ,@body)))) functions)))) (defmacro speechd-speak--report (feedback &rest args) @@ -829,7 +869,7 @@ ,(if (eq position* 'around) `(if (called-interactively-p 'interactive) ,body* - ad-do-it) + (call-orig-func)) `(when (called-interactively-p 'interactive) ,body*)))) commands*) @@ -839,21 +879,19 @@ (defmacro speechd-speak--command-feedback-region (commands) `(speechd-speak--command-feedback ,commands around (let ((start (point))) - (prog1 ad-do-it + (prog1 (call-orig-func) (speechd-speak--speak-piece start))))) -(defun* speechd-speak--next-property-change (&optional (point (point)) - (limit (point-max))) +(cl-defun speechd-speak--next-property-change (&optional (point (point)) (limit (point-max))) (next-char-property-change point limit)) -(defun* speechd-speak--previous-property-change (&optional (point (point)) - (limit (point-min))) +(cl-defun speechd-speak--previous-property-change (&optional (point (point)) (limit (point-min))) ;; Let's be careful about isearch overlays not to cut texts in isearch (let* ((i-overlays (and isearch-mode - (intersection (overlays-at (- point 2)) - (append (list isearch-overlay) - isearch-opened-overlays - isearch-lazy-highlight-overlays)))) + (cl-intersection (overlays-at (- point 2)) + (append (list isearch-overlay) + isearch-opened-overlays + isearch-lazy-highlight-overlays)))) (i-overlays-start (1- (apply #'min (1+ point) (mapcar #'overlay-start i-overlays))))) (when (>= i-overlays-start limit) ;; This may omit other property borders as well. But in isearch we @@ -872,16 +910,35 @@ (speechd-set-language language) (setq speechd-language language)) +(defun speechd-speak--language (&optional special) + (or (and special speechd-speak-emacs-language) speechd-language)) + (defun speechd-speak--in-comint-p () "Return non-nil if the current buffer is any sort of a comint buffer." (and (boundp 'comint-accum-marker) comint-accum-marker)) +(defvar speechd-speak--marker-counter 0) + +(defun speechd-speak--markers (beg end) + ;; Return list of (POSITION INDEX MARKER) + (let ((regexp speechd-speak-index-mark-regexp) + (markers '())) + (when (string= regexp "") + (setq regexp (or sentence-end "[.,;!?]+"))) + (save-excursion + (goto-char beg) + (while (re-search-forward regexp end t) + (push (list (cl-incf speechd-speak--marker-counter) (point-marker)) + markers))) + (mapcar #'(lambda (m) (cons (- (marker-position (cl-second m)) beg) m)) + markers))) + ;;; Basic speaking (speechd-speak--command-feedback (next-line previous-line) after - (speechd-speak-read-line)) + (speechd-speak-read-line (not speechd-speak-whole-line))) (speechd-speak--command-feedback (forward-word backward-word) after (speechd-speak-read-word)) @@ -916,23 +973,23 @@ (let ((speechd-speak--deleted-chars (when speechd-speak-deleted-char (speechd-speak--buffer-substring - (max (- (point) (or (ad-get-arg 0) 1)) + (max (- (point) (or (cl-first args) 1)) (point-min)) (point))))) - ad-do-it + (apply orig-fun args) (speechd-speak--store-deleted-chars (if speechd-speak-deleted-char speechd-speak--deleted-chars (format "%c" (preceding-char)))))) - ad-do-it)) - + (call-orig-func))) + (speechd-speak--defadvice (delete-forward-char delete-char) around (let ((speechd-speak--deleted-chars (when speechd-speak-deleted-char (speechd-speak--buffer-substring (point) - (min (+ (point) (or (ad-get-arg 0) 1)) + (min (+ (point) (or (cl-first args) 1)) (point-max)))))) - ad-do-it + (call-orig-func) (speechd-speak--store-deleted-chars (if speechd-speak-deleted-char speechd-speak--deleted-chars (format "%c" (following-char)))))) @@ -959,7 +1016,7 @@ (speechd-speak-read-word))) (speechd-speak--command-feedback (kill-line) before - (speechd-speak-read-line)) + (speechd-speak-read-line t)) (speechd-speak--command-feedback (kill-sexp) before (speechd-speak-read-sexp)) @@ -975,7 +1032,7 @@ (speechd-speak--command-feedback (kill-region completion-kill-region) around (let ((nlines (count-lines (region-beginning) (region-end)))) - (prog1 ad-do-it + (prog1 (call-orig-func) (speechd-speak--maybe-speak* (message "Killed region containing %s lines" nlines))))) @@ -992,7 +1049,7 @@ (interactive) (speechd-speak--interactive (let ((speechd-speak-input-method-languages nil) - (speechd-language "en")) + (speechd-language (speechd-speak--language t))) (speechd-speak--text speechd-speak--last-message)))) (defun speechd-speak--read-message (message) @@ -1050,8 +1107,8 @@ (speechd-speak--defadvice read-from-minibuffer around (let ((speechd-speak--minibuffer-inherited-language - (and (ad-get-arg 6) speechd-language))) - ad-do-it)) + (and (cl-seventh args) speechd-language))) + (call-orig-func))) (defun speechd-speak--prompt (prompt &optional no-icon) (speechd-speak--text prompt :priority 'message @@ -1062,7 +1119,7 @@ ;; Discard changes, otherwise they would be read *after* the prompt, perhaps ;; confusing the user (setf (speechd-speak--cinfo changes) '())) - (let ((speechd-language "en") + (let ((speechd-language (speechd-speak--language t)) (speechd-speak-input-method-languages nil)) (speechd-speak--prompt (minibuffer-prompt))) (speechd-speak--prompt (minibuffer-contents) t)) @@ -1115,12 +1172,12 @@ (defun speechd-speak--minibuffer-prompt (prompt &rest args) (speechd-speak--read-other-changes) - (let ((speechd-language "en") + (let ((speechd-language (speechd-speak--language t)) (speechd-speak-input-method-languages nil)) (apply #'speechd-speak--text prompt args))) - + (speechd-speak--command-feedback minibuffer-message after - (speechd-speak--minibuffer-prompt (ad-get-arg 0) :priority 'notification)) + (speechd-speak--minibuffer-prompt (cl-first args) :priority 'notification)) ;; Some built-in functions, reading a single character answer, prompt in the ;; echo area. They don't invoke minibuffer-setup-hook and may put other @@ -1139,15 +1196,15 @@ ;; The following functions don't invoke `minibuffer-setup-hook' and don't put ;; the cursor into the echo area. Sigh. (speechd-speak--defadvice read-key-sequence before - (let ((prompt (ad-get-arg 0)) + (let ((prompt (cl-first args)) (speechd-speak--emulate-minibuffer t)) (when prompt (speechd-speak--minibuffer-prompt prompt :priority 'message)))) (speechd-speak--defadvice read-event before - (let ((prompt (ad-get-arg 0))) + (let ((prompt (cl-first args))) (when prompt (let ((speechd-speak--emulate-minibuffer t) - (speechd-language (if (ad-get-arg 1) speechd-language "en"))) + (speechd-language (speechd-speak--language (not (cl-second args))))) (speechd-speak--minibuffer-prompt prompt :priority 'message))))) @@ -1166,15 +1223,14 @@ (if speechd-speak-allow-prompt-commands (let ((char nil)) (while (not char) - ad-do-it - (setq char ad-return-value) + (setq char (call-orig-func)) (let ((command (lookup-key speechd-speak-read-char-keymap (vector char)))) (when command (setq char nil) (call-interactively command)))) char) - ad-do-it)) + (call-orig-func))) ;;; Commands @@ -1211,8 +1267,8 @@ (speechd-out-keys (nreverse keys-to-output) :text text-to-output :priority priority)))) -(defun speechd-speak--add-command-text (info beg end) - (let ((last (first (speechd-speak--cinfo changes))) +(defun speechd-speak--add-command-text (beg end) + (let ((last (cl-first (speechd-speak--cinfo changes))) (last-end (speechd-speak--cinfo change-end)) (text (speechd-speak--buffer-substring beg end t))) (setf (speechd-speak--cinfo change-end) end) @@ -1250,9 +1306,8 @@ `(face ,face invisible ,invisible) text))))) text)) -(defun speechd-speak--minibuffer-update-report (info old new) +(defun speechd-speak--minibuffer-update-report (old new) (speechd-speak--add-command-text - info (+ (minibuffer-prompt-end) (if (and (<= (length old) (length new)) (string= old (substring new 0 (length old)))) @@ -1260,15 +1315,14 @@ 0)) (point-max))) -(defun speechd-speak--minibuffer-update (beg end len) +(defun speechd-speak--minibuffer-update () (speechd-speak--with-command-start-info (let ((old-content (speechd-speak--cinfo minibuffer-contents)) (new-content (minibuffer-contents))) (unless (or (eq old-content 'unset) (string= old-content new-content)) (setf (speechd-speak--cinfo minibuffer-contents) new-content) - (speechd-speak--minibuffer-update-report - info old-content new-content))))) + (speechd-speak--minibuffer-update-report old-content new-content))))) (defun speechd-speak--read-buffer-change (buffer-name text) (with-current-buffer (or (get-buffer buffer-name) @@ -1283,7 +1337,7 @@ (unless speechd-speak--current-change-string (setq speechd-speak--current-change-string (buffer-substring-no-properties beg end)))) -(defun speechd-speak--after-change-hook (beg end len) +(defun speechd-speak--after-change-hook (beg end _len) (speechd-speak--enforce-speak-mode) (speechd-speak--with-command-start-info (unless (or (= beg end) @@ -1314,8 +1368,8 @@ (if (speechd-speak--in-minibuffer-p) (progn (speechd-speak--read-other-changes) - (speechd-speak--minibuffer-update beg end len)) - (speechd-speak--add-command-text info beg end)))))) + (speechd-speak--minibuffer-update)) + (speechd-speak--add-command-text beg end)))))) (setq speechd-speak--current-change-string nil)) (defconst speechd-speak--dont-cancel-on-commands @@ -1356,12 +1410,14 @@ (defmacro speechd-speak--post-defun (name shy new-state guard &rest body) (let* ((name (speechd-speak--name 'speechd-speak--post-read name)) - (state-condition (case shy + (state-condition (cl-case shy ((t) `(eq state nil)) (sometimes `(not (eq state t))) (t t)))) `(defun ,name (state buffer-changed buffer-modified point-moved in-minibuffer other-buffer) + ;; Avoid compiler warnings about unused variables + (list buffer-changed buffer-modified point-moved in-minibuffer other-buffer) (if (and ,state-condition ,guard) (let ((speechd-speak--debug-mark (quote ,name))) @@ -1398,7 +1454,7 @@ (and (stringp deleted-chars) (or (null changes) (and (= (length changes) 1) - (equal (first changes) deleted-chars))))) + (equal (cl-first changes) deleted-chars))))) (when (eq speechd-speak-read-command-keys t) ;; Cancel reading the DEL key etc. -- perhaps too daring? (speechd-out-cancel)) @@ -1472,8 +1528,8 @@ (reverse changes)) " "))) (when (and self-insert - (> (length (first changes)) 1)) - (setq text (concat text " " (first changes)))) + (> (length (cl-first changes)) 1)) + (setq text (concat text " " (cl-first changes)))) (cond ((and (eq speechd-speak-buffer-insertions 'whole-buffer) (not self-insert)) @@ -1488,7 +1544,7 @@ speechd-speak-echo (not (memq 'self-insert-command speechd-speak-ignore-command-keys))) - (case speechd-speak-echo + (cl-case speechd-speak-echo (word (let ((point (point))) (when (and (> point 1) @@ -1505,7 +1561,7 @@ (/= (speechd-speak--cinfo completion-buffer-modified) (buffer-modified-tick (get-buffer speechd-speak--c-buffer-name)))) (with-current-buffer speechd-speak--c-buffer-name - (let ((speechd-language "en") + (let ((speechd-language (speechd-speak--language t)) (speechd-speak-input-method-languages nil)) (goto-char (point-min)) (save-match-data @@ -1587,7 +1643,7 @@ (and speechd-speak-on-minibuffer-exit (/= (minibuffer-depth) speechd-speak--last-minibuffer-depth)) (speechd-speak-read-line t)) - + (defvar speechd-speak--last-minibuffer-depth 0) (defvar speechd-speak--post-command-speaking-defaults @@ -1672,7 +1728,7 @@ (defun speechd-speak--speak-completion () ;; Taken from `choose-completion' - (let (beg end completion (buffer completion-reference-buffer)) + (let (beg end completion) (if (and (not (eobp)) (get-text-property (point) 'mouse-face)) (setq end (point) beg (1+ (point)))) (if (and (not (bobp)) (get-text-property (1- (point)) 'mouse-face)) @@ -1694,7 +1750,7 @@ (speechd-speak--defadvice widget-choose around (let ((widget-menu-minibuffer-flag (or speechd-speak-mode widget-menu-minibuffer-flag))) - ad-do-it)) + (call-orig-func))) ;;; Other functions and packages @@ -1747,7 +1803,7 @@ (interactive) (unless speechd-speak-spell-mode (setq speechd-speak-spell-command t))) - + ;;; Informatory commands @@ -1757,9 +1813,8 @@ (defvar speechd-speak--info-updates nil) -(defmacro* speechd-speak--watch (name get-function - &key on-change info info-string key) - `(locally +(cl-defmacro speechd-speak--watch (name get-function &key on-change info info-string key) + `(progn (fset (quote ,(speechd-speak--name 'speechd-speak--get name)) ,get-function) ,(when info @@ -1783,14 +1838,14 @@ `(defun ,(speechd-speak--name 'speechd-speak--update name) (old new) (speechd-speak--maybe-speak (let ((speechd-default-text-priority 'message) - (speechd-language "en") + (speechd-language (speechd-speak--language t)) (speechd-speak-input-method-languages nil)) (funcall ,on-change old new))))) ,(when on-change `(add-to-list 'speechd-speak--info-updates (quote ,name))))) (speechd-speak--watch buffer-name #'buffer-name - :on-change #'(lambda (old new) + :on-change #'(lambda (_old new) (speechd-speak--text (format "Buffer %s" new)))) (speechd-speak--watch buffer-identification @@ -1799,17 +1854,17 @@ (let ((ident (format-mode-line mode-line-buffer-identification))) (set-text-properties 0 (length ident) nil ident) ident))) - :on-change #'(lambda (old new) + :on-change #'(lambda (_old new) (speechd-speak--text (format "New buffer identification: %s" new)))) (speechd-speak--watch buffer-modified #'buffer-modified-p - :on-change #'(lambda (old new) + :on-change #'(lambda (_old new) (speechd-speak--text (if new "Buffer modified" "No buffer modification")))) (speechd-speak--watch buffer-read-only #'(lambda () buffer-read-only) - :on-change #'(lambda (old new) + :on-change #'(lambda (_old new) (speechd-speak--text (if new "Buffer writable" "Buffer read-only")))) @@ -1839,7 +1894,7 @@ (let ((ident (format-mode-line mode-line-frame-identification))) (set-text-properties 0 (length ident) nil ident) ident))) - :on-change #'(lambda (old new) + :on-change #'(lambda (_old new) (speechd-speak--text (format "Frame identification changed to: %s" new)))) @@ -1861,7 +1916,7 @@ (let ((line (format-mode-line header-line-format))) (if (string= line "") "empty" line)) "unknown")) - :on-change #'(lambda (old new) + :on-change #'(lambda (_old new) (speechd-speak--text (format "Header line changed to: %s" new))) :info-string "Header line: %s" @@ -1874,17 +1929,17 @@ (speechd-speak--watch minor-modes #'(lambda () - (loop for mode-spec in minor-mode-alist - for mode = (car mode-spec) - when (and (boundp mode) (symbol-value mode)) - collect (if (memq mode speechd-speak-display-modes) - (cadr mode-spec) - mode))) + (cl-loop for mode-spec in minor-mode-alist + for mode = (car mode-spec) + when (and (boundp mode) (symbol-value mode)) + collect (if (memq mode speechd-speak-display-modes) + (cadr mode-spec) + mode))) :on-change #'(lambda (old new) (cl-flet ((set-difference (x y) - (loop for i in x - unless (memq i y) - collect i))) + (cl-loop for i in x + unless (memq i y) + collect i))) (let ((disabled (set-difference old new)) (enabled (set-difference new old))) (when enabled @@ -2051,7 +2106,7 @@ With no argument, this command toggles the mode. Non-null prefix argument turns on the mode. Null prefix argument turns off the mode. - + When speechd-speak mode is enabled, speech output is provided to Speech Dispatcher on many actions. diff -Nru speechd-el-2.9/speechd-ssip.el speechd-el-2.11/speechd-ssip.el --- speechd-el-2.9/speechd-ssip.el 2020-01-22 20:43:06.000000000 +0000 +++ speechd-el-2.11/speechd-ssip.el 2021-07-03 08:56:35.000000000 +0000 @@ -1,6 +1,7 @@ -;;; speechd-ssip.el --- SSIP driver +;;; speechd-ssip.el --- SSIP driver -*- lexical-binding: t -*- -;; Copyright (C) 2004, 2006, 2008 Brailcom, o.p.s. +;; Copyright (C) 2018-2021 Milan Zamazal +;; Copyright (C) 2004-2018 Brailcom, o.p.s. ;; Author: Milan Zamazal @@ -32,45 +33,45 @@ ((name :initform 'ssip) (host :initform speechd-host :initarg :host) (port :initform speechd-port :initarg :port))) - -(cl-defmethod speechd.cancel ((driver speechd-ssip-driver) all) + +(cl-defmethod speechd.cancel ((_driver speechd-ssip-driver) all) (speechd-cancel all)) -(cl-defmethod speechd.stop ((driver speechd-ssip-driver) all) +(cl-defmethod speechd.stop ((_driver speechd-ssip-driver) all) (speechd-stop all)) -(cl-defmethod speechd.pause ((driver speechd-ssip-driver) all) +(cl-defmethod speechd.pause ((_driver speechd-ssip-driver) all) (speechd-pause all)) -(cl-defmethod speechd.resume ((driver speechd-ssip-driver) all) +(cl-defmethod speechd.resume ((_driver speechd-ssip-driver) all) (speechd-resume all)) -(cl-defmethod speechd.repeat ((driver speechd-ssip-driver)) +(cl-defmethod speechd.repeat ((_driver speechd-ssip-driver)) (speechd-repeat)) -(cl-defmethod speechd.block ((driver speechd-ssip-driver) function) +(cl-defmethod speechd.block ((_driver speechd-ssip-driver) function) (speechd-block function)) -(cl-defmethod speechd.text ((driver speechd-ssip-driver) text cursor) - (speechd-say-text text)) +(cl-defmethod speechd.text ((_driver speechd-ssip-driver) text _cursor markers) + (speechd-say-text text :markers markers)) -(cl-defmethod speechd.icon ((driver speechd-ssip-driver) icon) +(cl-defmethod speechd.icon ((_driver speechd-ssip-driver) icon) (speechd-say-sound icon)) -(cl-defmethod speechd.char ((driver speechd-ssip-driver) char) +(cl-defmethod speechd.char ((_driver speechd-ssip-driver) char) (speechd-say-char char)) -(cl-defmethod speechd.key ((driver speechd-ssip-driver) key) +(cl-defmethod speechd.key ((_driver speechd-ssip-driver) key) (speechd-say-key key)) (defconst speechd-ssip--parameter-names (mapcar 'car speechd--parameter-names)) -(cl-defmethod speechd.set ((driver speechd-ssip-driver) parameter value) +(cl-defmethod speechd.set ((_driver speechd-ssip-driver) parameter value) (when (eq parameter 'priority) (setq parameter 'message-priority)) (when (memq parameter speechd-ssip--parameter-names) (speechd--set-parameter parameter value))) -(cl-defmethod speechd.shutdown ((driver speechd-ssip-driver)) +(cl-defmethod speechd.shutdown ((_driver speechd-ssip-driver)) (speechd-close-all))