[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Search]
Patch: Allow Emacspeak to work with 8-bit characters
- To: Milan Zamazal <pdm@xxxxxxxxxxx>
- Subject: Patch: Allow Emacspeak to work with 8-bit characters
- From: "T. V. Raman" <raman@xxxxxxxxxxx>
- Date: Mon, 25 Jun 2001 13:08:37 -0700
- In-Reply-To: <87zob3xdgb.fsf@xxxxxxxxxxx>
- Resent-Date: Mon, 25 Jun 2001 16:16:30 -0400 (EDT)
- Resent-From: emacspeak@xxxxxxxxxxx
- Resent-Message-ID: <"izTvG.A.PvG.dp5N7"@hub>
- Resent-Sender: emacspeak-request@xxxxxxxxxxx
this patch does not solve the underlying reason why
emacspeak goes through the trouble of making sure the user
doesn't run emacs in multibyte mode.
1) TTS engines barf on multibyte input at present.
2) There are portions of emacspeak s own
internals (modules emacspeak-speak.el, dtk-speak.el and
dtk-tcl.el)
that have unibyte dependencies
Without the above being fixed --(and I dont plan to spend
energy fixing 2 while there is no solution to 1)--
there is no point in allowing the average user to run emacspeak
under multibyte emacs.
For cases where the user actually knows what he is doing,
e.g., Japanese Emacspeak --which I assumes handles
multibyte,
I expect that those versions will invoke emacs in multibyte
mode.
So the patch below is mostly meaningless since all it does
is to carefully undo the protection that was put into
emacspeak to avoid problems mentioned with running speech
with multibyte.
>>>>> "Milan" == Milan Zamazal <pdm@xxxxxxxxxxx> writes:
Milan> In the Free-b-software project, we have problems
Milan> with handling 8-bit characters in Emacspeak. I
Milan> suggest the following patch (attached below) to
Milan> solve the problems.
Milan> The patch does basically the following things:
Milan> - It defines a new variable `emacspeak-unibyte-p'
Milan> that is initially set to nil if your language
Milan> environment is English or to t otherwise.
Milan> - Depending on the value of the variable, Emacs
Milan> tries to work in either unibyte with 8-bit
Milan> characters disabled (as it did before) or in
Milan> multibyte handling the 8-bit characters properly.
Milan> With that patch, you should be able to run
Milan> Emacspeak in the multibyte mode with your 8-bit
Milan> language environment without problems. The only
Milan> problem I know of is that if you're using a
Milan> system keyboard (not the Emacs one based on
Milan> Quail), then Emacspeak speaks the 8-bit character
Milan> being input in its octal representation.
Milan> Note: To run Emacspeak in the 8-bit mode, it's
Milan> necessary NOT to run it via the `emacspeak' shell
Milan> script or you must run the script with the
Milan> `--multibyte' option.
Milan> diff -cr emacspeak-14.0.orig/lisp/dtk-tcl.el
Milan> emacspeak-14.0/lisp/dtk-tcl.el ***
Milan> emacspeak-14.0.orig/lisp/dtk-tcl.el Fri May 4
Milan> 16:36:43 2001 --- emacspeak-14.0/lisp/dtk-tcl.el
Milan> Wed Jun 13 21:37:21 2001 *************** ***
Milan> 301,307 **** "Handle control characters in speech
Milan> stream." (declare (special
Milan> dtk-character-to-speech-table
Milan> dtk-speak-nonprinting-chars)) ! (let ((specials
Milan> "[\000-\037\177-\377]") (char nil)) (goto-char
Milan> (point-min )) (when dtk-speak-nonprinting-chars
Milan> --- 301,309 ---- "Handle control characters in
Milan> speech stream." (declare (special
Milan> dtk-character-to-speech-table
Milan> dtk-speak-nonprinting-chars)) ! (let ((specials
Milan> (if emacspeak-unibyte-p ! "[\000-\037\177-\377]"
Milan> ! "[\000-\037]")) (char nil)) (goto-char
Milan> (point-min )) (when dtk-speak-nonprinting-chars
Milan> diff -cr
Milan> emacspeak-14.0.orig/lisp/emacspeak-advice.el
Milan> emacspeak-14.0/lisp/emacspeak-advice.el ***
Milan> emacspeak-14.0.orig/lisp/emacspeak-advice.el Fri
Milan> May 4 16:36:43 2001 ---
Milan> emacspeak-14.0/lisp/emacspeak-advice.el Wed Jun
Milan> 13 23:49:53 2001 *************** *** 825,839 ****
Milan> (dtk-speak (format "%s" ad-return-value)))
Milan> ad-return-value))
Milan> (defadvice read-key-sequence(around emacspeak
Milan> pre act ) "Prompt using speech as well. " ! (let
Milan> ((prompt (ad-get-arg 0))) ! (when prompt
Milan> (tts-with-punctuations "all" (dtk-speak prompt)))
Milan> ad-do-it ! (tts-with-punctuations "all" !
Milan> (dtk-speak (format "%s" ad-return-value)))
Milan> ad-return-value))
Milan> (defadvice read-string(around emacspeak pre act
Milan> ) --- 825,842 ---- (dtk-speak (format "%s"
Milan> ad-return-value))) ad-return-value))
Milan> + (defvar quail-translating nil) (defadvice
Milan> read-key-sequence(around emacspeak pre act )
Milan> "Prompt using speech as well. " ! (let ((prompt
Milan> (ad-get-arg 0)) ! (in-quail-p
Milan> quail-translating)) ! (when (and prompt (not
Milan> in-quail-p)) (tts-with-punctuations "all"
Milan> (dtk-speak prompt))) ad-do-it ! (unless
Milan> in-quail-p ! (tts-with-punctuations "all" !
Milan> (dtk-speak (format "%s" ad-return-value))))
Milan> ad-return-value))
Milan> (defadvice read-string(around emacspeak pre act
Milan> ) diff -cr emacspeak-14.0.orig/lisp/emacspeak.el
Milan> emacspeak-14.0/lisp/emacspeak.el ***
Milan> emacspeak-14.0.orig/lisp/emacspeak.el Fri May 4
Milan> 16:36:59 2001 ---
Milan> emacspeak-14.0/lisp/emacspeak.el Wed Jun 13
Milan> 21:39:24 2001 *************** *** 87,92 **** ---
Milan> 87,97 ---- (defvar emacspeak-startup-hook nil
Milan> "Hook to run after starting emacspeak." )
Milan> + (defvar emacspeak-unibyte-p (string= (downcase
Milan> current-language-environment) + "english") + "If
Milan> non-nil, Emacspeak will use unibyte mode. + It
Milan> also won't send non-ASCII characters to the
Milan> speach device directly.") + ;;}}} ;;{{{
Milan> Emacspeak:
Milan> *************** *** 262,267 **** --- 267,274 ----
Milan> emacspeak-play-program emacspeak-sounds-directory
Milan> emacspeak-emacs-commands-to-fix)) + ;; set
Milan> unibyte or multibyte + (setq
Milan> default-enable-multibyte-characters (not
Milan> emacspeak-unibyte-p))
Milan> (emacspeak-export-environment) (require
Milan> 'dtk-speak) (dtk-initialize) *************** ***
Milan> 282,289 **** emacspeak-emacs-commands-to-fix)
Milan> (run-hooks 'emacspeak-startup-hook)
Milan> (emacspeak-dtk-sync) - ;;; force unibyte - (setq
Milan> default-enable-multibyte-characters nil)
Milan> (emacspeak-setup-programming-modes) (message
Milan> (format " Press %s to get an overview of
Milan> emacspeak %s \ --- 289,294 ---- ***************
Milan> *** 618,624 **** (declare (special
Milan> emacspeak-directory emacspeak-play-program
Milan> emacspeak-sounds-directory)) ! (setenv
Milan> "EMACS_UNIBYTE" "1") (setenv "EMACSPEAK_DIR"
Milan> emacspeak-directory) (setenv
Milan> "EMACSPEAK_SOUNDS_DIR"
Milan> emacspeak-sounds-directory) (setenv
Milan> "EMACSPEAK_PLAY_PROGRAM" emacspeak-play-program)
Milan> --- 623,630 ---- (declare (special
Milan> emacspeak-directory emacspeak-play-program
Milan> emacspeak-sounds-directory)) ! (when
Milan> emacspeak-unibyte-p ! (setenv "EMACS_UNIBYTE"
Milan> "1")) (setenv "EMACSPEAK_DIR"
Milan> emacspeak-directory) (setenv
Milan> "EMACSPEAK_SOUNDS_DIR"
Milan> emacspeak-sounds-directory) (setenv
Milan> "EMACSPEAK_PLAY_PROGRAM" emacspeak-play-program)
Milan> Milan Zamazal
Milan> -- When you're in a fight with an idiot, it's
Milan> difficult for other people to tell which one the
Milan> idiot is. -- Bruce Perens in debian-devel
--
Best Regards,
--raman
Email: raman@xxxxxxxxxxx
WWW: http://www.cs.cornell.edu/home/raman/
PGP: http://www.cs.cornell.edu/home/raman/raman.asc
-----------------------------------------------------------------------------
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "emacspeak-request@xxxxxxxxxxx" with a
subject of "unsubscribe" or "help"
Emacspeak Files |
Subscribe |
Unsubscribe | Search