[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/greader ed45417 45/76: functions to handle punctuation
From: |
Stefan Monnier |
Subject: |
[elpa] externals/greader ed45417 45/76: functions to handle punctuation rewritten to reflect new back-end architecture. |
Date: |
Fri, 8 Feb 2019 15:26:54 -0500 (EST) |
branch: externals/greader
commit ed4541769996cfb4baaf787618e2bb579742c9d3
Author: Michelangelo Rodriguez <address@hidden>
Commit: Michelangelo Rodriguez <address@hidden>
functions to handle punctuation rewritten to reflect new back-end
architecture.
---
greader-espeak.el | 26 +++++++++++++++++++-------
greader-speechd.el | 30 ++++++++++++++++++++++--------
greader.el | 14 +++++++-------
3 files changed, 48 insertions(+), 22 deletions(-)
diff --git a/greader-espeak.el b/greader-espeak.el
index 1503c27..2c8234b 100644
--- a/greader-espeak.el
+++ b/greader-espeak.el
@@ -59,15 +59,15 @@ this variable determines authomatically if espeak is
present in your PATH enviro
()
"tries to find espeak executable in PATH.
If it's present, returns absolute path of espeak, else returns nil."
-(locate-file "espeak" exec-path))
+ (locate-file "espeak" exec-path))
+
(defun greader-espeak-set-punctuation
(&optional switch)
"sets espeak punctuation on or off.
this function accepts only nil or t."
(if switch
- "--punct"
- greader-espeak-punctuation))
-
+ (setq-local greader-espeak-punctuation switch)
+ greader-espeak-punctuation))
(defun greader-espeak (command &optional arg &rest args)
"back-end main function of greader-espeak."
(pcase command
@@ -84,9 +84,21 @@ this function accepts only nil or t."
(greader-espeak-set-rate)
(greader-espeak-set-rate arg)))
('punctuation
- (if (not arg)
- (greader-espeak-set-punctuation)
- (greader-espeak-set-punctuation arg)))
+ (cond
+
+ (
+ (or (equal arg 'yes) arg)
+ (setq-local greader-espeak-punctuation t)
+ "--punct")
+ (
+ (equal arg 'no)
+ (setq-local greader-espeak-punctuation nil)
+ nil)
+ ((not arg)
+ (if greader-espeak-punctuation
+ "--punct"
+ greader-espeak-punctuation))))
+
(command-not-implemented
'not-implemented)))
(put 'greader-espeak 'greader-backend-name "greader-espeak")
diff --git a/greader-speechd.el b/greader-speechd.el
index aacb2c6..575e6fe 100644
--- a/greader-speechd.el
+++ b/greader-speechd.el
@@ -70,15 +70,25 @@ punct must be a numeric value, 0 for no punctuation, 1 for
some and 2 or >2 for
(cond
((booleanp punct)
(if punct
- (throw 'return (concat "-mall"))
- (throw 'return (concat "-mnone"))))
+ (progn
+ (setq-local greader-speechd-punctuation "all")
+ (throw 'return (concat "-mall")))
+ (progn
+ (setq-local greader-speechd-punctuation "none")
+ (throw 'return (concat "-mnone")))))
((numberp punct)
(if (= punct 0)
- (throw 'return (concat "-mnone")))
+ (progn
+ (setq-local greader-speechd-punctuation "none")
+ (throw 'return (concat "-mnone"))))
(if (= punct 1)
- (throw 'return (concat "-msome")))
+ (progn
+ (setq-local greader-speechd-punctuation "some")
+ (throw 'return (concat "-msome"))))
(if (>= punct 2)
- (throw 'return (concat "-mall")))))))
+ (progn
+ (setq-local greader-speechd-punctuation "all")
+ (throw 'return (concat "-mall"))))))))
(defun greader-speechd-stop ()
"stops speech-dispatcher client."
(start-process "speechd-client" nil greader-speechd-executable-path "-S"))
@@ -96,9 +106,13 @@ punct must be a numeric value, 0 for no punctuation, 1 for
some and 2 or >2 for
(greader-speechd-set-rate)
(greader-speechd-set-rate arg)))
('punctuation
- (if (not arg)
- (greader-speechd-set-punctuation)
- (greader-speechd-set-punctuation arg)))
+ (cond
+ ((equal arg 'no)
+ (greader-speechd-set-punctuation 0))
+ ((equal arg 'yes)
+ (greader-speechd-set-punctuation 2))
+ ((not arg)
+ (greader-speechd-set-punctuation))))
('stop
(greader-speechd-stop))
('extra
diff --git a/greader.el b/greader.el
index 64c846b..2541a8d 100644
--- a/greader.el
+++ b/greader.el
@@ -458,21 +458,21 @@ This function sets the language of tts local for current
buffer, so if you want
(interactive "sset language to:")
(greader-call-backend 'lang lang))
(defun greader-set-punctuation (flag)
- (setq-local greader-punctuation flag)
+ (greader-call-backend 'punctuation flag)
greader-punctuation)
(defun greader-toggle-punctuation ()
"Toggles punctuation locally for current buffer."
(interactive)
- (if greader-punctuation
+ (if (equal (greader-call-backend 'punctuation) "")
(progn
(greader-stop)
- (greader-set-punctuation nil)
- (message "punctuation disabled in current buffer")
+ (greader-set-punctuation t)
+ (message "punctuation enabled in current buffer")
(greader-read))
(progn
(greader-stop)
- (greader-set-punctuation t)
- (message "punctuation enabled in current buffer")
+ (greader-set-punctuation nil)
+ (message "punctuation disabled in current buffer")
(greader-read))))
(defun greader-toggle-timer-flag ()
@@ -696,8 +696,8 @@ The default is 22:00 for entering and 08:00 for exiting."
(defun greader-set-rate (n)
"sets rate in current buffer to tthe specified value in n. rate is expressed
in words per minute.
For maximum value, see 'man espeak'."
+ (greader-call-backend 'rate n))
- (setq-local greader-rate n))
(defun greader-inc-rate (&optional n)
"increments rate of speech by 10 units.
- [elpa] externals/greader 081c7c4 34/76: greader-speechd.el:, (continued)
- [elpa] externals/greader 081c7c4 34/76: greader-speechd.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 5af124e 37/76: greader-espeak.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 5964436 35/76: first functional version of greader with back-ends!, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 5a4b548 39/76: greader-espeak.el: greader-backend-name property added to greader-espeak., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 9dcdc83 38/76: bugfixes, Stefan Monnier, 2019/02/08
- [elpa] externals/greader b2cc418 42/76: greader-espeak.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader c8f9e74 50/76: greader-pkg.el added., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 43d18b9 47/76: backup files added to .gitignore., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 3efc0a8 51/76: updated commentary., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 0fc03d5 52/76: greader.elc removed., Stefan Monnier, 2019/02/08
- [elpa] externals/greader ed45417 45/76: functions to handle punctuation rewritten to reflect new back-end architecture.,
Stefan Monnier <=
- [elpa] externals/greader a325ef4 54/76: Adding autoloads., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 083f14b 43/76: greader.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 748cb81 44/76: greader.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader ec40287 53/76: file README added., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 0db37f6 48/76: preparing to merge., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 4482ba6 56/76: initial work on punctuation., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 3186627 75/76: greader.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 4ef8c7d 57/76: work on punctuation completed., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 7a414f2 73/76: more work on backend completion, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 9274673 66/76: Some diffs applied to various files., Stefan Monnier, 2019/02/08