summaryrefslogtreecommitdiff
path: root/greader-speechd.el
diff options
context:
space:
mode:
Diffstat (limited to 'greader-speechd.el')
-rw-r--r--greader-speechd.el29
1 files changed, 8 insertions, 21 deletions
diff --git a/greader-speechd.el b/greader-speechd.el
index c928de5..2913cab 100644
--- a/greader-speechd.el
+++ b/greader-speechd.el
@@ -82,27 +82,14 @@ for further documentation, see the `greader-speechd-rate' variable."
"Return a suitable parameter to pass to spd-say for setting punctuation level.
PUNCT must be a numeric value, 0 for no punctuation, 1 for some and 2
or >2 for all punctuation."
- (catch 'return
- (cond
- ((booleanp punct)
- (if punct
- (progn
- (setq-local greader-speechd-punctuation "all")
- (throw 'return (concat "-mall")))
- (throw 'return greader-speechd-punctuation)))
- ((numberp punct)
- (if (= punct 0)
- (progn
- (setq-local greader-speechd-punctuation "none")
- (throw 'return (concat "-mnone"))))
- (if (= punct 1)
- (progn
- (setq-local greader-speechd-punctuation "some")
- (throw 'return (concat "-msome"))))
- (if (>= punct 2)
- (progn
- (setq-local greader-speechd-punctuation "all")
- (throw 'return (concat "-mall"))))))))
+ (setq-local greader-speechd-punctuation
+ (pcase punct
+ ('t "all")
+ ('0 "none")
+ ('1 "some")
+ ((and (pred numberp) (pred (<= 2))) "all")
+ (_ (error "Unknown punctuation: %S" punct))))
+ (concat "-m" greader-speechd-punctuation))
(defun greader-speechd-stop ()
"Stops speech-dispatcher client."