speechd-el-2.6/ 0000755 0001750 0001750 00000000000 12206216327 011515 5 ustar pdm pdm speechd-el-2.6/ANNOUNCE 0000644 0001750 0001750 00000003737 12206216327 012660 0 ustar pdm pdm speechd-el 2.6 released
=======================
The Free(b)soft project is pleased to announce speechd-el 2.6.
* What is speechd-el?
speechd-el is an Emacs client to speech synthesizers, Braille displays
and other alternative output interfaces. It provides full speech and
Braille output environment for Emacs using the Speech Dispatcher and
BRLTTY backends. It is focused especially on (but not limited to) the
blind and visually impaired users. It allows the user to work with
Emacs without looking on the screen, by listening to speech output
produced by the speech synthesizers supported in Speech Dispatcher and
watching Braille output on Braille displays supported by BRLTTY.
Key speechd-el features are:
- Speech output and Braille input/output.
- Automated "intelligent" reading of most Emacs messages and actions.
Additional commands for explicit reading.
- Message priorities, voice parameter changes, sound icons and other
features provided by Speech Dispatcher.
- Multilingual support.
- Almost no change of the standard Emacs behavior, no interference
with user settings.
- Highly configurable.
- Possibility to add support for other alternative output methods.
- Elisp libraries for generic speech, Braille and other kinds of
output as well as for alternative user interface programming.
- Small code size.
- 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 .
* What is new in the 2.6 version?
** Minor bug fixes.
Thanks to Kevin Ryde for identifying the bugs.
** Packaging support.
* Where to get it?
You can get the distribution tarball of the released version from
http://devel.freebsoft.org/pub/projects/speechd-el/speechd-el-2.6.tar.gz .
The home page of the project is http://devel.freebsoft.org/speechd-el .
Local Variables:
fill-column: 72
End:
speechd-el-2.6/COPYING 0000644 0001750 0001750 00000104513 12206216327 012554 0 ustar pdm pdm GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
speechd-el-2.6/Makefile 0000644 0001750 0001750 00000004203 12206216327 013154 0 ustar pdm pdm # Makefile for speechd-el
# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Brailcom, o.p.s.
# Copyright (C) 2012, 2013 Milan Zamazal
# COPYRIGHT NOTICE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
EMACS = emacs
NAME = speechd-el
VERSION = 2.6
DISTDIR = $(NAME)-$(VERSION)
TARFILE = $(NAME)-$(VERSION).tar
.PHONY: all compile install install-strip uninstall \
clean distclean mostlyclean maintainer-clean TAGS info dvi dist check
all: compile info
compile: braille.elc brltty.elc mmanager.elc speechd.elc speechd-braille.elc \
speechd-brltty.elc speechd-bug.elc speechd-common.elc \
speechd-out.elc speechd-speak.elc speechd-ssip.elc
%.elc: %.el
$(EMACS) --batch -l speechd-compile.el -f speechd-compile --kill
install:
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
mostlyclean:
rm -f *.aux *.cp *.cps *.fn *.ky *.log *.pg *.toc *.tp *.vr *~
clean: mostlyclean
rm -f *.dvi *.elc speechd-el.pdf *.ps
distclean: clean
rm -rf $(DISTDIR) $(TARFILE)* *.orig *.rej TAGS
maintainer-clean: distclean
rm -f *.info* dir
TAGS:
etags *.el
doc: info pdf
info: speechd-el.info dir
%.info: %.texi
makeinfo $<
dir: speechd-el.info
install-info $< dir
info-cs: speechd-el.cs.info
pdf: speechd-el.pdf
%.pdf: %.texi
texi2pdf $<
ps: speechd-el.ps
%.ps: %.texi
texi2ps $<
dist: maintainer-clean info
mkdir $(DISTDIR)
chmod 755 $(DISTDIR)
install -m 644 `find . -maxdepth 1 -type f -name '[a-zA-Z]*'` \
$(DISTDIR)
(cd $(DISTDIR); $(MAKE) distclean)
tar cvf $(TARFILE) $(DISTDIR)
gzip -9 $(TARFILE)
check:
speechd-el-2.6/NEWS 0000644 0001750 0001750 00000014401 12206216327 012214 0 ustar pdm pdm User-visible changes to speechd-el:
* Changes in speechd-el 2.6
** Minor bug fixes.
Thanks to Kevin Ryde for identifying the bugs.
** Packaging support.
* Changes in speechd-el 2.5
This is a maintenance release, primarily fixing problems with newer Emacs
versions.
* Changes in speechd-el 2.4
** Support for new Speech Dispatcher autospawn mechanism.
speechd-el uses Speech Dispatcher autospawn feature by default, see
`speechd-autospawn' user option.
** Support for new Unix socket communication with Speech Dispatcher.
Unix socket communication is used by default, see `speechd-connection-method'
user option.
** Isearch reading adjustments.
** New user option speechd-speak-echo.
It allows you to set what speechd-el speaks when you type characters.
* Changes in speechd-el 2.3
** Buffer names in speechd-speak-connections are regexps now.
** Braille key handling improvements.
** Automatic restarts of broken SSIP and BrlAPI connections.
* Changes in speechd-el 2.2
** Support for new BrlAPI protocol introduced in BRLTTY 3.8.
speechd-el now works with BRLTTY 3.8 final version and BRLTTY 3.9.
Additionally BRLTTY error reporting cleanup was made.
** New BRLTTY key handler for general character input.
New macro `speechd-brltty-command-key-function' is provided to assign actions
to Braille display general input keys, such as letters.
** New command speechd-set-synthesizer-voice.
It allows setting speech synthesizer voice directly by its name. Note this
only works with Speech Dispatcher 0.6.3 or higher.
** Moved to GPL3.
* Changes in speechd-el 2.1
** Invisible text is no longer read.
** Support for BRLTTY 3.8.
BRLTTY uses 64-bit key codes. They are represented as two-number lists in
speechd-braille-key-functions.
** WINDOWPATH BRLTTY environment variable is recognized.
The WINDOWSPATH environment variable should be named WINDOWPATH now.
This speechd-el version uses whichever of those two is defined.
* Changes in speechd-el 2.0
** Output mechanism modularized.
speechd-el is output device independent now, it no longer depends on speech
output and SSIP. It is now possible (and sufficiently simple) to add new
output modules for alternative output devices, such as Braille displays, etc.
** BRLTTY input/output added.
speechd-el now supports Braille output to BRLTTY with basically the same
functionality as in the speech output. It is possible to use speech output,
Braille output, or both. You can use sophisticated speechd-el features such as
message priorities and text property handling instead of screen reading.
Additionally it is possible to bind functions to the Braille display keys.
** Braille display emulator added.
There is another output module available: Braille display emulator in an Emacs
buffer. Useful only for development purposes.
** Message manager added.
Message manager for managing messages and priorities was added. It works in a
way similar to the Speech Dispatcher message mechanism.
* Changes in speechd-el 1.0
** The top customization group is called speechd-el now.
* Changes in speechd-el 0.5
** Messages from built-in functions can be read now.
** New user option speechd-speak-message-time-interval.
It allows you to control speaking of repeated messages.
** Mode line can be read in CVS versions of Emacs.
See the command speechd-speak-read-mode-line bound to the `C-e RET' key.
** New commands providing basic information about current environment.
Type `C-e C-i C-h' to see the list of those commands.
** Some state changes can be automatically reported now.
See the variable speechd-speak-state-changes.
** The SPEECHD_HOST environment variable is honored now.
** Changes in communication with Speech Dispatcher.
Former socket based asynchronous communication with Speech Dispatcher was
unreliable and could cause errors in some situations. This has been fixed for
CVS Emacs versions. In Emacs 21.3, two alternative workarounds are available:
either one-way communication with Speech Dispatcher (the default) or using the
spdsend utility (if the speechd-spdsend variable is set).
** speechd-connection-parameters removed.
This obsolete variable is no longer available, use speechd-connection-voices
instead.
* Changes in speechd-el 0.4
** Whitespace signalization added.
It allows you, among others, to distinguish between empty lines and lines
containing only whitespace.
** Repetition of last speakings possible in character reading prompts.
For instance, it is possible to repeat Ispell choices in ispell-word now.
** Language selection based on currently selected input method is possible.
See the new variable speechd-speak-input-method-languages.
** Asynchronous action handling reworked.
The former mechanism of speaking in asynchronous actions, such as process
outputs or timers, was broken. It should be fixed now.
** Responsiveness improved.
speechd-el is now much more responsive when speaking many small pieces of text.
* Changes in speechd-el 0.3
** Connection parameters are handled in a different way.
Connection parameters are configured as voices in the speechd-voices variable
now. Each specific voice can then be assigned to a connection or face, see the
variables speechd-connection-voices and speechd-face-voices. The variable
speechd-connection-parameters is obsoleted and shouldn't be used anymore.
** Bug reporting changes.
Bug reproduction finishing key was changed from `C-e C-z' to `C-e C-f'.
New command speechd-bug-reproduce allowing to reproduce a bug any time.
Log extraction speed up.
** Volume setting added.
You can use the `C-e d V' command with Speech Dispatcher 0.3 or higher to
adjust speech volume.
** The *Completion* buffer is spoken now.
** You can shut up speechd-el in debugger.
See the new variable speechd-speak-in-debugger.
* Changes in speechd-el 0.2
** read-event prompts are spoken now.
** Spelling support added.
You can now use speechd-speak-spell-mode to enable spelling in a buffer or the
`C-e C-l' keys to cause the next command to spell the text it reads.
** Choosing widget values improved.
The variable widget-menu-minibuffer-flag is now automatically set to t when
speechd-speak-mode is enabled, thus the widget value is chosen using usual
minibuffer completions.
** Bug reproduction finishing key was changed from `C-e .' to `C-e C-z'.
Local variables:
mode: outline
end:
speechd-el-2.6/README 0000644 0001750 0001750 00000005452 12206216327 012403 0 ustar pdm pdm speechd-el is an Emacs client to speech synthesizers, Braille displays and
other alternative output interfaces. It provides full speech and Braille output
environment for Emacs.
It is aimed primarily at visually impaired users who need non-visual
communication with Emacs, but it can be used by anybody who needs sophisticated
speech or other kind of alternative output from Emacs. speechd-el can make
Emacs a completely speech and BRLTTY enabled application suitable for visually
impaired users or, depending on its configuration, it can only speak in certain
situations or when asked, to serve needs of any Emacs user.
For more information about speechd-el features see the Texinfo manual or the
project web page http://www.freebsoft.org/speechd-el (you can also find some
comparison with Emacspeak there).
Installation:
- If you use Emacs older than 23.2 then install the `eieio' Elisp library,
available from http://cedet.sourceforge.net/eieio.shtml or perhaps from your
favorite operating system distribution.
- Copy the speechd-el *.el files somewhere to your Emacs load path. This may
be typically the directory /usr/local/share/emacs/site-lisp/.
- It is recommended to byte compile the *.el files, otherwise you may
experience performance problems. You can compile the files by running
make compile
Then copy the resulting *.elc files to your Emacs path as described in the
previous step.
- Make sure all the installed files are world-readable at their target
location, e.g.
cd /usr/local/share/emacs/site-lisp
chmod 755 *.el *.elc
- If you want to build online manual, run
make info
You need makeinfo from Texinfo package for this. Then you can install the
resulting *.info files by copying them to the location where *.info files
reside on your system (typically /usr/share/info) and editing `dir' file
there. Alternatively you can open the manual directly in Emacs using
`C-u C-h i'.
In case you'd like to print the manual, run
make pdf
You need Texinfo to produce PDF version of the manual.
- Add the following line to your ~/.emacs:
(autoload 'speechd-speak "speechd-speak" nil t)
- Install the `speechd-log-extractor' script somewhere to your shell PATH (this
step is optional, the script is used only for bug reporting).
- Start Speech Dispatcher and/or BRLTTY.
- Start Emacs and call the commands
M-x speechd-speak RET
In case you do not use both speech and braille outputs and you'd like to get
rid of the corresponding error messages, customize the variable
speechd-out-active-drivers.
Now, your Emacs should speak and/or output to your Braille display.
See the Texinfo manual for complete documentation.
You can send bug reports, patches, suggestions, etc. to the mailing list
speechd@lists.freebsoft.org.
-- Milan Zamazal
speechd-el-2.6/braille.el 0000644 0001750 0001750 00000010703 12206216327 013452 0 ustar pdm pdm ;;; braille.el --- Simple Emacs braille display emulator
;; Copyright (C) 2004 Brailcom, o.p.s.
;; Copyright (C) 2012 Milan Zamazal
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Commentary:
;;; Code:
(eval-when-compile
(require 'cl))
(defvar braille-buffer-name "*braille-monitor*")
(defvar braille-table
'((? . ())
(?! . (2 3 4 6))
(?\" . (5))
(?# . (3 4 5 6))
(?$ . (1 2 4 6))
(?% . (1 4 6))
(?& . (1 2 3 4 6))
(?' . (3))
(?\( . (1 2 3 5 6))
(?\) . (2 3 4 5 6))
(?* . (1 6))
(?+ . (3 4 6))
(?, . (6))
(?- . (3 6))
(?. . (4 6))
(?/ . (3 4))
(?0 . (3 5 6))
(?1 . (2))
(?2 . (2 3))
(?3 . (2 5))
(?4 . (2 5 6))
(?5 . (2 6))
(?6 . (2 3 5))
(?7 . (2 3 5 6))
(?8 . (2 3 6))
(?9 . (3 5))
(?0 . (1 5 6))
(?\; . (5 6))
(?< . (1 2 6))
(?= . (1 2 3 4 5 6))
(?> . (3 4 5))
(?? . (1 4 5 6))
(?@ . (4 7))
(?A . (1 7))
(?B . (1 2 7))
(?C . (1 4 7))
(?D . (1 4 5 7))
(?E . (1 5 7))
(?F . (1 2 4 7))
(?G . (1 2 4 5 7))
(?H . (1 2 5 7))
(?I . (2 4 7))
(?J . (2 4 5 7))
(?K . (1 3 7))
(?L . (1 2 3 7))
(?M . (1 3 4 7))
(?N . (1 3 4 5 7))
(?O . (1 3 5 7))
(?P . (1 2 3 4 7))
(?Q . (1 2 3 4 5 7))
(?R . (1 2 3 5 7))
(?S . (2 3 4 7))
(?T . (2 3 4 5 7))
(?U . (1 3 6 7))
(?V . (1 2 3 6 7))
(?W . (2 4 5 6 7))
(?X . (1 3 4 6 7))
(?Y . (1 3 4 5 6 7))
(?Z . (1 3 5 6 7))
(?\[ . (2 4 6 7))
(?\\ . (1 2 5 6 7))
(?\] . (1 2 4 5 6 7))
(?^ . (4 5 7))
(?_ . (4 5 6))
(?` . (4))
(?a . (1))
(?b . (1 2))
(?c . (1 4))
(?d . (1 4 5))
(?e . (1 5))
(?f . (1 2 4))
(?g . (1 2 4 5))
(?h . (1 2 5))
(?i . (2 4))
(?j . (2 4 5))
(?k . (1 3))
(?l . (1 2 3))
(?m . (1 3 4))
(?n . (1 3 4 5))
(?o . (1 3 5))
(?p . (1 2 3 4))
(?q . (1 2 3 4 5))
(?r . (1 2 3 5))
(?s . (2 3 4))
(?t . (2 3 4 5))
(?u . (1 3 6))
(?v . (1 2 3 6))
(?w . (2 4 5 6))
(?x . (1 3 4 6))
(?y . (1 3 4 5 6))
(?z . (1 3 5 6))
(?{ . (2 4 6))
(?| . (1 2 5 6))
(?} . (1 2 4 5 6))
(?~ . (4 5))
(t . (4 5 6 7)))
"Alist mapping characters to braille codes.
Each braille code is represented by a list of numbers idenitifying the dot
positions.
The entry with the symbol t as its car maps to the default code to display
instead of undefined characters.")
(define-derived-mode braille-display-mode fundamental-mode "Braille"
"Mode for displaying braille display emulator."
(setq buffer-read-only t)
(setq truncate-lines t)
(set (make-local-variable 'speechd-speak-mode) nil))
(defun braille-display (string &optional cursor-position)
(with-current-buffer (get-buffer-create braille-buffer-name)
(braille-display-mode)
(let ((inhibit-read-only t))
(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 " "))
(when cursor-position
(if (= cursor-position 0)
(setq code (cons 8 code)
cursor-position nil)
(decf cursor-position)))
(flet ((display-dot (dot)
(end-of-line)
(insert (if (member dot code) "o" " ") suffix)
(forward-line)))
(goto-char (point-min))
(mapc #'display-dot '(1 2 3 7))
(goto-char (point-min))
(let ((suffix " "))
(mapc #'display-dot '(4 5 6 8)))))
(goto-char (point-max))
(insert (format " %c " c)))
(when (equal cursor-position 0)
(end-of-line -1)
(insert " o")))))
;;; Announce
(provide 'braille)
;;; braille.el ends here
speechd-el-2.6/brltty.el 0000644 0001750 0001750 00000053045 12206216327 013366 0 ustar pdm pdm ;;; brltty.el --- Interface to BRLTTY
;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Brailcom, o.p.s.
;; Copyright (C) 2012 Milan Zamazal
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Commentary:
;;; Code:
(require 'cl)
(require 'speechd-common)
;;; User configuration and commands
(defgroup brltty ()
"BRLTTY interface."
:group 'speechd-el)
(defcustom brltty-default-host "localhost"
"Default BRLTTY host to connect to."
:type 'string
:group 'brltty)
(defcustom brltty-default-port '(4101 4102 4103 4104 35751)
"Default BRLTTY port to connect to.
If it is a list, the given port numbers are attempted in the order they are
given until Emacs connects to something."
:type 'integer
:group 'brltty)
(defcustom brltty-authentication-file "/etc/brlapi.key"
"File containing the BrlAPI authentication key."
:type '(file :must-match t)
:group 'brltty)
(defcustom brltty-coding 'iso-8859-1
"Coding in which texts should be sent to BRLTTY."
:type 'coding-system
:group 'brltty)
(defcustom brltty-tty (car (read-from-string
(or (let ((value (ignore-errors
(shell-command-to-string "xprop -root XFree86_VT"))))
(and value
(string-match "= *\\([0-9]+\\)" value)
(match-string 1 value)))
(getenv "CONTROLVT")
"0")))
"Number of the Linux console on which brltty.el runs.
The default value is taken from the XFree86_VT root window property or, if not
available, from the environment variable CONTROLVT."
:type 'integer
:group 'brltty)
(defcustom brltty-timeout 3
"Maximum number of seconds to wait for a BRLTTY answer."
:type 'integer
:group 'brltty)
;;; Internal functions and data
(defconst brltty--emacs-accept-ok
(condition-case _ (progn (accept-process-output nil 0 0 1) t) (error)))
(defconst brltty--emacs-process-ok (fboundp 'process-put))
(defconst brltty--supported-protocol-versions '(8 7))
(defconst brltty--protocol-version-error 13)
(defconst brltty--errors
'((1 . "Not enough memory")
(2 . "A connection is already running in this tty")
(3 . "A connection is already using RAW or suspend mode")
(4 . "Not implemented in protocol")
(5 . "Forbiden in current mode")
(6 . "Out of range or have no sense")
(7 . "Invalid size")
(8 . "Connection refused")
(9 . "Operation not supported")
(10 . "Getaddrinfo error")
(11 . "Libc error")
(12 . "Couldn't find out the tty number")
(13 . "Bad protocol version")
(14 . "Unexpected end of file")
(15 . "Key file empty")
(16 . "Packet returned by driver too large")
(17 . "Authentication failed")))
(defconst brltty--packet-types
'(;; commands
(version . ?v)
(auth . ?a)
(authkey . ?K) ; protocol version < 8
(gettty . ?t)
(leavetty . ?L)
(getdisplaysize . ?s)
(write . ?w)
(ignorekeyranges . ?m)
(acceptkeyranges . ?u)
;; answers
(ack . ?A)
(err . ?e)
(key . ?k)))
(defconst brltty--authentication-codes
'((?N . none)
(?K . key)
(?C . credentials)))
(defun brltty--add-answer (connection answer)
(setf (brltty--connection-answers connection)
(append (brltty--connection-answers connection) (list answer)))
answer)
(defun brltty--next-answer (connection)
(pop (brltty--connection-answers connection)))
(defstruct brltty--connection
process
(protocol-version nil)
(display-width nil)
(output "")
(key-handler nil)
(answers '())
(terminal-spec nil))
(unless brltty--emacs-process-ok
(defvar brltty--process-connections '()))
(lexical-let ((last-selected-frame 'uninitialized)
(last-terminal-spec 'uninitialized))
(defun brltty--terminal-spec ()
(if (eq (selected-frame) last-selected-frame)
last-terminal-spec
(prog1 (setq last-terminal-spec (brltty--terminal-spec*))
(setq last-selected-frame (selected-frame))))))
(defun brltty--terminal-spec* ()
(let ((terminal-spec '()))
(cond
((or (getenv "WINDOWPATH")
(getenv "WINDOWSPATH"))
(save-match-data
(dolist (number (split-string (or (getenv "WINDOWPATH")
(getenv "WINDOWSPATH"))
":"))
(push (string-to-number number) terminal-spec))))
((eq window-system 'x)
(push brltty-tty terminal-spec)))
(cond
((eq window-system 'x)
(push (string-to-number (frame-parameter (selected-frame) 'outer-window-id)) terminal-spec))
((getenv "WINDOWID")
(push (string-to-number (getenv "WINDOWID")) terminal-spec))
((file-readable-p "/proc/self/stat")
(with-temp-buffer
(let ((standard-input (current-buffer)))
(push (or (ignore-errors
(with-speechd-coding-protection
(insert-file-contents "/proc/self/stat")
(goto-char (point-min))
(dotimes (_ 6) (read))
(let ((tty (read)))
(if (and tty (= (/ tty 256) 4)) ; major
(mod tty 256) ; minor
0))))
0)
terminal-spec))))
(t
(push 0 terminal-spec)))
(nreverse terminal-spec)))
(defun brltty--open-connection (host port key-handler)
(let ((process nil)
(ports (or port brltty-default-port))
(host* (or host brltty-default-host)))
(unless (consp ports)
(setq ports (list port)))
(while (and (not process)
ports)
(condition-case err
(setq process (open-network-stream "brltty" nil host* (car ports)))
(error
(if (cdr ports)
(setq ports (cdr ports))
(signal (car err) (cdr err))))))
(when process
(set-process-coding-system process 'binary 'binary)
(if (fboundp 'set-process-query-on-exit-flag)
(set-process-query-on-exit-flag process nil)
(set-process-query-on-exit-flag process nil))
(let ((connection (make-brltty--connection :process process
:key-handler key-handler)))
(if brltty--emacs-process-ok
(process-put process 'brltty-connection connection)
(push (cons process connection) brltty--process-connections))
(set-process-filter process #'brltty--process-filter)
connection))))
(defun brltty--process-connection (process)
(if brltty--emacs-process-ok
(process-get process 'brltty-connection)
(cdr (assq process brltty--process-connections))))
(defun brltty--disable-connection (connection error)
(let ((process (brltty--connection-process connection)))
(when process
(delete-process process)
(setf (brltty--connection-process connection) nil)))
(error "Error in communication with BRLTTY: %s" error))
(defun brltty--process-filter* (process output)
(let ((connection (brltty--process-connection process)))
(setf (brltty--connection-output connection)
(concat (brltty--connection-output connection) output))))
(defun brltty--process-filter (process output)
(set-process-filter process #'brltty--process-filter*)
(unwind-protect
(let ((connection (brltty--process-connection process)))
(brltty--process-filter* process output)
(while (not (string= (brltty--connection-output connection) ""))
(brltty--read-input connection)))
(set-process-filter process #'brltty--process-filter)))
(defun brltty--accept-process-output (process)
(if brltty--emacs-accept-ok
(accept-process-output process brltty-timeout nil 1)
(accept-process-output process brltty-timeout)))
(defun brltty--read-integer (string)
(+ (* 256 256 256 (aref string 0)) (* 256 256 (aref string 1))
(* 256 (aref string 2)) (aref string 3)))
(defun brltty--read-integer64 (string)
(list
(+ (* 256 (aref string 0)) (aref string 1))
(+ (* 256 256 (aref string 2)) (* 256 (aref string 3)) (aref string 4))
(+ (* 256 256 (aref string 5)) (* 256 (aref string 6)) (aref string 7))))
(defun brltty--read-packet (connection)
(condition-case err
(let ((process (brltty--connection-process connection)))
(flet ((read-enough-output (size)
(while (< (length (brltty--connection-output connection)) size)
(brltty--accept-process-output process)))
(read-integer ()
(let ((output (brltty--connection-output connection)))
(prog1 (brltty--read-integer output)
(setf (brltty--connection-output connection)
(substring output 4))))))
(read-enough-output 8)
(let* ((size (read-integer))
(type (car (rassoc (read-integer) brltty--packet-types)))
(data (progn
(read-enough-output size)
(let ((output (brltty--connection-output connection)))
(setf (brltty--connection-output connection)
(substring output size))
(substring output 0 size)))))
(cons type data))))
(error
(brltty--disable-connection connection err))))
(defun brltty--read-input (connection)
(destructuring-bind (type . data) (brltty--read-packet connection)
(case type
(err
(let ((err-number (brltty--read-integer data)))
(if (= err-number brltty--protocol-version-error)
(brltty--add-answer connection (list type err-number))
(error (format "BRLTTY error %d: %s"
err-number (cdr (assoc err-number brltty--errors)))))))
(key
(let ((handler (brltty--connection-key-handler connection)))
(when handler
(funcall handler
(funcall (if (> (length data) 4)
#'brltty--read-integer64
#'brltty--read-integer)
data)))))
(authkey
(let ((version (brltty--read-integer (substring data 0 4)))
(auth-methods '())
(len (length data))
(n 4))
(while (< n len)
(push (cdr (assoc (brltty--read-integer (substring data n (+ n 4)))
brltty--authentication-codes))
auth-methods)
(setq n (+ n 4)))
(brltty--add-answer connection (list type version auth-methods))))
(auth
(let ((auth-methods '())
(len (length data))
(n 0))
(while (< n len)
(push (cdr (assoc (brltty--read-integer (substring data n (+ n 4)))
brltty--authentication-codes))
auth-methods)
(setq n (+ n 4)))
(brltty--add-answer connection (cons type auth-methods))))
(version
(let ((version (brltty--read-integer (substring data 0 4))))
(brltty--add-answer connection (list type version))))
(nil
;; unknown packet type -- ignore
)
(getdisplaysize
(brltty--add-answer connection
(list type
(brltty--read-integer (substring data 0 4))
(brltty--read-integer (substring data 4 8)))))
(t
(brltty--add-answer connection (list type data))))))
(defun brltty--read-answer (connection packet-id &optional none-ok)
(let ((process (brltty--connection-process connection))
(answer '(nothing-yet)))
(while (and answer (not (eq (car answer) packet-id)))
;; The answer may be already present in answers
(setq answer (brltty--next-answer connection))
(unless answer
(brltty--accept-process-output process)
(setq answer (brltty--next-answer connection))))
(when (and (not answer) (not none-ok))
(error "BRLTTY answer not received"))
(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))))))
(process (brltty--connection-process connection)))
(when process
(with-speechd-coding-protection
(condition-case err
(flet ((send-integer (n)
(process-send-string
process
(string-make-unibyte
(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)))))))
(send-integer length)
(send-integer (cdr (assoc packet-id brltty--packet-types)))
(dolist (data data-list)
(cond
((integerp data)
(send-integer data))
((vectorp data)
(dotimes (i (length data))
(process-send-string
process
(string-make-unibyte (format "%c" (aref data i))))))
((consp data)
(destructuring-bind (n1 n2 n3) (cdr data)
(ecase (car data)
(integer64
(process-send-string
process
(string-make-unibyte (format "%c%c%c%c%c%c%c%c"
(/ n1 256) (% n1 256)
(/ n2 (* 256 256)) (% (/ n2 256) 256) (% n2 256)
(/ n3 (* 256 256)) (% (/ n3 256) 256) (% n3 256))))))))
(t
(process-send-string process data))))
(when answer
(brltty--read-answer connection answer)))
(error
(brltty--disable-connection connection err)))))))
(defun brltty--authentication-key ()
(with-temp-buffer
(insert-file-contents brltty-authentication-file)
(buffer-substring (point-min) (point-max))))
(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)
(when orig-terminal-spec
(brltty--send-packet connection 'ack 'leavetty))
(apply 'brltty--send-packet
(append (list connection 'ack 'gettty (length terminal-spec))
terminal-spec
(list [0])))
(setf (brltty--connection-terminal-spec connection) terminal-spec))))
;;; Public functions and data
(put 'brltty-connection-error 'error-conditions
'(error speechd-connection-error brltty-connection-error))
(put 'brltty-connection-error 'error-message
"Error on opening BRLTTY connection")
(defun brltty-open (&optional host port key-handler)
"Open and return connection to a BRLTTY server running on HOST and PORT.
If HOST or PORT is nil, `brltty-default-host' or `brltty-default-port' is used
respectively."
(condition-case err
;; 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))
7)))
(if (> version 7)
(progn
(unless (member version brltty--supported-protocol-versions)
(setq version (apply 'max brltty--supported-protocol-versions)))
(let ((auth-methods (brltty--send-packet connection 'auth 'version version)))
(cond
((memq 'none auth-methods)
(brltty--send-packet
connection 'ack 'auth
(car (rassoc 'none brltty--authentication-codes))))
((memq 'key auth-methods)
(brltty--send-packet
connection 'ack 'auth
(car (rassoc 'key brltty--authentication-codes))
(brltty--authentication-key)))
(t
(signal 'brltty-connection-error
"No supported BrlAPI authentication method")))))
;; No server initial message, assume protocol version 7 (older
;; versions are not supported)
(let ((answer (brltty--send-packet
connection 'ack 'authkey version
(brltty--authentication-key))))
(when (equal answer brltty--protocol-version-error)
(signal 'brltty-error answer))))
(setf (brltty--connection-protocol-version connection) version)
(brltty--update-terminal-spec connection)
connection)
(error
(signal 'brltty-connection-error err))))
(defun brltty-close (connection)
"Close BRLTTY CONNECTION."
(when connection
(when (brltty--connection-terminal-spec connection)
(brltty--send-packet connection 'ack 'leavetty))
(let ((process (brltty--connection-process connection)))
(unless brltty--emacs-process-ok
(setq brltty--process-connections
(remove (assq process brltty--process-connections)
brltty--process-connections)))
(when process
(delete-process process)))))
(defun brltty-display-size (connection)
"Return the size of the display as the list (WIDTH HEIGHT)."
(when connection
(or (brltty--connection-display-width connection)
(let ((size (brltty--send-packet connection 'getdisplaysize
'getdisplaysize)))
;; BrlAPI may report zero size when the display is off.
;; We shouldn't return nor cache such a value.
(when (> (car size) 0)
(setf (brltty--connection-display-width connection) size))))))
(defun brltty-write (connection text &optional cursor)
"Display TEXT in BRLTTY accessed through CONNECTION.
TEXT is encoded in the coding given by `brltty-coding' before it is sent.
CURSOR, if non-nil, is a position of the cursor on the display, starting
from 0."
(when connection
(let ((display-width (car (brltty-display-size connection))))
(when display-width
(let* ((text* (if (> (length text) display-width)
(substring text 0 display-width)
;; We must be careful with FORMAT because of formatting
;; of TAB characters
(concat text
(format
(format "%%-%ds" (- display-width
(length text)))
""))))
(protocol-version (brltty--connection-protocol-version connection))
(text-coding brltty-coding)
(encoded-text (with-speechd-coding-protection
(encode-coding-string text* text-coding)))
(arguments (list connection nil 'write
(if (< protocol-version 8) 38 102)
1 display-width
(length encoded-text) encoded-text
;; Cursor position may not be too high,
;; otherwise BRLTTY breaks the connection
(if cursor
(1+ (min cursor display-width))
0))))
(when (>= protocol-version 8)
(let ((charset (symbol-name text-coding)))
(setf arguments (append arguments (list (vector (length charset)) (upcase charset))))))
(apply #'brltty--send-packet arguments))))))
(defun brltty-ignore-keys (connection)
"Let BrlTTY handle all keys itself."
(when connection
(brltty--send-packet connection nil 'ignorekeyranges '(integer64 0 0 0) '(integer64 #xFFFF #xFFFFFF #xFFFFFF))))
(defun brltty-accept-keys (connection &optional keys)
"Let BrlTTY send all keys to us.
If optional argument KEYS is non-nil, allow to send us only the given keys.
Then KEYS must be a list of key codes represented by integer triplets."
(when connection
(let ((key-ranges (if keys
(mapcar #'(lambda (key) (cons (cons 'integer64 key) (cons 'integer64 key))) keys)
(list (cons '(integer64 0 0 0) '(integer64 #xFFFF #xFFFFFF #xFFFFFF))))))
(dolist (range key-ranges)
(brltty--send-packet connection nil 'acceptkeyranges (car range) (cdr range))))))
;;; Announce
(provide 'brltty)
;;; brltty.el ends here
speechd-el-2.6/fdl.texi 0000644 0001750 0001750 00000050543 12206216327 013164 0 ustar pdm pdm @display
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@end display
@enumerate 0
@item
PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document @dfn{free} in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of ``copyleft'', which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
@item
APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The ``Document'', below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as ``you''. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A ``Modified Version'' of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A ``Secondary Section'' is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The ``Invariant Sections'' are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The ``Cover Texts'' are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A ``Transparent'' copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not ``Transparent'' is called ``Opaque''.
Examples of suitable formats for Transparent copies include plain
@sc{ascii} without markup, Texinfo input format, La@TeX{} input
format, @acronym{SGML} or @acronym{XML} using a publicly available
@acronym{DTD}, and standard-conforming simple @acronym{HTML},
PostScript or @acronym{PDF} designed for human modification. Examples
of transparent image formats include @acronym{PNG}, @acronym{XCF} and
@acronym{JPG}. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, @acronym{SGML} or
@acronym{XML} for which the @acronym{DTD} and/or processing tools are
not generally available, and the machine-generated @acronym{HTML},
PostScript or @acronym{PDF} produced by some word processors for
output purposes only.
The ``Title Page'' means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, ``Title Page'' means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section ``Entitled XYZ'' means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as ``Acknowledgements'',
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
of such a section when you modify the Document means that it remains a
section ``Entitled XYZ'' according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
@item
VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
@item
COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
@item
MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
@enumerate A
@item
Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
@item
List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
@item
State on the Title page the name of the publisher of the
Modified Version, as the publisher.
@item
Preserve all the copyright notices of the Document.
@item
Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
@item
Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
@item
Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
@item
Include an unaltered copy of this License.
@item
Preserve the section Entitled ``History'', Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled ``History'' in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
@item
Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the ``History'' section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
@item
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
@item
Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
@item
Delete any section Entitled ``Endorsements''. Such a section
may not be included in the Modified Version.
@item
Do not retitle any existing section to be Entitled ``Endorsements'' or
to conflict in title with any Invariant Section.
@item
Preserve any Warranty Disclaimers.
@end enumerate
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled ``Endorsements'', provided it contains
nothing but endorsements of your Modified Version by various
parties---for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
@item
COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled ``History''
in the various original documents, forming one section Entitled
``History''; likewise combine any sections Entitled ``Acknowledgements'',
and any sections Entitled ``Dedications''. You must delete all
sections Entitled ``Endorsements.''
@item
COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
@item
AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an ``aggregate'' if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
@item
TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled ``Acknowledgements'',
``Dedications'', or ``History'', the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
@item
TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
@item
FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
@uref{http://www.gnu.org/copyleft/}.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License ``or any later version'' applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
@end enumerate
@page
@appendixsubsec ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
@smallexample
@group
Copyright (C) @var{year} @var{your name}.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
@end group
@end smallexample
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the ``with...Texts.'' line with this:
@smallexample
@group
with the Invariant Sections being @var{list their titles}, with
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
being @var{list}.
@end group
@end smallexample
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
@c Local Variables:
@c ispell-local-pdict: "ispell-dict"
@c End:
speechd-el-2.6/gpl.texi 0000644 0001750 0001750 00000104416 12206216327 013200 0 ustar pdm pdm @c The GNU General Public License.
@c @center Version 3, 29 June 2007
@c This file is intended to be included within another document,
@c hence no sectioning command or @node.
@display
Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
@end display
@heading Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program---to make sure it remains
free software for all its users. We, the Free Software Foundation,
use the GNU General Public License for most of our software; it
applies also to any other work released this way by its authors. You
can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the freedom
of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too,
receive or can get the source code. And you must show them these
terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with the
aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products. If such problems arise substantially in
other domains, we stand ready to extend this provision to those
domains in future versions of the GPL, as needed to protect the
freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish
to avoid the special danger that patents applied to a free program
could make it effectively proprietary. To prevent this, the GPL
assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
@heading TERMS AND CONDITIONS
@enumerate 0
@item Definitions.
``This License'' refers to version 3 of the GNU General Public License.
``Copyright'' also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
``The Program'' refers to any copyrightable work licensed under this
License. Each licensee is addressed as ``you''. ``Licensees'' and
``recipients'' may be individuals or organizations.
To ``modify'' a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a ``modified version'' of
the earlier work or a work ``based on'' the earlier work.
A ``covered work'' means either the unmodified Program or a work based
on the Program.
To ``propagate'' a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To ``convey'' a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
An interactive user interface displays ``Appropriate Legal Notices'' to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
@item Source Code.
The ``source code'' for a work means the preferred form of the work for
making modifications to it. ``Object code'' means any non-source form
of a work.
A ``Standard Interface'' means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The ``System Libraries'' of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
``Major Component'', in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The ``Corresponding Source'' for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
@item Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
@item Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
@item Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
@item Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
@enumerate a
@item
The work must carry prominent notices stating that you modified it,
and giving a relevant date.
@item
The work must carry prominent notices stating that it is released
under this License and any conditions added under section 7. This
requirement modifies the requirement in section 4 to ``keep intact all
notices''.
@item
You must license the entire work, as a whole, under this License to
anyone who comes into possession of a copy. This License will
therefore apply, along with any applicable section 7 additional terms,
to the whole of the work, and all its parts, regardless of how they
are packaged. This License gives no permission to license the work in
any other way, but it does not invalidate such permission if you have
separately received it.
@item
If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your work
need not make them do so.
@end enumerate
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
``aggregate'' if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
@item Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
@enumerate a
@item
Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium customarily
used for software interchange.
@item
Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a written
offer, valid for at least three years and valid for as long as you
offer spare parts or customer support for that product model, to give
anyone who possesses the object code either (1) a copy of the
Corresponding Source for all the software in the product that is
covered by this License, on a durable physical medium customarily used
for software interchange, for a price no more than your reasonable
cost of physically performing this conveying of source, or (2) access
to copy the Corresponding Source from a network server at no charge.
@item
Convey individual copies of the object code with a copy of the written
offer to provide the Corresponding Source. This alternative is
allowed only occasionally and noncommercially, and only if you
received the object code with such an offer, in accord with subsection
6b.
@item
Convey the object code by offering access from a designated place
(gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to copy
the object code is a network server, the Corresponding Source may be
on a different server (operated by you or a third party) that supports
equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source.
Regardless of what server hosts the Corresponding Source, you remain
obligated to ensure that it is available for as long as needed to
satisfy these requirements.
@item
Convey the object code using peer-to-peer transmission, provided you
inform other peers where the object code and Corresponding Source of
the work are being offered to the general public at no charge under
subsection 6d.
@end enumerate
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A ``User Product'' is either (1) a ``consumer product'', which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
``normally used'' refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
``Installation Information'' for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
@item Additional Terms.
``Additional permissions'' are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
@enumerate a
@item
Disclaiming warranty or limiting liability differently from the terms
of sections 15 and 16 of this License; or
@item
Requiring preservation of specified reasonable legal notices or author
attributions in that material or in the Appropriate Legal Notices
displayed by works containing it; or
@item
Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
@item
Limiting the use for publicity purposes of names of licensors or
authors of the material; or
@item
Declining to grant rights under trademark law for use of some trade
names, trademarks, or service marks; or
@item
Requiring indemnification of licensors and authors of that material by
anyone who conveys the material (or modified versions of it) with
contractual assumptions of liability to the recipient, for any
liability that these contractual assumptions directly impose on those
licensors and authors.
@end enumerate
All other non-permissive additional terms are considered ``further
restrictions'' within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
@item Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
@item Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
@item Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An ``entity transaction'' is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
@item Patents.
A ``contributor'' is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's ``contributor version''.
A contributor's ``essential patent claims'' are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, ``control'' includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a ``patent license'' is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To ``grant'' such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. ``Knowingly relying'' means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is ``discriminatory'' if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
@item No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey
a covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree
to terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
@item Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
@item Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License ``or any later version'' applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If
the Program does not specify a version number of the GNU General
Public License, you may choose any version ever published by the Free
Software Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
@item Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
@item Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
@item Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
@end enumerate
@heading END OF TERMS AND CONDITIONS
@heading How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the ``copyright'' line and a pointer to where the full notice is found.
@smallexample
@var{one line to give the program's name and a brief idea of what it does.}
Copyright (C) @var{year} @var{name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see @url{http://www.gnu.org/licenses/}.
@end smallexample
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
@smallexample
@var{program} Copyright (C) @var{year} @var{name of author}
This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}.
This is free software, and you are welcome to redistribute it
under certain conditions; type @samp{show c} for details.
@end smallexample
The hypothetical commands @samp{show w} and @samp{show c} should show
the appropriate parts of the General Public License. Of course, your
program's commands might be different; for a GUI interface, you would
use an ``about box''.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a ``copyright disclaimer'' for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
@url{http://www.gnu.org/licenses/}.
The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use
the GNU Lesser General Public License instead of this License. But
first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}.
speechd-el-2.6/mmanager.el 0000644 0001750 0001750 00000022205 12206216327 013627 0 ustar pdm pdm ;;; mmanager.el --- Message manager
;; Copyright (C) 2004, 2005 Brailcom, o.p.s.
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Code:
(require 'cl)
;;; User customization
(defgroup message-manager ()
"Message queue management."
:group 'speechd-el)
(defcustom mmanager-history-size 12
"Maximum number of message stored in the message history."
:type 'integer
:group 'message-manager)
;;; Data structures
(defstruct mmanager--manager
(queue '())
(current-message nil)
(message-blocks '())
(paused nil)
(last-group nil)
display-f
stop-f
pause-f
resume-f
busy-f
properties
(history '())
(history-cursor nil))
(defstruct mmanager--message
messages
priority
client
group)
;;; Calls to the driver functions
(defun mmanager--busy (manager)
(funcall (mmanager--manager-busy-f manager) manager))
(defun mmanager--stop (manager)
(when (mmanager--busy manager)
(funcall (mmanager--manager-stop-f manager) manager)))
(defun mmanager--pause (manager)
(when (and (mmanager--busy manager)
(not (mmanager--manager-paused manager)))
(funcall (mmanager--manager-pause-f manager) manager))
(setf (mmanager--manager-paused manager) t))
(defun mmanager--resume (manager)
(when (mmanager--manager-paused manager)
(funcall (mmanager--manager-resume-f manager) manager)
(setf (mmanager--manager-paused manager) nil)))
(defun mmanager--display (manager message)
(when message
(mmanager--add-history manager message)
(funcall (mmanager--manager-display-f manager) manager message)))
;;; Utility functions
(defun mmanager--make-message (message priority client group)
(make-mmanager--message :messages (and message (list message))
:priority priority :client client :group group))
(defun mmanager--current-priority (manager)
(let ((current (mmanager--manager-current-message manager)))
(and current (mmanager--message-priority current))))
(defun mmanager--client-block (manager client)
(cdr (assoc client (mmanager--manager-message-blocks manager))))
;;; Queue management
(defun mmanager--prune-queue (manager condition)
(setf (mmanager--manager-queue manager)
(remove-if condition (mmanager--manager-queue manager))))
(defun mmanager--update-queue (manager message* priority)
(let* ((queue (mmanager--manager-queue manager))
(last (car (last queue))))
(when (and last
(eq (mmanager--message-priority last) 'progress)
(not (eq priority 'important)))
(setf (mmanager--message-priority last) 'message))
(setf (mmanager--manager-queue manager)
(if (eq priority 'important)
(labels ((add (list)
(if (and list
(eq (mmanager--message-priority (car list))
'important))
(cons (car list) (add (cdr list)))
(cons message* (cdr list)))))
(add queue))
(append queue (list message*))))))
(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))))))
(mmanager--update-queue manager message* priority)
(mmanager-next manager)))
(defun mmanager--add-history (manager message)
(let ((history (mmanager--manager-history manager)))
(when (= (length history) mmanager-history-size)
(setq history (cdr history)))
(setf (mmanager--manager-history manager) (append history (list message)))
(setf (mmanager--manager-history-cursor manager) message)))
;;; Public functions
(defun mmanager-create (display-f stop-f pause-f resume-f busy-f)
(make-mmanager--manager :display-f display-f :stop-f stop-f
:pause-f pause-f :resume-f resume-f :busy-f busy-f))
(defun mmanager-next (manager)
(let* ((current (mmanager--manager-current-message manager))
(messages (and current (mmanager--message-messages current))))
(if messages
(let ((m (car messages))
(g (mmanager--message-group current)))
(when (or (not (mmanager--busy manager))
(and g (eq g (mmanager--manager-last-group manager))))
(mmanager--display manager m)
(setf (mmanager--manager-last-group manager) g)
(setf (mmanager--message-messages current) (cdr messages))
(mmanager-next manager)))
(let* ((queue (mmanager--manager-queue manager))
(message (car queue)))
(if (and message
(mmanager--manager-paused manager)
(not (eq (mmanager--message-priority message) 'important)))
(mmanager--resume manager)
(setf (mmanager--manager-queue manager) (cdr queue))
(setf (mmanager--manager-current-message manager) message)
(when message
(mmanager-next manager)))))))
(defun mmanager-cancel (manager client)
(mmanager--stop manager)
(mmanager--prune-queue manager
(if client
#'(lambda (m)
(string= (mmanager--message-client m) client))
#'identity))
(setf (mmanager--manager-current-message manager) nil)
(dolist (block% (mmanager--manager-message-blocks manager))
(setcdr block% 'canceled)))
(defun mmanager-enqueue (manager client message priority &optional group)
(let ((message-block (and message (mmanager--client-block manager client))))
(if message-block
(unless (eq message-block 'canceled)
(setf (mmanager--message-messages message-block)
(append (mmanager--message-messages message-block)
(list message)))
(when group
(setf (mmanager--message-group message-block) group)))
(mmanager--enqueue*
manager (mmanager--make-message message priority client group)
priority))))
(defun mmanager-start-block (manager client priority)
(unless (mmanager--client-block manager client)
(push (cons client (mmanager--make-message nil priority client nil))
(mmanager--manager-message-blocks manager))))
(defun mmanager-finish-block (manager client)
(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=))
(unless (eq message 'canceled)
(mmanager--enqueue* manager message
(mmanager--message-priority message))))))
(defun mmanager-get (manager property)
(plist-get (mmanager--manager-properties manager) property))
(defun mmanager-put (manager property value)
(setf (mmanager--manager-properties manager)
(plist-put (mmanager--manager-properties manager) property value)))
(defun mmanager-history (manager which)
(let ((history (mmanager--manager-history manager))
(cursor (mmanager--manager-history-cursor manager)))
(ecase which
(current
(find cursor history :test #'eq))
(next
(let ((next (rest (member* cursor history :test #'eq))))
(when next
(setf (mmanager--manager-history-cursor manager) (first next)))))
(previous
(let ((pos (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)))
(last
(setf (mmanager--manager-history-cursor manager)
(car (last history)))))))
;;; Announce
(provide 'mmanager)
;;; mmanager.el ends here
speechd-el-2.6/speechd-braille.el 0000644 0001750 0001750 00000014616 12206216327 015072 0 ustar pdm pdm ;;; speechd-braille.el --- Emacs braille emulator driver
;; Copyright (C) 2004, 2005, 2006, 2008 Brailcom, o.p.s.
;; Copyright (C) 2012 Milan Zamazal
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Code:
(require 'eieio)
(require 'braille)
(require 'mmanager)
(require 'speechd-common)
(require 'speechd-out)
(defgroup speechd-braille ()
"speechd-el Braille output."
:group 'speechd-el)
(defcustom speechd-braille-display-time 3
"How many seconds to display a message before displaying the next one."
:type 'number
:group 'speechd-braille)
(defvar speechd-braille--vetoed-icons '("message"))
(defvar speechd-braille--paused-messages '())
(defvar speechd-braille--last-message nil)
(defvar speechd-braille--last-message-time 0)
(defvar speechd-braille--display-timer nil)
(defun speechd-braille--time ()
(funcall (if (fboundp 'time-to-seconds)
#'time-to-seconds
;; taken from time-date.el
#'(lambda (time)
(+ (* (car time) 65536.0)
(cadr time)
(/ (or (nth 2 time) 0) 1000000.0))))
(current-time)))
(defun speechd-braille--display (manager message &optional sticky)
(speechd-braille--stop manager)
(apply (mmanager-get manager 'braille-display) message)
(setq speechd-braille--last-message message)
(setq speechd-braille--last-message-time (speechd-braille--time))
(unless sticky
(setq speechd-braille--display-timer
(run-at-time speechd-braille-display-time nil
#'mmanager-next manager))))
(defun speechd-braille--stop (manager)
(when speechd-braille--display-timer
(cancel-timer speechd-braille--display-timer))
(setq speechd-braille--display-timer nil))
(defun speechd-braille--pause (manager)
(push speechd-braille--last-message speechd-braille--paused-messages))
(defun speechd-braille--resume (manager)
(let ((message (pop speechd-braille--paused-messages)))
(when message
(speechd-braille--display manager message))))
(defun speechd-braille--busy (manager)
(and speechd-braille--display-timer
(< (- (speechd-braille--time) speechd-braille--last-message-time)
speechd-braille-display-time)))
(defun speechd-braille--create-manager (display-func)
(let ((manager (mmanager-create display-func
#'speechd-braille--stop
#'speechd-braille--pause
#'speechd-braille--resume
#'speechd-braille--busy)))
(mmanager-put manager 'braille-display #'braille-display)
manager))
(defun speechd-braille--maybe-enqueue (driver text message)
(with-slots (manager priority) driver
(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))
(unless (string= text "")
(mmanager-enqueue manager speechd-client-name message priority)))))
;;; Interface functions
(defclass speechd-braille-emu-driver (speechd-driver)
((name :initform 'braille-emu)
(manager)
(priority)))
(defmethod initialize-instance :after
((this speechd-braille-emu-driver) slots)
(progn
(oset this priority speechd-default-text-priority)
(oset this manager (speechd-braille--create-manager #'speechd-braille--display))))
(defmethod speechd-braille--make-message
((driver speechd-braille-emu-driver) text cursor)
(list text cursor))
(defmethod speechd.cancel ((driver speechd-braille-emu-driver) all)
(mmanager-cancel (slot-value driver 'manager) speechd-client-name))
(defmethod speechd.stop ((driver speechd-braille-emu-driver) all)
(mmanager-next (slot-value driver 'manager)))
(defmethod speechd.pause ((driver speechd-braille-emu-driver) all)
;; do nothing
)
(defmethod speechd.resume ((driver speechd-braille-emu-driver) all)
;; do nothing
)
(defmethod speechd.repeat ((driver speechd-braille-emu-driver))
;; do nothing
)
(defmethod speechd.block ((driver speechd-braille-emu-driver) function)
(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)))
(defmethod speechd.text ((driver speechd-braille-emu-driver) text cursor)
(speechd-braille--maybe-enqueue
driver text (speechd-braille--make-message driver text cursor)))
(defmethod speechd.icon ((driver speechd-braille-emu-driver) icon)
(unless (member icon speechd-braille--vetoed-icons)
(speechd-braille--maybe-enqueue
driver icon (speechd-braille--make-message driver icon nil))))
(defmethod speechd.char ((driver speechd-braille-emu-driver) char)
(let ((text (char-to-string char)))
(speechd-braille--maybe-enqueue
driver text (speechd-braille--make-message driver text nil))))
(defmethod speechd.key ((driver speechd-braille-emu-driver) key)
(let ((key-string (if (numberp key) (key-description (list key)) (format "%s" key))))
(speechd-braille--maybe-enqueue
driver key-string (speechd-braille--make-message driver key-string nil))))
(defmethod speechd.set ((driver speechd-braille-emu-driver) parameter value)
(when (eq parameter 'priority)
(setf (slot-value driver 'priority) value)))
(defmethod speechd.shutdown ((driver speechd-braille-emu-driver))
;; do nothing
)
(speechd-out-register-driver (make-instance 'speechd-braille-emu-driver))
;;; Announce
(provide 'speechd-braille)
;;; speechd-braille.el ends here
speechd-el-2.6/speechd-brltty.el 0000644 0001750 0001750 00000024255 12206216327 015000 0 ustar pdm pdm ;;; speechd-brltty.el --- BRLTTY output driver
;; Copyright (C) 2004, 2005, 2006, 2008 Brailcom, o.p.s.
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Commentary:
;;; Code:
(eval-when-compile
(require 'cl))
(require 'brltty)
(require 'mmanager)
(require 'speechd-braille)
;;; User configuration
(defcustom speechd-braille-key-functions
'((1 . speechd-brltty-previous-message)
((0 32 1) . speechd-brltty-previous-message)
(2 . speechd-brltty-next-message)
((0 32 2) . speechd-brltty-next-message)
(11 . speechd-brltty-last-message)
((0 32 25) . speechd-brltty-last-message)
(12 . speechd-brltty-first-message)
((0 32 26) . speechd-brltty-first-message)
(23 . speechd-brltty-scroll-left)
((0 32 23) . speechd-brltty-scroll-left)
(24 . speechd-brltty-scroll-right)
((0 32 24) . speechd-brltty-scroll-right)
(25 . speechd-brltty-scroll-to-bol)
((0 32 27) . speechd-brltty-scroll-to-bol)
(26 . speechd-brltty-scroll-to-eol)
((0 32 28) . speechd-brltty-scroll-to-bol)
(29 . speechd-brltty-scroll-to-cursor)
((0 32 29) . speechd-brltty-scroll-to-cursor)
(8204 . speechd-brltty-finish-message)
((0 32 72) . speechd-brltty-finish-message)
(8205 . speechd-brltty-cancel)
((0 32 71) . speechd-brltty-cancel))
"Alist of Braille display key codes and corresponding Emacs functions.
If the given key is pressed, the corresponding function is called with a
`speechd-brltty-driver' instance as its single argument.
Please note the functions may be called asynchronously any time. So they
shouldn't modify current environment in any inappropriate way. Especially, it
is not recommended to assign or call user commands here."
:type '(alist :key-type (sexp :tag "Key code") :value-type function)
:group 'speechd-braille)
(defcustom speechd-braille-show-unknown-keys t
"If non-nil, show Braille keys not assigned in `speechd-braille-key-functions'."
:type 'boolean
:group 'speechd-braille)
;;; Driver utilities
(defun speechd-brltty--create-manager ()
(let ((manager (speechd-braille--create-manager #'speechd-brltty--display)))
(mmanager-put manager 'braille-display #'brltty-write)
manager))
(defvar speechd-brltty--retry-time 1.0)
(defun speechd-brltty--connection (driver &optional dont-open)
(let ((connection (slot-value driver 'brltty-connection))
(connection-error nil))
(when (or (eq connection 'uninitialized)
(and (not connection)
(> (- (float-time) (slot-value driver 'brltty-last-try-time))
speechd-brltty--retry-time)))
(let ((first-time (eq connection 'uninitialized)))
(if dont-open
(setq connection nil)
(lexical-let ((driver driver))
(setq connection (condition-case err
(brltty-open
nil nil
(lambda (key)
(speechd-brltty--handle-key driver key)))
(brltty-connection-error
(setq connection-error err)
nil))))
(setf (slot-value driver 'brltty-connection) connection)
(when (and connection-error first-time)
(signal (car connection-error) (cdr connection-error)))
(speechd-brltty--ignore-most-keys connection))))
connection))
(defun speechd-brltty--display (manager message &optional scroll)
(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))
(mmanager-put manager 'scrolling
(* (/ cursor display-width) display-width))
(setq scroll t))
(if scroll
(let ((scrolling (mmanager-get manager 'scrolling)))
(setq text (substring text scrolling))
(when cursor
(setq cursor (- cursor scrolling))
(when (or (< cursor 0) (> cursor display-width))
(setq cursor nil))))
(mmanager-put manager 'scrolling 0)))
(speechd-braille--display manager (list connection text cursor)))))
;;; Braille key handling
(defun speechd-brltty--handle-key (driver key)
(let ((function (cdr (assoc key speechd-braille-key-functions))))
(cond
(function
(funcall function driver))
(speechd-braille-show-unknown-keys
(message "Braille key pressed: %s" key)))))
(defun speechd-brltty-finish-message (driver)
"Stop displaying the current message and display the next one."
(let ((manager (slot-value driver 'manager)))
(speechd-braille--stop manager)
(mmanager-next manager)))
(defun speechd-brltty-scroll-left (driver &optional bolp)
"Scroll towards the beginning of the currently displayed message."
(let* ((manager (slot-value driver 'manager))
(scrolling (mmanager-get manager 'scrolling)))
(when (and scrolling (> scrolling 0))
(speechd-braille--stop manager)
(mmanager-put manager 'scrolling
(if bolp
0
(max (- scrolling (or (car (brltty-display-size connection)) 0))
0)))
(speechd-brltty--display manager (mmanager-history manager 'current) t))))
(defun speechd-brltty-scroll-to-bol (driver)
"Scroll to the beginning of the currently displayed message."
(speechd-brltty-scroll-left driver t))
(defun speechd-brltty-scroll-right (driver &optional eolp)
"Scroll towards the end of the currently displayed message."
(let* ((manager (slot-value driver 'manager))
(scrolling (mmanager-get manager 'scrolling))
(message (mmanager-history manager 'current)))
(when scrolling
(speechd-braille--stop manager)
(destructuring-bind (connection text cursor) message
(let ((display-width (or (car (brltty-display-size connection)) 0)))
(when display-width
(setq scrolling (if eolp
(max (- (length text) display-width) 0)
(+ scrolling display-width))))
(when (< scrolling (length text))
(mmanager-put manager 'scrolling scrolling))))
(speechd-brltty--display manager message t))))
(defun speechd-brltty-scroll-to-eol (driver)
"Scroll to the end of the currently displayed message."
(speechd-brltty-scroll-right driver t))
(defmacro speechd-brltty--message-from-history (which)
`(let* ((manager (slot-value driver 'manager))
(message (mmanager-history manager ,which)))
(when message
(speechd-brltty--display manager message))))
(defun speechd-brltty-scroll-to-cursor (driver)
"Scroll to the cursor position (if any) in the displayed message."
(speechd-brltty--message-from-history 'current))
(defun speechd-brltty-previous-message (driver)
"Display the previous message from the history."
(speechd-brltty--message-from-history 'previous))
(defun speechd-brltty-next-message (driver)
"Display the next message from the history."
(speechd-brltty--message-from-history 'next))
(defun speechd-brltty-first-message (driver)
"Display the first message in the history."
(speechd-brltty--message-from-history 'first))
(defun speechd-brltty-last-message (driver)
"Display the last message in the history."
(speechd-brltty--message-from-history 'last))
(defun speechd-brltty-cancel (driver)
"Discard all messages from the display queue."
(speechd.cancel driver 'all))
(defun speechd-brltty-command-key (driver key)
"Put given key to the command queue."
(setq unread-command-events (append unread-command-events (list key))))
(defmacro speechd-brltty-command-key-function (key)
"Insert BRLTTY function handling general character KEY event."
`(lambda (driver) (speechd-brltty-command-key driver ,key)))
(defun speechd-brltty--ignore-most-keys (connection)
(brltty-ignore-keys connection)
(when speechd-braille-key-functions
(brltty-accept-keys connection
(mapcar (lambda (key-spec)
(let ((key (car key-spec)))
(when (numberp key)
(setq key (list 0 0 key)))
key))
speechd-braille-key-functions))))
;;; Driver definition, methods and registration
(defclass speechd-brltty-driver (speechd-braille-emu-driver)
((name :initform 'brltty)
(manager)
(brltty-connection :initform 'uninitialized)
(brltty-last-try-time :initform 0)))
(defmethod initialize-instance :after
((this speechd-brltty-driver) slots)
(oset this manager (speechd-brltty--create-manager)))
(defmethod speechd-braille--make-message
((driver speechd-brltty-driver) text message)
(list (speechd-brltty--connection driver) text message))
(defmethod speechd.set ((driver speechd-brltty-driver) parameter value)
(cond
((eq parameter 'brltty-accept-keys)
(let ((connection (speechd-brltty--connection driver)))
(when connection
(funcall (if value 'brltty-accept-keys 'speechd-brltty--ignore-most-keys) connection))))
(t
(call-next-method))))
(defmethod speechd.shutdown ((driver speechd-brltty-driver))
(mmanager-cancel (slot-value driver 'manager) nil)
(brltty-close (speechd-brltty--connection driver t))
(setf (slot-value driver 'brltty-connection) 'uninitialized))
(speechd-out-register-driver (make-instance 'speechd-brltty-driver))
;;; Announce
(provide 'speechd-brltty)
;;; speechd-brltty.el ends here
speechd-el-2.6/speechd-bug.el 0000644 0001750 0001750 00000023371 12206216327 014233 0 ustar pdm pdm ;;; speechd-bug.el --- reporting speechd-el and speechd bugs
;; Copyright (C) 2003, 2004, 2005 Brailcom, o.p.s.
;; Copyright (C) 2012 Milan Zamazal
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Code:
(eval-when-compile (require 'cl))
(require 'speechd-speak)
(defvar speechd-bug--log-extractor "speechd-log-extractor")
(defvar speechd-bug--finish-repro-key "\C-f")
(defvar speechd-bug-packages
'(("festival-czech") ("festival-freebsoft-utils") ("sbts")
("speech-dispatcher") ("speechd-el") ("unknown")))
(defvar speechd-bug--repro-id nil)
(defvar speechd-bug--marker nil)
(defvar speechd-bug--dribble-file nil)
;;; Utility functions
(defun speechd-bug--ensure-empty-line ()
(goto-char (point-min))
(while (not (re-search-forward "\n\n\\'" nil t))
(goto-char (point-max))
(insert "\n")
(goto-char (point-min))))
(defun speechd-bug--insert (&rest args)
(goto-char (point-max))
(unless (looking-at "^")
(insert "\n")
(goto-char (point-max)))
(apply #'insert args)
(goto-char (point-max))
(insert "\n")
(goto-char (point-max)))
(defun speechd-bug--look-for-file (file directories)
(let ((found nil))
(while (and (not found) directories)
(let ((file-name (concat (car directories) "/" file)))
(if (file-readable-p file-name)
(setq found file-name)
(setq directories (cdr directories)))))
found))
;;; General information insertion
(defun speechd-bug--insert-program-version (program)
(speechd-bug--ensure-empty-line)
(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)
(speechd-bug--ensure-empty-line)
(speechd-bug--insert "===" file ":begin===")
(let ((file-name
(or (speechd-bug--look-for-file file directories)
(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)
point (point-max-marker)))
(speechd-bug--insert "---not-found---")))
(speechd-bug--insert "===" file ":end==="))
(defun speechd-bug--insert-general-info ()
(dolist (p '("speech-dispatcher" "festival"))
(speechd-bug--insert-program-version p))
(speechd-bug--insert-config-file
"speechd.conf" '("/etc/speechd" "/etc/speech-dispatcher") "#")
(speechd-bug--insert-config-file
"festival.conf" '("/etc/speechd/modules" "/etc/speech-dispatcher/modules")
"#")
(speechd-bug--insert-config-file "festival.scm" '("/etc") ";"))
(defun speechd-bug--insert-dribble-file ()
(speechd-bug--ensure-empty-line)
(speechd-bug--insert "===dribble:begin===")
(insert-file-contents speechd-bug--dribble-file)
(speechd-bug--insert "===dribble:end===")
(delete-file speechd-bug--dribble-file)
(setq speechd-bug--dribble-file nil))
;;; Log insertion
(defun speechd-bug--insert-log-file (file-name)
(speechd-bug--ensure-empty-line)
(speechd-bug--insert "===" file-name ":logbegin===")
(shell-command
(format "%s on%s off%s --compress < %s | uuencode %s.compressed"
speechd-bug--log-extractor speechd-bug--repro-id
speechd-bug--repro-id file-name (file-name-nondirectory file-name))
t)
(speechd-bug--insert "===" file-name ":logend==="))
(defun speechd-bug--dotconf-option (file-name option)
(with-current-buffer (find-file-noselect file-name)
(save-match-data
(goto-char (point-min))
(when (re-search-forward (concat "^[ \t]*" option "[ \t]+\"\\(.*\\)\"")
nil t)
(match-string 1)))))
(defun speechd-bug--insert-logs ()
;; speechd
(let ((file-name (speechd-bug--look-for-file
"speechd.conf"
'("/etc/speechd" "/etc/speech-dispatcher"
"/usr/local/etc/speechd"))))
(when file-name
(dolist (option '("LogFile" "CustomLogFile[ \t]+\"protocol\""))
(let ((f (speechd-bug--dotconf-option file-name option)))
(when f
(save-match-data
(when (string-match "^/" f)
(speechd-bug--insert-log-file f)))))))
;; Festival
(let* ((file-name (speechd-bug--look-for-file
"festival.conf"
'("/etc/speechd/modules"
"/etc/speech-dispatcher/modules"
"/usr/local/etc/speechd/modules")))
(festival-server (or (speechd-bug--dotconf-option
file-name "FestivalServerHost")
"localhost"))
(festival-port (string-to-number
(or (speechd-bug--dotconf-option
file-name "FestivalServerPort")
"1314")))
(festival-module-log (speechd-bug--dotconf-option
file-name "DebugFile")))
(when festival-module-log
(speechd-bug--insert-log-file festival-module-log))
(let ((process (open-network-stream "speechd-festival" nil
festival-server festival-port))
(output "")
(log-file nil))
(when process
(unwind-protect
(progn
(set-process-filter process
#'(lambda (p str)
(setq output (concat output str))))
(process-send-string process "server_log_file\n")
(while output
(if (accept-process-output nil 1)
(save-match-data
(when (string-match "^LP\r?\n\\(.*\\)\n" output)
(setq log-file (match-string 1 output))
(setq output nil)))
(setq output nil))))
(delete-process process))
(save-match-data
(when (and log-file
(string-match "\"\\(/.*\\)\"" log-file))
(speechd-bug--insert-log-file
(concat (match-string 1 log-file) "-e")))))))))
;;; Reproducing bug
(defun speechd-bug--generate-repro-id ()
(let ((time (current-time)))
(format "speechd-el-%d-%d-%d" (first time) (second time) (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.
Bug reproduction is finished by pressing the `C-e C-f' keys. After the bug
reproduction is finished, information about it is inserted into the buffer
where the `speechd-bug-reproduce' command was invoked.
This command is useful when you want to provide information about a bug without
generating new bug report."
(interactive)
(setq speechd-bug--marker (point-marker))
(setq speechd-bug--repro-id (speechd-bug--generate-repro-id))
(speechd-say-sound (concat "_debug_on" speechd-bug--repro-id)
:priority 'important)
(setq speechd-bug--dribble-file (make-temp-file "speechd-bug"))
(open-dribble-file speechd-bug--dribble-file)
(define-key speechd-speak-mode-map speechd-bug--finish-repro-key
'speechd-bug--finish-repro))
(defun speechd-bug--finish-repro ()
"Finish reproducing a bug."
(interactive)
(speechd-say-sound (concat "_debug_off" speechd-bug--repro-id)
:priority 'important)
(define-key speechd-speak-mode-map speechd-bug--finish-repro-key 'undefined)
(sit-for 1) ; wait a little for flushing the logs
(switch-to-buffer (marker-buffer speechd-bug--marker))
(let ((speechd-speak-mode nil))
(speechd-bug--insert-dribble-file)
(speechd-bug--insert-logs))
(goto-char (marker-position speechd-bug--marker))
(setq speechd-bug--marker nil)
(setq speechd-bug--repro-id nil)
(message "OK, now describe the bug and send the mail with C-c C-c."))
;;; The command
;;;###autoload
(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
(format "%s@bugs.freebsoft.org" package)
package
(append '(speechd-speak--debug)
(apropos-internal "^speechd\\(-[a-z]+\\)+$" 'boundp)))
(ignore-errors
(save-excursion
(speechd-bug--insert-general-info)))
(if (y-or-n-p "Can you reproduce the bug now? ")
(progn
(message "Reproduce the bug now and finish it with `%s %s'"
(key-description speechd-speak-prefix)
(key-description speechd-bug--finish-repro-key))
(speechd-bug-reproduce))
(save-excursion
(speechd-bug--ensure-empty-line)
(speechd-bug--insert "The bug was not reproduced."))
(message "Please describe the bug as precisely as possible."))))
;;; Announce
(provide 'speechd-bug)
;;; speechd-bug.el ends here
speechd-el-2.6/speechd-common.el 0000644 0001750 0001750 00000005103 12206216327 014737 0 ustar pdm pdm ;;; speechd-common.el --- Code common to all parts of speechd-el
;; Copyright (C) 2004, 2005, 2008 Brailcom, o.p.s.
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Code:
(defgroup speechd-el ()
"Speechd-el alternative output system."
:group 'environment)
(defcustom speechd-default-text-priority 'text
"Default Speech Dispatcher priority of sent texts."
:type 'speechd-priority-tag
:group 'speechd-el)
(defcustom speechd-default-sound-priority 'message
"Default Speech Dispatcher priority of sent sound icons."
:type 'speechd-priority-tag
:group 'speechd-el)
(defcustom speechd-default-char-priority 'notification
"Default Speech Dispatcher priority of sent single letters."
:type 'speechd-priority-tag
:group 'speechd-el)
(defcustom speechd-default-key-priority 'notification
"Default Speech Dispatcher priority of sent symbols of keys."
:type 'speechd-priority-tag
:group 'speechd-el)
(defvar speechd-client-name "default"
"String defining current client name.
This variable's value defines which connection is used when communicating with
Speech Dispatcher, each connection has its own client name. Usually, you
select the proper client (connection) by assigning a value to this variable
locally through `let'.")
(defvar speechd-language nil
"If non-nil, it is an RFC 1766 language code, as a string.
If text is read and this variable is non-nil, the text is read in the given
language.")
(defun speechd-language (string language)
"Put language property LANGUAGE on whole STRING.
Language should be a string recognizable by Speech Dispatcher as a language
code."
(put-text-property 0 (length string) 'language language string)
string)
(defmacro with-speechd-coding-protection (&rest body)
"Ensure BODY doesn't mess with Emacs dirty coding hacks."
`(let ((last-coding-system-used last-coding-system-used))
,@body))
;;; Announce
(provide 'speechd-common)
;;; speechd-common.el ends here
speechd-el-2.6/speechd-compile.el 0000644 0001750 0001750 00000002310 12206216327 015074 0 ustar pdm pdm ;;; speechd-compile.el --- Maintenance utilities
;; Copyright (C) 2004, 2013 Milan Zamazal
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Code:
(require 'cl)
(defun speechd-compile ()
(let ((load-path (cons default-directory load-path)))
(dolist (file (directory-files "." nil "\\.el$"))
(unless (member file '("speechd-compile.el"
"speechd-el-pkg.el"))
(load file)
(byte-compile-file file)))))
;;; Announce
(provide 'speechd-compile)
;;; speechd-compile.el ends here
speechd-el-2.6/speechd-el.cs.texi 0000644 0001750 0001750 00000162543 12206216327 015040 0 ustar pdm pdm \chyph
\def\fontprefix{cs}
\input texinfo
@comment %**start of header
@setfilename speechd-el.cs.info
@documentlanguage cs
@documentencoding ISO-8859-2
@set VERSION 1.0
@settitle speechd-el @value{VERSION}
@syncodeindex fn cp
@syncodeindex ky cp
@syncodeindex vr cp
@comment %**end of header
@copying
Èeský pøeklad manuálu programu speechd-el, @value{VERSION}.
Copyright @copyright{} 2003, 2004 Brailcom, o.p.s.
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts and no Back-Cover Texts.
A copy of the license is included in the section entitled ``GNU Free
Documentation License.''
@end quotation
You can also (at your option) distribute this manual under the GNU
General Public License:
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
A copy of the license is included in the section entitled ``GNU
General Public License''.
@end quotation
@end copying
@dircategory Sound
@dircategory Emacs
@direntry
* speechd-el cs: (speechd-el.cs). Emacsové rozhraní ke Speech Dispatcher.
@end direntry
@titlepage
@title speechd-el
@subtitle pro verzi @value{VERSION}
@author Milan Zamazal
@author Brailcom, o.p.s.
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@contents
@ifnottex
@node Top, Úvodem, (dir), (dir)
@top speechd-el
@insertcopying
@end ifnottex
@menu
* Úvodem:: K@tie{}èemu je speechd-el a tento manuál?
* U¾ivatelská pøíruèka:: Pou¾ívání øeèového výstupu Emacsu.
* Elispová knihovna:: Pou¾ívání speechd-el v elispových programech.
* Kontaktní informace:: Oznamování chyb atd.
* Kopírování tohoto manuálu:: GNU Free Documentation License.
* Index:: V¹eobjímající index.
@end menu
@c ****************************************************************************
@node Úvodem, U¾ivatelská pøíruèka, Top, Top
@chapter Úvodem
@cindex Speech Dispatcher
speechd-el je emacsový klient ke Speech Dispatcher. Poskytuje
následující funkce:
@itemize @bullet
@item
@cindex SSIP
Elispovou knihovnu pro pøístup ke Speech Dispatcher s@tie{}vyu¾itím
soketové komunikace zalo¾ené na jeho komunikaèním protokolu (SSIP).
@item
Podporu pro øeèový výstup Emacsu, zamìøený zejména na prostøedky
potøebné pro vyu¾ívání Emacsu slepými a tì¾ce zrakovì posti¾enými
u¾ivateli.
@end itemize
Klíèové rysy speechd-el jsou:
@cindex rysy
@itemize @bullet
@item
Podporu pro automatické mluvení, bez nutnosti úprav ka¾dé emacsové
funkce, kterou je potøeba rozmluvit. Vìt¹ina emacsových programù
z@tie{}distribuce Emacsu i@tie{}mimo ni získává øeèový výstup okam¾itì, bez
jakékoliv speciální podpory.
@item
Nejsou provádìny témìø ¾ádné zmìny standardního chování Emacsu a
nedochází ke konfliktùm s@tie{}u¾ivatelskými nastaveními.
@item
Plná spolupráce se Speech Dispatcher.
@item
Malý rozsah kódu.
@end itemize
Manuál popisuje øeèové u¾ivatelské rozhraní, jak si toto rozhraní
pøizpùsobit a roz¹íøit a elispovou knihovnu. Doporuèujeme, aby
u¾ivatel byl èásteènì obeznámen se Speech Dispatcher na u¾ivatelské
úrovni, ale není to nezbytné.
@c ****************************************************************************
@node U¾ivatelská pøíruèka, Elispová knihovna, Úvodem, Top
@chapter U¾ivatelská pøíruèka speechd-el
speechd-el umo¾òuje pou¾ívat Emacs bez zobrazení na monitoru, pouze
jen s@tie{}øeèovým výstupem. Hlavní oblast vyu¾ití je mezi slepci a
zrakovì posti¾enými lidmi, nicménì øeèový výstup mù¾e být u¾iteèný
i@tie{}pro celou øadu dal¹ích vìcí, podle toho co kdo potøebuje.
Nejnovìj¹í verzi speechd-el si mù¾ete stáhnout na
@url{http://www.freebsoft.org/pub/projects/speechd-el/}.
speechd-el pou¾ívá pro øeèový výstup Speech Dispatcher, tak¾e abyste
vùbec nìjaký øeèový výstup sly¹eli, potøebujete mít funkèní instalaci
Speech Dispatcher. V¹echny informace o@tie{}Speech Dispatcher naleznete na
@url{http://www.freebsoft.org/speechd}.
@menu
* Instalace:: Jak speechd-el nainstalovat.
* Spu¹tìní øeèového výstupu:: Jak jej rozmluvit.
* Pøíkazy:: Jak jej pou¾ívat.
* Konfigurace:: Základní konfigurace.
* Pokroèilá konfigurace:: Psaní vlastních reakcí na pøíkazy.
* Potí¾e:: Kdy¾ se speechd-el chová podivnì.
* Tipy:: U¾iteèné emacsové tipy.
* Oznamování chyb:: Chyby speechd-el a Speech Dispatcher.
@end menu
@node Instalace, Spu¹tìní øeèového výstupu, U¾ivatelská pøíruèka, U¾ivatelská pøíruèka
@section Instalace
speechd-el se nainstaluje následujícími kroky:
@enumerate
@item
Zkopírujte v¹echny @file{*.el} soubory z@tie{}distribuèního balíku nìkam do
emacsových adresáøù obsa¾ených v@tie{}cestì va¹eho Emacsu.
@item
Chcete-li, mù¾ete si @file{*.el} soubory zkompilovat. To
doporuèujeme, proto¾e speechd-el bì¾í se zkompilovanými soubory
podstatnì rychleji. Kompilaci mù¾ete provést pøíkazem
@example
make compile
@end example
Poté pøiinstalujte zkompilované soubory do emacsové cesty ke zdrojovým
souborùm speechd-el.
@item
Nainstalujte soubor @file{speechd-log-extractor} do nìkteré
z@tie{}cest obsa¾ených v@tie{}shellové promìnné PATH, napøíklad
do adresáøe @file{/usr/local/bin/}.
@item
Do svého @file{~/.emacs} si pøidejte následující øádek:
@lisp
(autoload 'speechd-speak "speechd-speak" nil t)
@end lisp
@end enumerate
Pro úspì¹ný provoz speechd-el je nutno mít nainstalované a spu¹tìné
Speech Dispatcher. Doporuèená je verze@tie{}0.5 nebo vy¹¹í.
@node Spu¹tìní øeèového výstupu, Pøíkazy, Instalace, U¾ivatelská pøíruèka
@section Spu¹tìní øeèového výstupu
Po instalaci @file{*.el} souborù a restartu Emacsu mù¾ete
inicializovat øeèový výstup prostøednictvím pøíkazu @kbd{M-x
speechd-speak}. Chcete-li, aby se tak dìlo automaticky pøi ka¾dém
startu Emacsu, pøidejte si do svého @file{~/.emacs} následující
øádek, za døíve vlo¾ený øádek s@tie{}@code{autoload}:
@lisp
(speechd-speak)
@end lisp
@table @kbd
@item M-x speechd-speak
@findex speechd-speak
@kindex C-e C-s
Inicializuj Emacs pro øeèový výstup a zaèni mluvit.
Prosím nezapomeòte, ¾e abyste nìco sly¹eli, musíte mít korektnì
nainstalováno Speech Dispatcher!
Po poèáteèním nastavení mù¾e být tento pøíkaz pou¾it znovu, v@tie{}pøípadì
potøeby restartu øeèové podpory. Zejména jej musíte spustit poka¾dé,
kdy¾ je restartováno Speech Dispatcher.
Je-li pøíkaz zavolán s@tie{}prefixovým argumentem, jsou pøed jeho
provedením nejprve uzavøena v¹echna spojení na Speech Dispatcher. To
je u¾iteèné v@tie{}pøípadì, kdy potøebujete zresetovat parametry v¹ech
spojení, viz @ref{Hlasy spojení}.
Po svém prvním zavolání se pøíkaz stane dostupným pod klávesou
@kbd{C-e C-s}.
@end table
@cindex vedlej¹í módy
Poté, co jsou provedena úvodní nastavení, je zapínání a vypínání
øeèového výstupu øízeno vedlej¹ími módy speechd-speak a
global-speechd-speak. Pøíkazy pro pøepínání módù obvykle nejsou
pou¾ívány pøímo, mù¾ete místo nich pou¾ívat pøíkaz
@code{speechd-speak-toggle-speaking} (@pxref{Øídící pøíkazy}), ale
pokud je potøebujete, jsou k@tie{}dispozici.
@table @kbd
@item M-x speechd-speak-mode
@findex speechd-speak-mode
Zapni nebo vypni mluvení v@tie{}aktuálním bufferu. Je-li pøíkaz zavolán
bez prefixového argumentu, pøepne mluvící mód. Nenulový prefixový
argument zapne mluvení, nulový prefixový argument jej vypne.
@item M-x global-speechd-speak-mode
@findex global-speechd-speak-mode
Zapni nebo vypni mluvení globálnì. Je-li pøíkaz zavolán
bez prefixového argumentu, pøepne mluvící mód. S@tie{}prefixovým
argumentem zapne mluvení právì v@tie{}pøípadì, kdy je tento argument kladný.
@end table
@node Pøíkazy, Konfigurace, Spu¹tìní øeèového výstupu, U¾ivatelská pøíruèka
@section Pøíkazy
V¹echny základní pøíkazy speechd-el jsou dostupné pod spoleènou
prefixovou klávesou, kterou je implicitnì @kbd{C-e} (tuto prefixovou
klávesu lze zmìnit, @pxref{Konfigurace}). Jestli¾e je prefixová
klávesa v@tie{}konfliktu s@tie{}nìkterým globálním pøíkazem Emacsu, pùvodní
pøíkaz je dostupný dvojím stiskem prefixové klávesy. Napøíklad
v@tie{}pøípadì implicitního prefixu lze pøíkaz @code{end-of-line}, normálnì
dostupný pod klávesou @kbd{C-e}, vyvolat klávesovou kombinací @kbd{C-e
C-e}.
@menu
* Pøíkazy pro ètení:: Ètení èástí textu.
* Informující pøíkazy:: Informace o bufferu, módech, apod.
* Øídící pøíkazy:: Pøeru¹ení, nastavení rychlosti, apod.
* Pøíkazy nastavující parametry:: Modifikace øeèového výstupu.
* Hláskování:: Jak hláskovat urèitý text.
* Ostatní pøíkazy:: Pomocné pøíkazy.
@end menu
@node Pøíkazy pro ètení, Informující pøíkazy, Pøíkazy, Pøíkazy
@subsection Pøíkazy pro ètení
@table @kbd
@item C-e l
@kindex C-e l
@findex speechd-speak-read-line
Pøeèti aktuální øádek (@code{speechd-speak-read-line}).
S@tie{}prefixovým argumentem pøeèti øádek jen od aktuální pozice
kurzoru do konce øádku.
@item C-e b
@kindex C-e b
@findex speechd-speak-read-buffer
Pøeèti aktuální buffer (@code{speechd-speak-read-buffer}).
@item C-e >
@kindex C-e >
@findex speechd-speak-read-rest-of-buffer
Pøeèti aktuální buffer od pozice kurzoru do konce bufferu
(@code{speechd-speak-read-rest-of-buffer}).
@item C-e o
@kindex C-e o
@findex speechd-speak-read-other-window
Pøeèti buffer v@tie{}jiném oknì, je-li nìjaké jiné okno otevøené
(@code{speechd-speak-read-other-window}).
@item C-e r
@kindex C-e r
@findex speechd-speak-read-region
Pøeèti aktuální oblast (@code{speechd-speak-read-region}).
@item C-e C-r
@kindex C-e C-r
@findex speechd-speak-read-rectangle
Pøeèti text v@tie{}obdélníkové oblasti (@code{speechd-speak-read-rectangle}).
@item C-e w
@kindex C-e w
@findex speechd-speak-read-word
Pøeèti nejbli¾¹í slovo za kurzorem (@code{speechd-speak-read-word}).
@item C-e .
@kindex C-e .
@findex speechd-speak-read-sentence
Pøeèti aktuální vìtu (@code{speechd-speak-read-sentence}).
@item C-e @{
@kindex C-e @{
@findex speechd-speak-read-paragraph
Pøeèti nejbli¾¹í odstavec za kurzorem (@code{speechd-speak-read-paragraph}).
@item C-e [
@kindex C-e [
@findex speechd-speak-read-page
Pøeèti nejbli¾¹í stránku za kurzorem (@code{speechd-speak-read-page}).
@item C-e '
@kindex C-e '
@findex speechd-speak-read-sexp
Pøeèti nejbli¾¹í symbolický výraz za kurzorem
(@code{speechd-speak-read-sexp}).
@item C-e c
@kindex C-e c
@findex speechd-speak-read-char
Pøeèti znak na pozici kurzoru (@code{speechd-speak-read-char}).
@item C-e C-n
@kindex C-e C-n
@findex speechd-speak-read-next-line
Pøeèti následující øádek (@code{speechd-speak-read-next-line}).
@item C-e C-p
@kindex C-e C-p
@findex speechd-speak-read-previous-line
Pøeèti pøedchozí øádek (@code{speechd-speak-read-previous-line}).
@item C-e m
@kindex C-e m
@findex speechd-speak-last-message
Pøeèti poslední zobrazené hlá¹ení Emacsu (@code{speechd-speak-last-message}).
@item C-e RET
@cindex mode line
@kindex C-e RET
@findex speechd-speak-read-mode-line
Pøeèti mode line (@code{speechd-speak-read-mode-line}). Poznámka:
Tento pøíkaz funguje jen v@tie{}Emacsu verze 21.4 nebo vy¹¹í.
@item C-e i
@kindex C-e i
@findex speechd-speak-last-insertions
Pøeèti poslední pøeètený vlo¾ený text
(@code{speechd-speak-last-insertions}). To znamená text pøeètený
v@tie{}automaticky mluvících bufferech, viz @xref{Automatické mluvení
bufferù}.
@end table
@cindex prompty po¾adující znak
@cindex read-char
Nìkteré pøíkazy Emacsu vypisují prompt, po kterém èekají na zadaný
znak. Typickým pøíkladem je pøíkaz @code{ispell-word}. Pokud
zme¹káte pøedtím pøeètený text, mù¾ete pro jeho zopakování pou¾ít ve
znakovém promptu následující klávesové pøíkazy:
@table @kbd
@item C-e
@findex speechd-speak-last-message
Ten samý pøíkaz jako @kbd{C-e m} vý¹e
(@code{speechd-speak-last-message}).
@item C-a
@findex speechd-speak-last-insertions
Ten samý pøíkaz jako @kbd{C-e i} vý¹e
(@code{speechd-speak-last-insertions}).
@end table
Pokud se vám takové chování znakového promptu nezamlouvá, mù¾ete jej
deaktivovat pomocí následující promìnné:
@vtable @code
@item speechd-speak-allow-prompt-commands
Je-li hodnotou promìnné nìco jiného ne¾ @code{nil}, povol ve znakových
promptech vý¹e uvedené klávesové pøíkazy.
@end vtable
@node Informující pøíkazy, Øídící pøíkazy, Pøíkazy pro ètení, Pøíkazy
@subsection Informující pøíkazy
@table @kbd
@item C-e C-i b
@findex speechd-speak-buffer-info
@cindex buffer
Pøeèti informace o@tie{}aktuálním bufferu
(@code{speechd-speak-buffer-info}).
@item C-e C-i f
@findex speechd-speak-frame-info
@cindex frame
Pøeèti informace o@tie{}aktuálním frame
(@code{speechd-speak-frame-info}).
@item C-e C-i h
@findex speechd-speak-header-line-info
@cindex header line
Pøeèti obsah header line (@code{speechd-speak-header-line-info}).
Poznámka: Tento pøíkaz funguje jen v@tie{}Emacsu verze 21.4 nebo vy¹¹í.
@item C-e C-i m
@findex speechd-speak-mode-info
@cindex módy
Pøeèti informace o@tie{}aktuálním hlavním a vedlej¹ím módu
(@code{speechd-speak-mode-info}).
@item C-e C-i c
@findex speechd-speak-coding-info
@cindex systémy kódování
Pøeèti informaci o@tie{}aktuálním systému kódování
(@code{speechd-speak-coding-info}).
@item C-e C-i i
@findex speechd-speak-input-method-info
@cindex vstupní metoda
Pøeèti informaci o@tie{}aktuální vstupní metodì
(@code{speechd-speak-input-method-info}).
@item C-e C-i p
@findex speechd-speak-process-info
@cindex proces
Pøeèti stav procesu asociovaného s@tie{}aktuálním bufferem
(@code{speechd-speak-process-info}).
@end table
@node Øídící pøíkazy, Pøíkazy nastavující parametry, Informující pøíkazy, Pøíkazy
@subsection Øídící pøíkazy
@table @kbd
@item C-e q
@kindex C-e q
@findex speechd-speak-toggle-speaking
@cindex zti¹ení
Globálnì pøepni mluvení (@code{speechd-speak-toggle-speaking}). Pøi
vyvolání s@tie{}prefixovým argumentem pøepni mluvení pouze v@tie{}aktuálním
bufferu.
@item C-e s
@kindex C-e s
@findex speechd-stop
@cindex zastavení
Zastav mluvení aktuální zprávy (@code{speechd-stop}). Ostatní zprávy
ve frontì Speech Dispatcher budou normálnì pøemluveny. Je-li pøíkaz
vyvolán s@tie{}prefixovým argumentem, zastav mluvení aktuální zprávy
u@tie{}v¹ech klientù, nejen aktuálního spojení.
@item C-e x
@kindex C-e x
@findex speechd-cancel
@cindex zastavení
Zastav mluvení v¹ech zpráv ve frontì aktuálního spojení. Je-li pøíkaz
vyvolán s@tie{}univerzálním prefixovým argumentem, zastav ètení v¹ech
zpráv ve v¹ech spojeních. Je-li pøíkaz vyvolán s@tie{}èíselným
prefixovým argumentem, zastav mluvení v¹ech zpráv v@tie{}Emacsu, ve
kterém byl pøíkaz vyvolán.
@item C-e p
@kindex C-e p
@findex speechd-pause
@cindex pøeru¹ení
Pøeru¹ mluvení --- prozatím ztichni a odlo¾ mluvení aktuální zprávy a¾
do vyvolání pøíkazu pokraèování v@tie{}mluvení
(@code{speechd-pause}). Je-li pøíkaz vyvolán s@tie{}prefixovým
argumentem, pøeru¹ mluvení u@tie{}v¹ech klientù.
@item C-e SPC
@kindex C-e SPC
@findex speechd-resume
@cindex pokraèování
Pokraèuj v@tie{}pozastaveném mluvení (@code{speechd-resume}). Je-li
pøíkaz vyvolán s@tie{}prefixovým argumentem, pokraèuj v@tie{}mluvení
u@tie{}v¹ech klientù.
@item C-e 1
@itemx C-e 2
@itemx C-e 3
@itemx C-e 4
@itemx C-e 5
@itemx C-e 6
@itemx C-e 7
@itemx C-e 8
@itemx C-e 9
@kindex C-e 1
@kindex C-e 2
@kindex C-e 3
@kindex C-e 4
@kindex C-e 5
@kindex C-e 6
@kindex C-e 7
@kindex C-e 8
@kindex C-e 9
@findex speechd-speak-key-set-predefined-rate
@cindex rychlost
Nastav jednu z@tie{}pøednastavených rychlostí mluvení
(@code{speechd-speak-key-set-predefined-rate}). @kbd{C-e 1} nastaví
nejni¾¹í rychlost, @kbd{C-e 5} nastaví støední rychlost a @kbd{C-e 9}
nastaví nejvy¹¹í rychlost.
@end table
@node Pøíkazy nastavující parametry, Hláskování, Øídící pøíkazy, Pøíkazy
@subsection Pøíkazy pro nastavení parametrù
@cindex parametry
Tyto pøíkazy nastavují rùzné vlastnosti øeèového výstupu. V¹echny
jsou aplikovány pouze na aktuální spojení do Speech Dispatcher (více
informací o@tie{}spojeních do Speech Dispatcher naleznete
v@tie{}@pxref{Hlasy spojení}), pokud nejsou vyvolány
s@tie{}prefixovým argumentem. Pøi vyvolání s@tie{}èíselným prefixovým
argumentem jsou aplikovány na v¹echna spojení speechd-el, pøi vyvolání
s@tie{}univerzálním prefixovým argumentem jsou aplikována na v¹echna
spojení Speech Dispatcher.
Chcete-li si pro konkrétní buffer vytvoøit zvlá¹tní spojení, které má
své vlastní parametry, mù¾ete tak uèinit následujícím pøíkazem:
@table @kbd
@item C-e C-c
@kindex C-e C-c
@findex speechd-speak-new-connection
@cindex spojení
Nastav pro aktuální buffer dané spojení
(@code{speechd-speak-new-connection}). Pøíkaz se zeptá na jméno
spojení, mù¾ete zadat buï nové jméno, nebo jméno ji¾ existujícího
spojení. Pøi obyèejném vyvolání pøíkazu je vám nabídnuto novì
vygenerované jméno spojení, zatímco pøi vyvolání pøíkazu s@tie{}prefixovým
argumentem si mù¾ete vybrat z@tie{}nabídnutých jmen existujících spojení.
@end table
Pøíkazy ovlivòující základní parametry pøevodu textu na øeè:
@table @kbd
@item C-e d l
@kindex C-e d l
@findex speechd-set-language
@cindex jazyk
Nastav jazyk spojení. Zadejte jej jako kód jazyka dle ISO 639.
@item C-e d .
@kindex C-e d .
@findex speechd-set-punctuation-mode
@cindex interpunkce
Urèi, jak zpracovávat interpunkci, zda ji èíst èi ignorovat.
@code{all} znamená èíst v¹echny interpunkèní znaky, @code{none} je
v¹echny pøeskakuje a @code{some} ète zadanou podmno¾inu interpunkèních
znakù zadaných v@tie{}konfiguraci Speech Dispatcher.
@item C-e d c
@kindex C-e d c
@findex speechd-set-capital-character-mode
@cindex velká písmena
Nastav mód signalizace velkých písmen. @code{icon} znamená
signalizaci zvukovou ikonou, @code{spell} znamená jejich hláskování
prostøednictvím speciální hláskovací tabulky a @code{none} znamená, ¾e
velká písmena nejsou nijak zvlá¹» signalizována.
@end table
Pøíkazy ovlivòující vlastnosti øeèového výstupu:
@table @kbd
@item C-e d v
@kindex C-e d v
@findex speechd-set-voice
@cindex hlas
Nastav implicitní hlas, který má syntetizér pou¾ívat
(@code{speechd-set-voice}). Mù¾ete si vybrat nìkterý z@tie{}mno¾iny
hlasù nabízených ve va¹í instalaci Speech Dispatcher.
@item C-e d r
@kindex C-e d r
@findex speechd-set-rate
@cindex rychlost
Nastav rychlost ètení, v@tie{}rozmezí od -100 (nejpomalej¹í) po 100
(nejrychlej¹í) (@code{speechd-set-rate}). Èasto asi budete
radìji pou¾ívat pøíkaz @code{speechd-speak-key-set-predefined-rate},
dostupný na klávese @kbd{C-e @var{number}}, viz @ref{Øídící pøíkazy}.
@item C-e d p
@kindex C-e d p
@findex speechd-set-pitch
@cindex vý¹ka
Nastav vý¹ku hlasu, v@tie{}rozmezí od -100 (nejni¾¹í) po 100 (nejvy¹¹í)
(@code{speechd-set-pitch}).
@item C-e d V
@kindex C-e d V
@findex speechd-set-volume
@cindex hlasitost
Nastav hlasitost hlasu, v@tie{}rozmezí od -100 (nejni¾¹í) po 100
(nejvy¹¹í) (@code{speechd-set-volume}).
@end table
Pøíkazy ovlivòující øeèový syntetizér:
@table @kbd
@item C-e d o
@kindex C-e d o
@findex speechd-set-output-module
@cindex výstupní modul
Pøepni Speech Dispatcher na zadaný výstupní modul
(@code{speechd-set-output-module}). Pøíkaz se dotazuje na jméno
¾ádaného výstupního modulu.
@end table
@node Hláskování, Ostatní pøíkazy, Pøíkazy nastavující parametry, Pøíkazy
@subsection Hláskování
@cindex hláskování
@cindex speechd-speak-spell-mode
Hláskovat lze ve speechd-el dvìma zpùsoby. Prvním je zapnout pro daný
buffer vedlej¹í mód @code{speechd-speak-spell-mode}. Tento mód je
u¾iteèný, pokud chcete hláskovat vìt¹í mno¾ství textu v@tie{}bufferu.
Druhým zpùsobem hláskování je vyu¾ití následujícího pøíkazu:
@table @kbd
@item C-e C-l
@kindex C-e C-l
@findex speechd-speak-spell
Pøinu» následující pøíkaz hláskovat jím ètený text
(@code{speechd-speak-spell}). Napøíklad pokud chcete hláskovat slovo
za kurzorem, mù¾ete pou¾ít klávesový pøíkaz @kbd{C-e C-l C-e w}.
@end table
@node Ostatní pøíkazy, , Hláskování, Pøíkazy
@subsection Ostatní pøíkazy
@kindex C-x C-c
V@tie{}pøípadì, ¾e se Emacs úplnì zblázní a odmítá kvùli chybì speechd-el
nebo u¾ivatelské definici související s@tie{}øeèovým výstupem provádìt
jakékoliv pøíkazy vèetnì @kbd{C-x C-c}, mù¾ete jako poslední pokus
o@tie{}pomoc vyzkou¹et následující pøíkaz:
@table @kbd
@item C-e C-x
@kindex C-e C-x
@findex speechd-unspeak
@cindex vzpamatování se
Pokus se deaktivovat v¹echny módy, háèky a obálky instalované pøíkazem
@code{speechd-speak} (@code{speechd-unspeak}).
@end table
Následující pøíkazy jsou pou¾ívány jen velmi zøídka, povìt¹inou pro
ladící úèely:
@table @kbd
@item C-e z
@kindex C-e z
@findex speechd-repeat
Zopakuj poslední text odeslaný do Speech Dispatcher
(@code{speechd-repeat}).
@item M-x speechd-say-text
@findex speechd-say-text
Zeptej se na text a pøemluv jej.
@end table
@node Konfigurace, Pokroèilá konfigurace, Pøíkazy, U¾ivatelská pøíruèka
@section Konfigurace
@menu
* Konfigurace serveru:: Kam se pøipojit.
* Implicitní priority:: Priority rùzných druhù zpráv.
* Základní mluvení:: Jednoduché volby.
* Automatické mluvení bufferù:: Jak nìkteré buffery rozmluvit ihned.
* Oznamování stavu:: Pøeøíkávání zmìn stavu Emacsu.
* Signalizace:: Signalizace prázdných zpráv, apod.
* Vlastnosti textu:: Podpora faces a zvlá¹tních èástí textu.
* Jazyky:: Pou¾ívání více jazykù.
* Hlasy:: Definice rùzných hlasù.
* Hlasy spojení:: Nastavování parametrù spojení.
* Více spojení:: Odli¹né parametry pro nìkteré módy a buffery.
* Klávesy:: Pøizpùsobení pøíkazových kláves.
* Módy:: Háèky vedlej¹ích módù.
* Debugger:: Potlaèení mluvení v@tie{}debuggeru.
@end menu
@node Konfigurace serveru, Implicitní priority, Konfigurace, Konfigurace
@subsection Konfigurace spojení na Speech Dispatcher server
Nastavení tìchto promìnných umo¾òuje se pøipojit na Speech Dispatcher
bì¾ící na vzdáleném stroji nebo nestandardním portu.
@vtable @code
@item speechd-host
@cindex server
Jméno serveru, na kterém bì¾í Speech Dispatcher, ke kterému se chcete
pøipojit, zadané jako øetìzec. Implicitní hodnotou je hodnota
shellové promìnné @code{SPEECHD_HOST}, pokud je nastavena, jinak
@code{"localhost"}.
@item speechd-port
@cindex port
Èíslo portu, na který se chcete pøipojit. Implicitní hodnotou je
hodnota shellové promìnné @code{SPEECHD_PORT}, pokud je nastavena,
jinak obvyklé èíslo portu Speech Dispatcher.
@item speechd-timeout
@cindex timeout
Maximální poèet sekund, po které se má èekat na odpovìï od Speech
Dispatcher. Je-li tento èas pøekroèen, speechd-el uzavøe pøíslu¹né
spojení. Za normálních okolností by Speech Dispatcher mìlo odpovídat
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
@subsection Implicitní priority
@cindex priority
Po¹le-li nìjaká funkce speechd-el na Speech Dispatcher zprávu bez
explicitnì specifikované priority dané zprávy, pøiøadí se zprávì
priorita dle obsahu ní¾e uvedených promìnných. Zmìnou jejich hodnot
mù¾ete dosáhnout zajímavých efektù. Napøíklad zmìnou hodnoty promìnné
@code{speechd-default-key-priority} z@tie{}@code{notification} na
@code{message} zaøídíte, ¾e v¹echny napsané znaky budou øeèeny a budou
pøeru¹ovat obvyklé ètení textù.
V¹echny tyto promìnné mohou nabývat nìkteré z@tie{}následujících hodnot:
@code{important}, @code{message}, @code{text}, @code{notification},
@code{progress}. Tyto hodnoty odpovídají prioritám Speech Dispatcher,
více podrobností naleznete v@tie{}manuálu Speech Dispatcher.
@vtable @code
@item speechd-default-text-priority
Implicitní priorita vìt¹iny textových zpráv.
@item speechd-default-sound-priority
Implicitní priorita zvukových ikon.
@item speechd-default-char-priority
Implicitní priorita hláskovaných znakù.
@item speechd-default-key-priority
Implicitní priorita znakù napsaných na klávesnici.
@end vtable
@node Základní mluvení, Automatické mluvení bufferù, Implicitní priority, Konfigurace
@subsection Základní konfigurace mluvení
@vtable @code
@item speechd-speak-deleted-char
@cindex mazání
Urèuje, který znak má být pøeèten pøi mazání znaku. Je-li hodnotou
nìco jiného ne¾ @code{nil}, pøeèti smazaný znak, jinak pøeèti sousední
znak.
@item speechd-speak-buffer-name
@cindex buffery
Pøepínáte-li se do jiného bufferu a hodnotou této promìnné je nìco
jiného ne¾ @code{nil}, je pøeèteno jméno nového bufferu. Je-li
hodnotou promìnné symbol @code{text}, ète se kromì jména bufferu je¹tì
text jeho øádku od pozice kurzoru do konce øádku. Je-li hodnotou
promìnné @code{nil}, je pøeèten jen text, beze jména bufferu.
@item speechd-speak-whole-line
@cindex ètení øádkù
Je-li hodnotou promìnné nìco jiného ne¾ @code{nil}, èti pøi pøesunu na
jinou pozici celý øádek. Jinak èti øádek jen od pozice kurzoru do
konce øádku.
@item speechd-speak-on-minibuffer-exit
@cindex minibuffer
Je-li hodnotou promìnné nìco jiného ne¾ @code{nil}, speechd-el ète
po návratu z@tie{}minibufferu nebo rekurzivní editaèní úrovnì text
okolo kurzoru, není-li ke ètení nic lep¹ího.
@item speechd-speak-read-command-keys
@cindex pøíkazové klávesy
@cindex klávesy
Tato promìnná definuje, v@tie{}jakých situacích jsou èteny pøíkazové
klávesy aktuálního pøíkazu. Je-li hodnotou promìnné @code{t},
pøíkazové klávesy jsou èteny v¾dy. Je-li hodnotou promìnné
@code{nil}, nejsou èteny nikdy. Je-li hodnotou promìnné seznam, mù¾e
obsahovat jeden nebo více z@tie{}následujících symbolù
identifikujících situace, za kterých mají být klávesy pøíkazu
pøeèteny:
@table @code
@item movement
Pøeèti pøíkazové klávesy, jestli¾e do¹lo k@tie{}pøesunu kurzoru, ale
nebyl modifikován obsah bufferu.
@item modification
Byl modifikován obsah bufferu, nedo¹lo k@tie{}pøesunu kurzoru.
@item movement-modification
Byl modifikován obsah bufferu a do¹lo k@tie{}pøesunu kurzoru.
@end table
Je-li hodnotou promìnné @code{t}, pøíkazové klávesy jsou èteny pøed
provedením pøíkazu. Jinak jsou pøeøíkány a¾ po provedení pøíkazu,
proto¾e je tøeba nejprve zjistit, zda do¹lo k@tie{}modifikaci obsahu
bufferu a pøesunu kurzoru.
@item speechd-speak-ignore-command-keys
@cindex pøíkazové klávesy
@cindex klávesy
Seznam pøíkazù, u@tie{}nich¾ nemají být pøíkazové klávesy nikdy èteny.
@item speechd-speak-read-command-name
@cindex jméno pøíkazu
Je-li hodnotou nìco jiného ne¾ @code{nil}, èti v@tie{}situacích
definovaných promìnnou @code{speechd-speak-read-command-keys} místo
kláves pøíkazu jeho jméno.
@item speechd-speak-message-time-interval
@cindex hlá¹ení
@cindex opakování
Minimální poèet vteøin, po kterých smí být hlá¹ení zopakováno. Je-li
aktuální hlá¹ení stejné jako hlá¹ení pøedchozí, není pøeøíkáno, pokud
neuplynul aspoò zde definovaný èas od posledního pøeøíkaného hlá¹ení.
@end vtable
@node Automatické mluvení bufferù, Oznamování stavu, Základní mluvení, Konfigurace
@subsection Automatické mluvení bufferù
@cindex buffery
@cindex vkládaný text
Nìkdy je u¾iteèné zaèít pøemlouvat obsah bufferu i@tie{}bez explicitního
po¾adavku u¾ivatele. Napøíklad je-li vyvolán pøíkaz nápovìdy,
u¾ivatel si obvykle chce ihned poté pøeèíst její text. Následující
promìnné definují seznam jmen bufferù, které mají být automaticky
pøemluveny, jestli¾e jsou viditelné v@tie{}nìkterém z@tie{}oken aktuálního rámce
a jejich obsah byl bìhem posledního u¾ivatelského pøíkazu zmìnìn.
@vtable @code
@item speechd-speak-auto-speak-buffers
Obsah tìchto bufferù je pøemluven za vý¹e uvedených podmínek po
provedení pøíkazu, jestli¾e není k@tie{}pøemluvení nic jiného (napøíklad
pod kurzorem pøi pøesunu kurzoru na jinou pozici).
@item speechd-speak-force-auto-speak-buffers
Stejné jako @code{speechd-speak-auto-speak-buffers} a¾ na to, ¾e obsah
bufferu je pøemluven vynucenì, i@tie{}kdy¾ by mohlo být pøemluveno nìco
jiného.
@end vtable
Následující promìnné urèují, jak nakládat s@tie{}texty vlo¾enými bìhem
provádìní u¾ivatelských pøíkazù. Týkají se pouze novì vlo¾ených
textù, neovlivòují zpracování smazaných textù. Navíc tyto volby
neovlivòují texty vlo¾ené bìhem provádìní pøíkazù, které speechd-el
anebo u¾ivatelské definice zpracovávají speciálním zpùsobem, jako je
napøíklad pøípad pøíkazu @code{self-insert-command}.
@vtable @code
@item speechd-speak-buffer-insertions
Urèuje, zda má být automaticky èten text vkládaný v@tie{}aktuálním bufferu.
Hodnotou promìnné mù¾e být nìkterý z@tie{}následujících symbolù:
@table @code
@item nil
Neèti ¾ádné vlo¾ené texty.
@item t
Èti v¹echny vlo¾ené texty.
@item one-line
Èti pouze první øádky vlo¾ených textù.
@item whole-buffer
Pokud byl buffer jakkoliv modifikován, pøeèti jej celý.
@end table
@item speechd-speak-insertions-in-buffers
Seznam jmen bufferù, ve kterých jsou vkládané texty èteny automaticky,
bez ohledu na to, zda jde o@tie{}aktuální buffer a bez ohledu na hodnotu
promìnné @code{speechd-speak-buffer-insertions}.
@item speechd-speak-priority-insertions-in-buffers
Seznam jmen bufferù, ve kterých jsou vkládané texty èteny automaticky
okam¾itì po svém vlo¾ení, ne a¾ po dokonèení provádìného pøíkazu, jako
je tomu v@tie{}pøípadì promìnné @code{speechd-speak-insertions-in-buffers}.
Tato vlastnost je typicky u¾iteèná v@tie{}comint bufferech.
@item speechd-speak-align-buffer-insertions
Je-li hodnotou promìnné nìco jiného ne¾ @code{nil}, je vkládaný text
pøed svým pøeètením roz¹íøen k@tie{}zaèátku prvního slova, které je alespoò
zèásti obsa¾eno ve vlo¾eném textu. To je u¾iteèné zejména v@tie{}pøípadì
doplòovacích funkcí.
@end vtable
Jestli¾e pøíkaz modifikoval aktuální buffer a pøesunul kurzor na úplnì
jinou pozici, nová pozice kurzoru není v@tie{}øeèovém výstupu
nijak vyznaèena. To lze zmìnit prostøednictvím následující promìnné:
@vtable @code
@item speechd-speak-movement-on-insertions
Je-li hodnotou promìnné @code{t}, pøeèti text okolo nové pozice
kurzoru, i@tie{}kdy¾ byl aktuální buffer modifikován. Je-li hodnotou
promìnné @code{read-only}, èti jej jen v@tie{}read-only bufferech.
Je-li hodnotou @code{nil}, neèti jej.
@end vtable
@node Oznamování stavu, Signalizace, Automatické mluvení bufferù, Konfigurace
@subsection Oznamování zmìn stavu
speechd-el mù¾e èíst informaci o@tie{}aktuálním stavu Emacsu, jako
jméno aktuálního bufferu, hlavní a vedlej¹í módy nebo jiné atributy
bufferu, viz @xref{Informující pøíkazy}. Zmìny stavu Emacsu mohou být
oznamovány automaticky, v@tie{}závislosti na u¾ivatelské konfiguraci:
@vtable @code
@item speechd-speak-state-changes
Seznam identifikátorù zmìn stavu Emacsu, které mají být automaticky
oznamovány. Jako identifikátory zmìny stavu lze pou¾ít následující
symboly:
@table @code
@item buffer-name
@item buffer-identification
(jen v@tie{}Emacsu 21.4 nebo vy¹¹ím)
@item buffer-modified
@item buffer-read-only
@item frame-name
@item frame-identification
(jen v@tie{}Emacsu 21.4 nebo vy¹¹ím)
@item header-line
(jen v@tie{}Emacsu 21.4 nebo vy¹¹ím)
@item major-mode
@item minor-modes
@item buffer-file-coding
@item terminal-coding
@item input-method
@item process
@end table
@item speechd-speak-display-modes
Seznam vedlej¹ích módù, u@tie{}nich¾ je místo jejich jména pøeøíkáván
jejich zobrazený øetìzec. To mù¾e být u¾iteèné v@tie{}pøípadech, kdy
je zobrazený øetìzec struènìj¹í ne¾ jméno módu nebo kdy¾ je zobrazený
øetìzec zmìnìn, ani¾ by byl zmìnìn samotný mód.
@end vtable
@node Signalizace, Vlastnosti textu, Oznamování stavu, Konfigurace
@subsection Signalizace
Nìkteré situace mohou být signalizovány zvukovými ikonami.
Následující promìnná zapíná nebo vypíná pøeddefinované signalizace.
O@tie{}tom, jak si definovat vlastní signalizace, se mù¾ete doèíst
v@tie{}sekci @ref{Pokroèilá konfigurace}.
@vtable @code
@item speechd-speak-signal-events
Seznam symbolù, obsahující jména událostí, které mají být
signalizovány zvukovou ikonou. Podporována jsou následující jména
událostí:
@table @code
@item start
Start nebo restart speechd-el.
@item empty
@cindex prázdný text
Prázdný text v@tie{}rùzných situacích.
@item beginning-of-line
@cindex øádek
@cindex zaèátek øádku
Dosa¾ení zaèátku øádku po pøíkazech @code{forward-char} a
@code{backward-char}.
@item end-of-line
@cindex konec øádku
Dosa¾ení konce øádku po pøíkazech @code{forward-char} a
@code{backward-char}.
@item minibuffer
Vstup do minibufferu.
@item message
Následují hlá¹ení v@tie{}echo area.
@end table
@end vtable
@node Vlastnosti textu, Jazyky, Signalizace, Konfigurace
@subsection Vlastnosti textu
@cindex vlastnosti textu
@cindex faces
@cindex kurzor
@cindex pohyb
Implicitní chování speechd-el je takové, ¾e po pøíkazu, který zpùsobí
pøesun kurzoru na jinou pozici, pøeète aktuální øádek. Pokud je v¹ak
pozice kurzoru obklopena textem, který má nìjaké vlastnosti (text
properties), typicky face, ale mù¾e jít o@tie{}jakékoliv jiné vlastnosti,
speechd-el dovede pøeèíst pouze tu èást textu pod kurzorem, která má
shodné vlastnosti.
Pokud je navíc zapnut font lock mód, faces mohou být mapovány na rùzné
hlasy.
@vtable @code
@item speechd-speak-by-properties-on-movement
Metoda výbìru èásti textu, která má být pøeètena po pøesunu kurzoru.
Promìnná mù¾e nabývat nìkteré z@tie{}následujících hodnot:
@table @asis
@item @code{nil}
Vlastnosti textu (text properties) nejsou nijak zohledòovány.
@item @code{t}
Jsou zohledòovány v¹echny vlastnosti textu.
@item seznam faces
Z@tie{}vlastností textu jsou zohledòována pouze daná faces.
@end table
@item speechd-speak-by-properties-always
Seznam pøíkazù, které v¾dy zohledòují vlastnosti textu, a@tie{}to
i@tie{}v@tie{}pøípadì ¾e hodnota promìnné
@code{speechd-speak-by-properties-on-movement} je @code{nil}.
@item speechd-speak-by-properties-never
Seznam pøíkazù, které nikdy nezohledòují vlastnosti textu, a@tie{}to ani
v@tie{}pøípadì ¾e hodnota promìnné
@code{speechd-speak-by-properties-on-movement} není @code{nil}.
@item speechd-speak-faces
Tato promìnná umo¾òuje zajistit vyvolání akcí v@tie{}pøípadì, kdy kurzor po
provedení u¾ivatelského pøíkazu skonèí na urèitém face. Hodnotou
promìnné je asociativní seznam s@tie{}prvky tvaru @code{(@var{face}
. @var{akce})}.
Jestli¾e pøíkaz pøesouvající kurzor zanechá kurzor na @var{face} a na
pøíkaz není explicitnì navì¹eno ¾ádné mluvení, je vyvolána
@var{akce}. Je-li @code{akce} øetìzcem, je tento øetìzec pøemluven.
Je-li @code{akce} funkcí, je tato funkce zavolána, bez argumentù.
@item speechd-face-voices
Mapování faces na hlasy. Hodnotou promìnné je asociativní seznam
s@tie{}prvky tvaru @code{(@var{face} . @var{hlas})}, kde @var{face} je face
a @var{hlas} je jméno hlasu definované v@tie{}promìnné
@code{speechd-voices}, viz @xref{Hlasy}. Ka¾dé face je pøemluveno
odpovídajícím hlasem. Pokud pro nìjaké face není hlas v@tie{}této promìnné
definovat, je toto face pøemluveno aktuálním hlasem.
Pozor, toto mapování se uplatní jen tehdy, je-li zapnut font lock mód.
@end vtable
@node Jazyky, Hlasy, Vlastnosti textu, Konfigurace
@subsection Pou¾ívání více jazykù
@cindex jazyky
speechd-el je mo¾no pou¾ívat s@tie{}vícero jazyky. Nicménì proces
volby jazyka nemù¾e být snadno automatizováno, proto¾e bì¾ný text
neobsahuje ¾ádnou informaci o@tie{}svém jazyce. Tak¾e pokud chcete
pou¾ívat speechd-el s@tie{}výstupem ve více jazycích, musíte
speechd-el napovídat.
@vindex speechd-language
@cindex RFC 1766
Základním prostøedkem pro sdìlení informace o@tie{}aktuálním jazyku je
promìnná @code{speechd-language}. Poka¾dé, kdy¾ chce speechd-el øíct
nìjaký text, podívá se na tuto promìnnou, zda neobsahuje kód jazyka.
Pokud její hodnota není @code{nil}, musí to být øetìzec obsahující kód
jazyka dle RFC@tie{}1766 a speechd-el pøeète text v@tie{}odpovídajícím
jazyce.
Vìt¹inou asi budete chtít nastavit tuto promìnnou v@tie{}konkrétním
souboru, viz @ref{File Variables,,,emacs,GNU Emacs Manual}, nebo jako
lokální promìnnou bufferu, viz @ref{Locals,,,emacs,GNU Emacs Manual},
v@tie{}rùzných mode hooks, see @ref{Hooks,,,emacs,GNU Emacs Manual}.
@findex speechd-language
@cindex text property @code{language}
Pokud má text vlastnost (property) @code{language} obsahující kód
jazyka dle RFC@tie{}1766, je pøemluven v@tie{}odpovídajícím jazyce bez
ohledu na v¹echna ostatní nastavení. K@tie{}dispozici je funkce
@code{speechd-language}, která v@tie{}elispových programech umístí
tuto textovou vlastnost na øetìzec.
Jinou dobrou cestou, jak pou¾ívat více jazykù, je pou¾ívat více
spojení pro oddìlení jazykovì závislých bufferù nebo módù, viz
@ref{Více spojení}, a nastavit pro ka¾dé z@tie{}tìchto spojení
parametr @code{language}, viz @ref{Hlasy spojení}.
Pokud u¾ není mo¾ná ¾ádná lep¹í cesta, je mo¾né jazyky nastavovat
podle aktuální vstupní metody:
@vtable @code
@item speechd-speak-input-method-languages
Asociativní seznam mapující vstupní metody na jazyky. Ka¾dý
z@tie{}prvkù seznamu má podobu @code{(@var{input-method-name} .
@var{language})}, kde @var{input-method-name} je jméno metody jako
øetìzec a @var{language} je ISO kód jazyka akceptovaný SSIP. Jestli¾e
je aktuální vstupní metoda v@tie{}seznamu pøítomna, je vybrán
odpovídající jazyk, není-li pøebit jiným nastavením.
@end vtable
@node Hlasy, Hlasy spojení, Jazyky, Konfigurace
@subsection Definice hlasù
@cindex parametry
Ve speechd-el lze definovat speciální hlasy, které pak mohou být
vyu¾ívány v@tie{}rùzných situacích, napøíklad pro pøemlouvání rùzných
faces rùznými hlasy (@pxref{Vlastnosti textu}) nebo pro nastavení
rùzných re¾imù ètení interpunkce pro rùzné druhy bufferù (@pxref{Více
spojení}). Hlasy ve speechd-el neurèují jen základní charakteristiku
hlasu, ale také vlastnosti øeèi jako vý¹ku èi rychlost a zvlá¹tní
vlastnosti jako re¾im ètení interpunkce nebo signalizaci velkých
písmen.
Definice hlasù je obsa¾ena v@tie{}následující promìnné:
@vtable @code
@item speechd-voices
Asociativní seznam identifikátorù hlasù a jejich parametrù.
Ka¾dý prvek seznamu má podobu @code{(@var{voice-id} .
@var{parameters})}, kde @var{voice-id} je symbo, pod kterým bude hlas
dostupný a @var{parameters} je asociativní seznam identifikátorù
parametrù a jejich hodnot. Pøípustná jména parametrù jsou následující
symboly: @code{language}, @code{gender}, @code{age}, @code{style},
@code{name}, @code{rate}, @code{pitch}, @code{volume},
@code{punctuation-mode}, @code{capital-character-mode},
@code{message-priority}, @code{output-module}.
@code{name} je øetìzec identifikující jméno hlasu Speech Dispatcher.
Není-li uveden, pak jsou pro volbu hlasu rozhodující parametry
@code{gender}, @code{age} a @code{style}. @code{gender} mù¾e být
jeden ze symbolù @code{male}, @code{female}, @code{neutral}.
@code{age} mù¾e být jeden ze symbolù @code{middle-adult},
@code{child}. @code{neutral}. @code{style} mù¾e být jedno
z@tie{}èísel @code{1}, @code{2}, @code{3} (hodnoty parametru
@code{style} se v@tie{}budoucnu pravdìpodobnì zmìní).
Parametr @code{message-priority} nastavuje prioritu v¹ech zpráv
øíkaných daných hlasem. Jeho hodnotou mù¾e být kterýkoliv ze symbolù
identifikujících prioritu zprávy.
Pro povolené hodnoty ostatních parametrù viz odpovídající
@code{speechd-set-*} funkce.
Hlas pojmenovaný @code{nil} je zvlá¹tní, definuje implicitní hlas.
Explicitní definice jeho parametrù je nepovinná.
@end vtable
@node Hlasy spojení, Více spojení, Hlasy, Konfigurace
@subsection Hlasy spojení
@cindex hlasy
S@tie{}pomocí následující promìnné si mù¾ete nechat automaticky
nastavit rùzné parametry spojení, jako rychlost øeèi, jazyk, atd.
speechd-el mù¾e mít na Speech Dispatcher otevøeno více spojení,
definovaných dle rùzných kritérií (@pxref{Více spojení}). Rùzným
spojením pak mù¾ete nastavit rùzné parametry, v@tie{}závislosti na
jménu spojení, a@tie{}mù¾ete také nastavit implicitní parametry
spoleèné pro v¹echna spojení.
@vtable @code
@item speechd-connection-parameters
Asociativní seznam jmen spojení a odpovídajících hlasù. Ka¾dý prvek
seznam má podobu @code{(@var{connection-name} . @var{voice})}, kde
@var{connection-name} je jméno spojení ve formì øetìzce a
@var{voice} je identifikátor hlasu definovaného v@tie{}promìnné
@code{speechd-voices}.
Pro spojení, která nejsou v@tie{}této promìnné definována se pou¾ívá
implicitní hlas, jeho¾ jméno je @code{nil}.
@end vtable
Aby se nastavení hodnoty této promìnné plnì projevilo, musí být
otevøená spojení znovuotevøena. Nepou¾íváte-li konfiguraèní rozhraní
Emacsu (customize), musíte pro zaji¹tìní znovuotevøení spojení zavolat
pøíkaz @kbd{C-u M-x speechd-speak}.
Jako malou pomùcku pro nastavení hlasu spojení a jeho parametrù je
mo¾né pou¾ít tento pøíkaz:
@table @kbd
@item C-e C-a
@kindex C-e C-a
@findex speechd-add-connection-settings
Ulo¾ aktuální parametry spojení do zadaného hlasu v@tie{}promìnné
@code{speechd-voices} s nastav tento hlas pro aktuální spojení
v@tie{}promìnné @code{speechd-connection-voices}.
Nezapomeòte, ¾e pokud chcete zachovat nový obsah tìchto promìnných,
musíte si je sami ulo¾it, pøíkaz to nedìlá.
@end table
@node Více spojení, Klávesy, Hlasy spojení, Konfigurace
@subsection Více spojení
@cindex spojení
speechd-el mù¾ete øíct, aby pro urèité buffery nebo hlavní módy
pou¾ívalo oddìlená spojení na Speech Dispatcher. To v@tie{}zásadì umo¾òuje
nezávislé nastavení rùzných parametrù øeèového výstupu pro tyto
buffery a hlavní módy, jak ruèní, tak prostøednictvím konfigurace
(@pxref{Hlasy spojení}).
Ka¾dé spojení na Speech Dispatcher má své vlastní jedineèné jméno.
speechd-el implicitnì pou¾ívá spojení nazvané @code{"default"}. Pro
vytvoøení oddìleného spojení staèí pouze nechat v@tie{}urèitých situacích
speechd-el vybrat jiné jméno spojení. Zpùsob výbìru spojení je
definován promìnnou @code{speechd-speak-connections}.
@vtable @code
@item speechd-speak-connections
Asociativní seznam mapující hlavní módy a buffery na spojení. Ka¾dý
prvek seznamu je tvaru @code{(@var{mód-nebo-buffer}
. @var{jméno-spojení})}.
Kdy¾ chce speechd-el poslat zprávu, porovnává momentální prostøedí
s@tie{}@var{mód-nebo-buffer}. @var{mód-nebo-buffer} smí být jedním
z@tie{}následujících objektù, od nejvy¹¹í priority po nejni¾¹í:
@itemize @bullet
@item
seznam, reprezentující volání funkce, která musí vrátit jinou hodnotu
ne¾ @code{nil}, právì kdy¾ má být pou¾it pøíslu¹ný prvek asociativního
seznamu
@item
jméno bufferu
@item
symbol @code{:minibuffer}, reprezentující minibuffer
@item
symbol hlavního módu
@item
@code{nil}, reprezentující nebufferové objekty, napø. echo area
@item
@code{t}, reprezentující implicitní hodnotu, kdy¾ není aplikovatelný
¾ádný jiný prvek
@end itemize
Jestli¾e urèité situaci odpovídá více prvkù, je pou¾it prvek
s@tie{}nejvy¹¹í prioritou.
@var{jméno-spojení} je libovolný neprázdný øetìzec urèující jméno
po¾adovaného spojení. Není-li otevøeno ¾ádné spojení daného jména, je
automaticky vytvoøeno v@tie{}okam¾iku, kdy do nìj má být nìco zasláno.
@end vtable
@node Klávesy, Módy, Více spojení, Konfigurace
@subsection Klávesy
@cindex klávesy
@cindex prefixová klávesa
@cindex klávesová mapa
Pøíkazové klávesy speechd-el jsou definovány promìnnou
@code{speechd-speak-prefix} a klávesovou mapou
@code{speechd-speak-mode-map}.
@vtable @code
@item speechd-speak-prefix
Tato promìnná definuje prefixovou klávesu pøíkazù speechd-el, kterou
je implicitnì @kbd{C-e}. Jestli¾e tuto promìnnou zmìníte a¾ po
nastartování mluvení prostøednictvím pøíkazu @code{speechd-speak} a
nenastavujete ji prostøednictvím konfiguraèního rozhraní Emacsu
(customize), musíte, aby se zmìna projevila, pøíkaz
@code{speechd-speak} spustit znovu.
@item speechd-speak-mode-map
Tato klávesová mapa urèuje mapování kláves speechd-el následujících za
prefixovou klávesou. Mù¾ete v@tie{}ní klávesy nastavovat obvyklým
zpùsobem, napø.
@lisp
(define-key speechd-speak-mode-map "t" 'speechd-say-text)
@end lisp
pøiøadí pøíkaz @code{'speechd-say-text} klávese @code{C-e t} (je-li
prefixovou klávesou @code{C-e}).
@end vtable
@node Módy, Debugger, Klávesy, Konfigurace
@subsection Háèky ve vedlej¹ích módech
@cindex vedlej¹í módy
@cindex háèky
speechd-el poskytuje vedlej¹í mód, který zapíná a vypíná mluvení,
@xref{Spu¹tìní øeèového výstupu}. Prostøednictvím následujícího háèku
si mù¾ete nechat provést vlastní akce pøi vstupu do tohoto módu:
@vtable @code
@item speechd-speak-mode-hook
Háèek spu¹tìný pøi zapnutí vedlej¹ího módu speechd-speak.
@end vtable
@node Debugger, , Módy, Konfigurace
@subsection Ladìní speechd-el
@cindex debugger
@cindex ladìní
Pokud se pokou¹íte øeèový výstup ladit, mù¾ete narazit na problém
rekurzivního vyvolávání ladìných funkcí v@tie{}elispových debuggerech.
Tomu lze ve speechd-el zabránit zákazem mluvení v@tie{}debuggerech:
@vtable @code
@item speechd-speak-in-debugger
Je-li hodnotou promìnné nìco jiného ne¾ @code{nil}, funkce
automatického øeèového výstupu nemluví v@tie{}elispových debuggerech.
@end vtable
@node Pokroèilá konfigurace, Potí¾e, Konfigurace, U¾ivatelská pøíruèka
@section Definice vlastních reakcí na pøíkazy
@cindex roz¹íøení
Psaní vlastních reakcí na pøíkazy obecnì vy¾aduje znalost programování
v@tie{}Elispu. Nemusíte se v¹ak dìsit, základní vìci si mù¾ete nastavit
i@tie{}bez toho, staèí se øídit zde uvedenými instrukcemi.
speechd-el umo¾òuje øíct text, pøehrát zvukovou ikonu nebo zavolat
libovolný elispový výraz pøed nebo po provedení pøíkazu nebo funkce.
Pro tyto úèely jsou k@tie{}dispozici dvì makra, která zajistí, ¾e se kromì
vlastní akce provede v¹e, co je nutno:
@ftable @code
@item speechd-speak-command-feedback @var{pøíkaz} @var{pozice} @var{reakce}
Definuj reakci na @var{pøíkaz}. @var{pøíkaz} je jméno interaktivní
funkce (pou¾ijte @kbd{C-h C-c} pro zji¹tìní jména pøíkazu navázaného
na urèitou klávesu).
@var{pozice} mù¾e být jeden ze symbolù @code{before} nebo @code{after}
pro vyvolání reakce pøed (@code{before}) nebo poté (@code{after}), co
je pøíkaz proveden.
@code{reakce} mù¾e být øetìzec nebo jakýkoliv elispový výraz.
Jedná-li se o@tie{}øetìzec (text uzavøený v@tie{}uvozovkách), definuje text
k@tie{}pøeøíkání nebo zvukovou ikonu k@tie{}pøehrání. Jestli¾e øetìzec zaèíná
hvìzdièkou (@code{*}), urèuje jméno zvukové ikony (hvìzdièka není
souèástí jména), jinak se jedná o@tie{}normální text.
Pøíklad:
@cindex @code{suspend-emacs}
@lisp
(speechd-speak-command-feedback suspend-emacs before "Suspenduji Emacs!")
@end lisp
Tento øádek elispového kódu mù¾ete vlo¾it do svého @file{~/.emacs},
èím¾ si zajistíte upozornìní o@tie{}vyvolání pøíkazu @code{suspend-emacs}
(obvykle navázaného @kbd{C-z}).
@item speechd-speak-function-feedback @var{funkce} @var{pozice} @var{reakce}
Toto je stejné jako @code{speechd-speak-command-feedback} a¾ na to, ¾e
@var{reakce} je vyvolána kdykoliv je vyvolána @code{funkce}, a» u¾
interaktivnì èi nikoliv. Navíc @code{funkce} mù¾e být jakákoliv
funkce, nejen interaktivní pøíkaz.
@end ftable
@emph{Prosím pozor:}
@itemize @bullet
@item
Kvùli urèitému nedostatku Emacsu nemusí popsaný mechanismus reakcí
správnì fungovat pro vestavìné funkce.
@item
Pokud si definujete vlastní reakce na funkce bez pou¾ití uvedených
maker, buïte opatrní. Uvedená makra definují kód zaji¹»ující, ¾e se
nic neøíká v@tie{}pøípadì vypnutého @code{speechd-speak-mode}, a@tie{}podobná
opatøení. Pokud tato makra nepou¾íváte, musíte si tato opatøení
zajistit sami.
@end itemize
@node Potí¾e, Tipy, Pokroèilá konfigurace, U¾ivatelská pøíruèka
@section Potí¾e, se kterými se mù¾ete setkat
@cindex potí¾e
@itemize @bullet
@cindex Info
@item
@emph{Proè se nepøeøíkávají nìkteré polo¾ky menu v@tie{}Info?}
Je to zpùsobeno tím, jakým zpùsobem Emacs umis»uje faces na polo¾ky
menu. Problém lze obejít nastavením hodnoty promìnné
@code{Info-fontify-maximum-menu-size} na @code{0}.
@cindex upozornìní na události
@cindex diáø
@item
@emph{Jakým zpùsobem lze Emacs pøimìt k@tie{}pøeøíkávání upozornìní na
události (appointments)?}
Nastavte promìnnou @code{appt-msg-window} na @code{nil}. Takté¾ mù¾e
být u¾iteèné pøidat do promìnné @code{speechd-speak-auto-speak-buffer}
øetìzec @code{"diary"}.
@cindex w3m-el
@cindex URL
@item
@emph{Jak zabránit vypisování URL pøi pohybu po lincích ve w3m-el?}
Pøidejte si do svého @file{~/.emacs} následující kód:
@lisp
(defadvice w3m-print-this-url (around my-w3m-print-this-url activate)
(when (eq this-command 'w3m-print-this-url)
ad-do-it))
@end lisp
@cindex opakované ètení
@item
@emph{V@tie{}nìkterých situacích, kdy je po provedení pøíkazu èten
modifikovaný text, je tento text èten po kusech a nìkteré
z@tie{}tìchto kusù jsou opakovány.}
Obsah bufferu se v@tie{}elispových programech mù¾e mìnit mnoha rùznými
zpùsoby. speechd-el nemù¾e uspokojivì o¹etøit v¹echny mo¾né takové
postupy. Pokud máte rozumný nápad, jak v@tie{}nìjaké situaci vylep¹it
ètení zmìn textu v@tie{}bufferu, øeknìte nám o@tie{}tom.
Pokud na tento problém narazíte u@tie{}nìkterého èasto provádìného
pøíkazu, mù¾ete si pro tyto pøíkazy definovat svoji vlastní øeèovou
odezvu. Více informací o@tie{}mo¾nostech definic vlastní øeèové
odezvy naleznete v@tie{}sekci @ref{Pokroèilá konfigurace}.
@item
@cindex prodlevy
@cindex garbage collection
@cindex @code{gc-cons-threshold}
@emph{Pøedtím, ne¾ se po pøíkazu nìco øekne, se obèas objevuje malá
prodleva (pøibli¾nì jednosekundová).}
Mo¾ná, ¾e Emacs bìhem prodlevy provádí garbage collection. Zkuste
zvý¹it hodnotu promìnné @code{gc-cons-threshold}, tøeba na 4000000.
Mù¾e to celkový výkon zvý¹it nebo sní¾it, v@tie{}závislosti na va¹em
prostøedí a konkrétních po¾adavcích.
Jste-li zku¹eným elispovým hackerem a doká¾ete zjistit, proè
speechd-el produkuje významné mno¾ství dat zpùsobujících zvý¹ení
frekvence provádìní garbage collection a jak nìco v@tie{}tomto smìru
vylep¹it, va¹e pomoc je vítána!
@item
@emph{Pøi pøidr¾ení klávesy @kbd{C-n} obrazovka na chvíli zamrzne a
kurzor se nepohybuje.}
Je-li Emacs zamìstnaný nìjakou èinností, není obecnì provádìna
aktualizace obrazovku. speechd-el je v@tie{}kombinaci s@tie{}vy¹¹í rychlostí
automatického opakování kláves schopno dosáhnout takového stavu
pomìrnì snadno. Pøedstavuje-li to pro vás skuteèný problém, mù¾ete si
sní¾it rychlost autorepeatu nebo poøídit rychlej¹í poèítaè.
Samozøejmì jsou vítány jakékoliv tipy, jak zvý¹it rychlost speechd-el.
@end itemize
@node Tipy, Oznamování chyb, Potí¾e, U¾ivatelská pøíruèka
@section U¾iteèné emacsové tipy
Nezapomeòte, ¾e Elisp vám umo¾òuje definovat si spoustu u¾iteèných
funkcí. Typicky si mù¾ete definovat pøíkazy oznamující nìjaké
informace, které jsou snadno identifikovatelné na emacsové obrazovce,
ale které nejsou tak dobøe rozpoznatelné v@tie{}øeèovém výstupu.
Nìkolik pøíkladù:
@itemize @bullet
@item
@emph{Oznamování aktuálního data v@tie{}kalendáøi:}
@cindex den v@tie{}kalendáøi
@lisp
(defun report-day ()
(interactive)
(message "%s" (calendar-date-string (calendar-cursor-to-date t))))
@end lisp
@item
@emph{Výpis aktuálních upozornìní na události z@tie{}diáøe:}
@cindex upozornìní na události
@lisp
(defun report-current-appointments ()
(interactive)
(let ((appt-now-displayed nil))
(appt-check)))
@end lisp
@end itemize
@node Oznamování chyb, , Tipy, U¾ivatelská pøíruèka
@section Jak oznamovat chyby speechd-el nebo Speech Dispatcher
@cindex chyby
Narazíte-li na chybu speechd-el, mù¾ete pro její oznámení pou¾ít
následující pøíkaz. Ale ne¾ tak uèiníte, pøeètìte si prosím celý text
této sekce, aby vámi oznámená chyba mohla být øe¹ena co
nejefektivnìji.
@ftable @kbd
@item M-x speechd-bug
@findex speechd-bug
Oznam chybu speechd-el nebo Speech Dispatcher. Pøíkaz se zeptá na
urèité informaci a pak se zeptá, zda chybu doká¾ete zreprodukovat.
Pokud doká¾ete, odpovìzte @kbd{y} a zaènìte chybu reprodukovat.
Ihned, jakmile je chyba zreprodukována, stisknìte @kbd{C-e C-f}.
Potom mù¾ete (a@tie{}mìli byste) dále zeditovat vygenerovaný e-mail a
odeslat jej obvyklým zpùsobem.
@item M-x speechd-bug-reproduce
@findex speechd-bug-reproduce
@kindex C-e C-f
Zahaj reprodukci chyby speechd-el nebo Speech Dispatcher. Od tohoto
okam¾iku jsou sledovány v¹echny akce u¾ivatele a Speech Dispatcher.
Reprodukce chyby se ukonèí stiskem kláves @kbd{C-e C-f}. Poté, co je
ukonèena, jsou do bufferu, kde byl pøíkaz @code{speechd-bug-reproduce}
vyvolán, vlo¾eny informace o@tie{}reprodukci chyby.
Tento pøíkaz je u¾iteèný v@tie{}pøípadì, kdy chcete poskytnout
informace o@tie{}chybì bez generování nového oznámení o@tie{}chybì.
@end ftable
Kdy¾ oznamujete chyby, mìjte prosím v¾dy na pamìti následující pokyny:
@itemize @bullet
@item
Napi¹te o@tie{}chybì co nejvíce informací. Popi¹te, co nefunguje,
jaké je vámi oèekávané chování, jaké akce chybu vyvolaly, co je
zvlá¹tního na va¹em Emacsovém prostøedí nebo konfiguraci Speech
Dispatcher, atd. Nesna¾te se pøíli¹ pøemý¹let nad tím, která
informace je dùle¾itá a která není --- pro vývojáøe mù¾e být dùle¾itá
ka¾dá informace, tak¾e nezapomeòte uvést cokoli, co mù¾e být
potenciálnì dùle¾ité. Radìji uvádìjte informací více ne¾ ménì.
Chybìjící informace mù¾e znamenat, ¾e vývojáøi nebudou schopni
s@tie{}chybou nic udìlat.
@item
Buïte co nejpøesnìj¹í. Neoèekávajte, ¾e vývojáøi znají kontext nebo
¾e ví, jakým zpùsobem Emacs a speechd-el pou¾íváte. Pou¾ívejte pøesné
popisy --- místo pouhého ``kdy¾ zavolám foo'' pi¹te lépe ``kdy¾
stisknu klávesy `M-x foo RET', èím¾ se vyvolá pøíkaz `foo' ''. Nebo
místo ``neøíká, co by mìlo'' pi¹te ``øíká `bla bla' místo oèekávaného
`ble ble ble', pøièem¾ `ble ble ble' je text celého èteného øádku''.
@item
Kdy¾ reprodukujete chybu, sna¾te se mít zapnuto logování Speech
Dispatcher na co nejvy¹¹í úroveò --- nastavte v@tie{}konfiguraèním
souboru @file{speechd.conf} volbu @code{LogLevel} na hodnotu @code{5}.
@item
Kdy¾ reprodukujete chybu, neprovádìjte ¾ádné nadbyteèné akce a
proveïte @kbd{C-e C-f} hned jak je chyba zreprodukována. Zabráníte
tak tomu, aby se podstatné informace získané z@tie{}logovacích souborù
utopily v@tie{}nadbyteèném balastu.
@item
Mù¾ete se také podívat na pokyny pro oznamování chyb Speech Dispatcher,
viz @ref{Reporting Bugs,,,speechd,Speech Dispatcher}.
@end itemize
@c ****************************************************************************
@node Elispová knihovna, Kontaktní informace, U¾ivatelská pøíruèka, Top
@chapter Elispová knihovna speechd-el
Momentálnì není ke knihovnì k@tie{}dispozici ¾ádný skuteèný programátorský
manuál. Podívejte se tedy prosím na dokumentaèní øetìzce dostupných
promìnných, funkcí a maker.
Nicménì se mù¾ete (a@tie{}mìli byste) øídit následujícími radami:
@itemize @bullet
@item
Nepou¾ívejte ¾ádné funkce, promìnné nebo jiné lispové objekty, jejich¾
jména zaèínají prefixem @code{speechd--} nebo @code{speechd-speak--}.
Tyto objekty jsou pova¾ovány za privátní a mohou se kdykoliv bez
upozornìní zmìnit nebo být zru¹eny.
@item
@vindex speechd-client-name
Jestli¾e chcete vybrat nebo vytvoøit konkrétní spojení, udìlejte to
prostøednictvím nastavení hodnoty promìnné @code{speechd-client-name}:
@lisp
(let ((speechd-client-name "nìco"))
... kód pou¾ívající spojení "nìco" ... )
@end lisp
Mìjte prosím na pamìti, ¾e obvykle není dobrým nápadem otevøít
souèasnì dvì spojení na Speech Dispatcher se shodným klientským
jménem.
@item
Jinak by na vás nemìly èíhat ¾ádná zvlá¹tní pøekvapení a jakýkoliv
rozumný kód by mìl být bezproblémový.
@end itemize
Mo¾ná vás je¹tì mù¾e zajímat @ref{Pokroèilá konfigurace}.
@c ****************************************************************************
@node Kontaktní informace, Kopírování tohoto manuálu, Elispová knihovna, Top
@chapter Kontaktní informace
@cindex autoøi
@cindex chyby
@cindex kontakty
Pokud chcete oznámit chybu speechd-el, za¹lete nám kompletní informaci
o@tie{}chybì na adresu @email{speechd-el@@bugs.freebsoft.org}. Pokud
nám chcete poslat záplatu speechd-el, mù¾ete pou¾ít tuté¾ adresu.
@emph{Prosíme}, pøed zasláním oznámení o@tie{}chybì si pøeètìte pokyny
pro oznamování chyb, see @ref{Oznamování chyb}. Budete-li se dr¾et
uvedenými radami, umo¾níte nám zpracovat va¹e oznámení o@tie{}chybì
efektivnìji a tím pádem s@tie{}lep¹í a rychlej¹í odezvou.
Máte-li jakékoliv otázky, námìty nebo cokoliv dal¹ího, co nám chcete
sdìlit, neváhejte se obrátit na adresu @email{speechd@@freebsoft.org}.
@c ****************************************************************************
@node Kopírování tohoto manuálu, Index, Kontaktní informace, Top
@appendix GNU Free Documentation License
@cindex FDL, GNU Free Documentation License
@center Version 1.2, November 2002
@include fdl.texi
@c ****************************************************************************
@node Index, , Kopírování tohoto manuálu, Top
@unnumbered Index
@printindex cp
@bye
@c LocalWords: chyph def ntprefix cs input comment of header documentlanguage
@c LocalWords: documentencoding VERSION el value end copying quotation is and
@c LocalWords: Permission granted distribute or modify this document under gc
@c LocalWords: the terms Documentation License Version any later version with
@c LocalWords: published Foundation Sections Cover Texts Back license section
@c LocalWords: included entitled Sound Emacsové Dispatcher title subtitle tie
@c LocalWords: author page contents node Elispová elispových chapter emacsový
@c LocalWords: itemize bullet Elispovou emacsové emacsových elispovou file
@c LocalWords: enumerate example make compile lisp speak nil code table ref
@c LocalWords: global toggle speaking subsection read other window word char
@c LocalWords: paragraph next previous last message cancel resume key rate
@c LocalWords: predefined connection language punctuation all none some icon
@c LocalWords: capital character spell voice number pitch output spelling say
@c LocalWords: sound repeat faces localhost timeout default notification name
@c LocalWords: important progress deleted buffers force self insert command
@c LocalWords: insertions one comint align signal empty beginning backward
@c LocalWords: properties face lock movement always never voices parameters
@c LocalWords: property customize add connections minibuffer area define hook
@c LocalWords: elispový feedback before after suspend emacs function garbage
@c LocalWords: collection cons threshold elispovým autorepeatu client protect
@c LocalWords: appendix November include unnumbered bye
speechd-el-2.6/speechd-el.texi 0000644 0001750 0001750 00000215377 12206216327 014440 0 ustar pdm pdm \input texinfo @c -*-texinfo-*-
@comment %**start of header
@setfilename speechd-el.info
@set VERSION 2.6
@settitle speechd-el @value{VERSION}
@syncodeindex fn cp
@syncodeindex ky cp
@syncodeindex vr cp
@comment %**end of header
@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 Milan Zamazal
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts and no Back-Cover Texts.
A copy of the license is included in the section entitled ``GNU Free
Documentation License.''
@end quotation
You can also (at your option) distribute this manual under the GNU
General Public License:
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
A copy of the license is included in the section entitled ``GNU
General Public License''.
@end quotation
@end copying
@dircategory Emacs
@direntry
* speechd-el: (speechd-el). Emacs interface to Speech Dispatcher and BRLTTY.
@end direntry
@titlepage
@title speechd-el
@subtitle for version @value{VERSION}
@author Milan Zamazal
@author Brailcom, o.p.s.
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@contents
@ifnottex
@node Top, Introduction, (dir), (dir)
@top speechd-el
@insertcopying
@end ifnottex
@menu
* Introduction:: What is speechd-el and this manual about?
* speechd-el User Manual:: Using Emacs speech output.
* speechd-el Elisp Library:: Using speechd-el in Elisp programs.
* Contact Information:: Bug reporting etc.
* Copying This Manual:: GNU Free Documentation License.
* Index:: Concept, function, variable and key index.
@end menu
@c ****************************************************************************
@node Introduction, speechd-el User Manual, Top, Top
@chapter Introduction
speechd-el is an Emacs client to speech synthesizers, Braille displays
and other alternative output interfaces. It provides full speech and
Braille output environment for Emacs.
It is aimed primarily at visually impaired users who need non-visual
communication with Emacs, but it can be used by anybody who needs
sophisticated speech or other kind of alternative output from Emacs.
speechd-el can make Emacs a completely speech and BRLTTY enabled
application suitable for visually impaired users or, depending on its
configuration, it can only speak in certain situations or when asked,
to serve needs of any Emacs user.
Programming interfaces are available both to the user interface and
for communication with the output devices.
This manual describes the speech/Braille output user interface, how to
customize and extend the interface, and the Emacs Lisp libraries.
Some degree of familiarity with Speech Dispatcher or BRLTTY on the
user level is recommended, although not absolutely necessary.
@menu
* Design Goals::
* Feature List::
* Components::
@end menu
@node Design Goals, Feature List, Introduction, Introduction
@section Design Goals
speechd-el was designed considering our experience with other free
accessibility technologies. We sometimes meet problems such as lack
of maintenance power, duplicated efforts, making technology specific
solutions instead of generally useful tools, important bugs. As other
@uref{http://www.freebsoft.org/projects,Free(b)soft projects}
speechd-el attempts to fill in an empty space in the accessibility
area, in a way oriented towards future. speechd-el tries to offer
technology that is useful, simple, supporting general accessibility
architecture models and that effectively utilizes the limited
accessibility development resources.
The particular speechd-el design goals are:
@itemize @bullet
@item
Providing advanced accessible user environment that works out of the
box and utilizes standard Emacs features wherever possible. Emacs
accessibility should work as much as possible on the general level
without necessity to implement direct support for particular Emacs
packages. speechd-el should also preferrably use standard Emacs
features if possible instead of implementing its own solutions.
@item
Implementing just the necessary functionality, without duplicating
features presented in other components such as Speech Dispatcher,
speech synthesizers or Braille APIs. Emacs accessibility solutions
should share features, configuration, code, etc. with other
applications to the highest possible extent in order to make life of
both users and developers easier.
@item
Simple and clean source code that requires only minimum maintenance
and allows future extensions.
@item
As little modifications to standard Emacs environment as possible,
with the possibility to make additional customizations if needed,
either shared or private. Emacs should work the same way whether it
speaks or not. Of course optional customizations can be made and the
generally useful ones should be included as optional parts of the
distribution.
@item
Ability to work well in a multilingual environment.
@item
Completely Free Software architecture, without requiring any
proprietary component.
@end itemize
@node Feature List, Components, Design Goals, Introduction
@section Feature List
Major speechd-el features are:
@cindex features
@itemize @bullet
@item
Speech output.
@item
Braille display output and input, mostly identical to the speech
output.
@item
Both automated and explicit reading. You can let Emacs read
everything and/or you can ask it to read some parts of the text (such
as current line, current buffer, last message, etc.).
@item
Message priorities ensuring you don't miss important messages while
you needn't listen to or view unimportant messages.
@item
``Intelligent'' and customizable selection of text to be read based on
lines, text properties, buffer contents changes and other criteria.
@item
Support for changing speech parameters (such as language, voice, rate,
pitch, volume, speech synthesizer). Different speech parameters can
be used in different buffers, major modes, faces, etc.
@item
Support for events (such as sound icons).
@item
Emacs status changes reporting (such as mode, keyboard, process
changes, etc.).
@item
Multilingual environment support. speechd-el works well with
languages other than English and offers support for current language
selection based on the kind of texts, selected keyboard, etc.
@item
Reasonable immediate speech and Braille output in most Emacs packages.
@item
No significant changes of the standard Emacs behavior.
@item
Speech and Braille output can be enabled/disabled independently to
each other and they can be enabled/disabled for the whole Emacs
session or just for particular buffers.
@item
Speech synthesizer independence, you can use all speech synthesizers
supported by Speech Dispatcher (such as Festival, Flite, eSpeak, Epos,
Dectalk, IBM TTS, Cicero, etc.) and you can use multiple speech
synthesizers inside a single Emacs session.
@item
Braille displays are handled through BRLTTY drivers and APIs.
@item
Programming libraries for those who want to extend speechd-el
facilities or who just want to talk to speech synthesizers, Braille
display or other output/input devices.
@item
Special features for speechd-el developers such as silence in
debugger, debugging variables, possibility to disable speechd-el
hooks, etc.
@item
Small code size.
@end itemize
See @uref{http://www.freebsoft.org/speechd-el,speechd-el web page} if
you are interested in comparison with Emacspeak.
@node Components, , Feature List, Introduction
@section Components
speechd-el design is strictly modular. It contains several components
layered each on top of other. Lower layer functions can be used
independently of higher level features.
@cindex SSIP
@cindex BrlAPI
The lowest level components are access libraries to output devices,
especially to SSIP (the Speech Dispatcher TCP communication protocol
for speech output) and BrlAPI (interface to BRLTTY drivers for
communication with Braille displays). They can be used to talk to the
output devices directly from Elisp programs.
The next level implements common access to all the devices. Instead
of talking to each device independently one can use this layer to
output device independent messages that are processed and sent to the
output devices as defined in the user configuration. This is the
preferred way of communication with the output devices.
On the highest level there is the user interface frontend that makes
Emacs read texts and events automatically, defines the corresponding
minor modes, key bindings and most of the interactive commands.
There are some other auxiliary components, look into speechd-el source
code if interested.
@c ****************************************************************************
@node speechd-el User Manual, speechd-el Elisp Library, Introduction, Top
@chapter speechd-el User Manual
speechd-el allows you to use Emacs without looking at screen, with
speech or Braille output only. The main usage area is by blind and
visually impaired people, but generally you can use at least the
speech output for many purposes, according to your wishes and needs.
You can download the latest released version of speechd-el from
@url{http://www.freebsoft.org/pub/projects/speechd-el/}.
speechd-el uses Speech Dispatcher for the speech output, so working
Speech Dispatcher installation is necessary to produce any speech
output. Please look at @url{http://www.freebsoft.org/speechd} for
more information about Speech Dispatcher.
@cindex BRLTTY
For the Braille output BRLTTY is used through its BrlAPI interface.
To make the Braille output work, BRLTTY must be running and properly
configured. Please look at @url{http://www.mielke.cc/brltty/} for
more information about BRLTTY.
@menu
* Installation:: Installing speechd-el.
* Starting Alternative Output:: Making it speak etc.
* Commands:: Usage.
* Customization:: Basic customization.
* Advanced Customization:: Writing your own command feedbacks.
* Problems:: Strange behavior.
* Tips:: Useful Emacs tips.
* Bug Reporting:: speechd-el and Speech Dispatcher bugs.
@end menu
@node Installation, Starting Alternative Output, speechd-el User Manual, speechd-el User Manual
@section Installation
speechd-el installation consists of the following steps:
@enumerate
@item
If you use Emacs older than 23.2 then install the @samp{eieio} Elisp
library, available from @url{http://cedet.sourceforge.net/eieio.shtml}
or perhaps your favorite operating system distribution.
@item
Copy the speechd-el @file{*.el} files contained in the distribution
package somewhere to your Emacs load path.
@item
If you like, byte compile the @file{*.el} files. Byte compilation is
recommended, because it speeds up speechd-el significantly. You can
byte compile the @file{*.el} files using the command
@example
make compile
@end example
Then install the compiled files to an Emacs load path location as
well.
@item
Install the @file{speechd-log-extractor} somewhere to your shell PATH,
e.g. @file{/usr/local/bin/}. Installing this script is optional, it
is used only for bug reporting.
@item
Add the following line to your @file{~/.emacs}:
@lisp
(autoload 'speechd-speak "speechd-speak" nil t)
@end lisp
@end enumerate
@cindex Speech Dispatcher
To receive speech output, Speech Dispatcher must be installed and
running. Speech Dispatcher version 0.5 or higher is recommended.
@cindex BRLTTY
To receive Braille output, BRLTTY must be installed and running.
BRLTTY version 3.7 or higher is required.
@node Starting Alternative Output, Commands, Installation, speechd-el User Manual
@section Starting Speech and Braille Output
After installation of the @file{*.el} files and restarting Emacs, you
can set up speechd-speak using the @kbd{M-x speechd-speak} command.
If you want to happen it automatically each time Emacs is started, put
the following line to your @file{~/.emacs} after the autoload line:
@lisp
(speechd-speak)
@end lisp
@table @kbd
@item M-x speechd-speak
@findex speechd-speak
@kindex C-e C-s
Set up Emacs for alternative output and start speaking or
communicating with the Braille display.
Please don't forget Speech Dispatcher must be running in order to get
any speech output and BRLTTY must be running in order to get Braille
output!
After the initial setup, the command can be used again to restart the
speech or Braille output when needed. Especially, you must run it
again if Speech Dispatcher or BRLTTY gets restarted.
After the first invocation, the command is available under the
@kbd{C-e C-s} key.
@end table
@cindex minor modes
Once the setup is done, enabling and disabling the alternative output
is controlled by the speechd-speak and global-speechd-speak minor
modes. Usually the mode commands are not used directly, you use the
@code{speechd-speak-toggle-speaking} command (@pxref{Control
Commands}), but if you need them, they are available.
@table @kbd
@item M-x speechd-speak-mode
@findex speechd-speak-mode
Enable or disable speaking and Braille output in the current buffer.
With no argument, this command toggles the mode. Non-null prefix
argument turns on the mode. Null prefix argument turns off the mode.
@item M-x global-speechd-speak-mode
@findex global-speechd-speak-mode
Enable or disable alternative output globally. With no argument, this
command toggles the mode. With prefix argument, turn alternative
output on if and only if the argument is positive.
@end table
@node Commands, Customization, Starting Alternative Output, speechd-el User Manual
@section Commands
The basic speechd-el commands are all accessible through a common
special prefix key, which is @kbd{C-e} by default (you can change it,
@pxref{Customization}). If this prefix conflicts with a global Emacs
command, the original command is available by double pressing the
prefix key. For instance, with the default prefix, the
@code{end-of-line} command, normally available under the @kbd{C-e}
key, can be invoked as @kbd{C-e C-e}.
In the following subsections we use the term @emph{reading} to
indicate any kind of output enabled in speechd-el (such as speaking or
Braille output).
@menu
* Reading Commands:: Reading pieces of text.
* Informatory Commands:: Information about buffer, modes, etc.
* Control Commands:: Stopping, setting speech rate, etc.
* Parameter Setting Commands:: Modifying speech output.
* Spelling:: How to spell a piece of text.
* Other Commands:: Auxiliary commands.
@end menu
@node Reading Commands, Informatory Commands, Commands, Commands
@subsection Reading Commands
@table @kbd
@item C-e l
@kindex C-e l
@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.
@item C-e b
@kindex C-e b
@findex speechd-speak-read-buffer
Read current buffer (@code{speechd-speak-read-buffer}).
@item C-e >
@kindex C-e >
@findex speechd-speak-read-rest-of-buffer
Read current buffer from the cursor to the buffer end
(@code{speechd-speak-read-rest-of-buffer}).
@item C-e o
@kindex C-e o
@findex speechd-speak-read-other-window
Read buffer of the other window, if any is present
(@code{speechd-speak-read-other-window}).
@item C-e r
@kindex C-e r
@findex speechd-speak-read-region
Read current region (@code{speechd-speak-read-region}).
@item C-e C-r
@kindex C-e C-r
@findex speechd-speak-read-rectangle
Read text in the rectangle-region (@code{speechd-speak-read-rectangle}).
@item C-e w
@kindex C-e w
@findex speechd-speak-read-word
Read the next word after cursor (@code{speechd-speak-read-word}).
@item C-e .
@kindex C-e .
@findex speechd-speak-read-sentence
Read current sentence (@code{speechd-speak-read-sentence}).
@item C-e @{
@kindex C-e @{
@findex speechd-speak-read-paragraph
Read the next paragraph after cursor (@code{speechd-speak-read-paragraph}).
@item C-e [
@kindex C-e [
@findex speechd-speak-read-page
Read the next page after cursor (@code{speechd-speak-read-page}).
@item C-e '
@kindex C-e '
@findex speechd-speak-read-sexp
Read the next symbolic expression after cursor
(@code{speechd-speak-read-sexp}).
@item C-e c
@kindex C-e c
@findex speechd-speak-read-char
Read the character at the cursor position (@code{speechd-speak-read-char}).
@item C-e C-n
@kindex C-e C-n
@findex speechd-speak-read-next-line
Read the next line (@code{speechd-speak-read-next-line}).
@item C-e C-p
@kindex C-e C-p
@findex speechd-speak-read-previous-line
Read the previous line (@code{speechd-speak-read-previous-line}).
@item C-e m
@kindex C-e m
@findex speechd-speak-last-message
Read last seen Emacs message (@code{speechd-speak-last-message}).
@item C-e RET
@cindex mode line
@kindex C-e RET
@findex speechd-speak-read-mode-line
Read the mode line (@code{speechd-speak-read-mode-line}). Note: This
command works only in Emacs@tie{}22 or higher.
@item C-e i
@kindex C-e i
@findex speechd-speak-last-insertions
Read last output buffer insertions
(@code{speechd-speak-last-insertions}). That is the text read in
auto-reading buffers, see @xref{Auto-Reading Buffers}.
@end table
@cindex character reading prompts
@cindex read-char
A few Emacs commands get you stuck in a character reading prompt, a
typical example is @code{ispell-word}. If you miss what was read
before you are prompted for action, you can use the following
keystrokes at the prompt to repeat the output texts:
@table @kbd
@item C-e
@findex speechd-speak-last-message
The same as the @kbd{C-e m} command above
(@code{speechd-speak-last-message}).
@item C-a
@findex speechd-speak-last-insertions
The same as the @kbd{C-e i} command above
(@code{speechd-speak-last-insertions}).
@end table
If you don't like such character reading prompt behavior, you can
disable it using the following variable:
@vtable @code
@item speechd-speak-allow-prompt-commands
If non-@code{nil}, allow the speechd-speak commands mentioned above in
read-char prompts.
@end vtable
@node Informatory Commands, Control Commands, Reading Commands, Commands
@subsection Informatory Commands
@table @kbd
@item C-e C-i b
@findex speechd-speak-buffer-info
@cindex buffer
Read information about current buffer
(@code{speechd-speak-buffer-info}).
@item C-e C-i f
@findex speechd-speak-frame-info
@cindex frame
Read information about current frame (@code{speechd-speak-frame-info}).
@item C-e C-i h
@findex speechd-speak-header-line-info
@cindex header line
Read contents of the header line
(@code{speechd-speak-header-line-info}). Note: This command works
only in Emacs@tie{}22 or higher.
@item C-e C-i m
@findex speechd-speak-mode-info
@cindex modes
Read information about current major and minor modes
(@code{speechd-speak-mode-info}).
@item C-e C-i c
@findex speechd-speak-coding-info
@cindex coding systems
Read information about current coding systems
(@code{speechd-speak-coding-info}).
@item C-e C-i i
@findex speechd-speak-input-method-info
@cindex input method
Read information about current input method
(@code{speechd-speak-input-method-info}).
@item C-e C-i p
@findex speechd-speak-process-info
@cindex process
Read status of the process associated with the current buffer
(@code{speechd-speak-process-info}).
@end table
@node Control Commands, Parameter Setting Commands, Informatory Commands, Commands
@subsection Control Commands
@table @kbd
@item C-e q
@kindex C-e q
@findex speechd-speak-toggle-speaking
@cindex shutting up
Toggle reading globally (@code{speechd-speak-toggle-speaking}). With
a prefix argument, toggle it in the current buffer only.
@item C-e s
@kindex C-e s
@findex speechd-stop
@cindex stop
Stop reading current message (@code{speechd-stop}). Other queued
messages will still be read. If the prefix argument is given, stop
reading the current message of any client, not just of the current
connection.
@item C-e x
@kindex C-e x
@findex speechd-cancel
@cindex stop
Stop reading all the queued messages of the current connection and of
the connections listed in @var{speechd-cancelable-connections}. If
the universal prefix argument is given, stop reading all the messages
of all connections. If a numeric prefix argument is given, stop all
the messages of the current Emacs session.
@item C-e p
@kindex C-e p
@findex speechd-pause
@cindex pause
Pause reading --- just be quiet for now and postpone current reading
until the resume command is invoked (@code{speechd-pause}). If the
prefix argument is given, pause reading of all clients.
@item C-e SPC
@kindex C-e SPC
@findex speechd-resume
@cindex resume
Resume paused reading (@code{speechd-resume}). If the
prefix argument is given, resume reading of all clients.
@item C-e 1
@itemx C-e 2
@itemx C-e 3
@itemx C-e 4
@itemx C-e 5
@itemx C-e 6
@itemx C-e 7
@itemx C-e 8
@itemx C-e 9
@kindex C-e 1
@kindex C-e 2
@kindex C-e 3
@kindex C-e 4
@kindex C-e 5
@kindex C-e 6
@kindex C-e 7
@kindex C-e 8
@kindex C-e 9
@findex speechd-speak-key-set-predefined-rate
@cindex rate
Set one of the predefined speech rates
(@code{speechd-speak-key-set-predefined-rate}). @kbd{C-e 1} sets the
slowest rate, @kbd{C-e 5} sets the medium rate, and @kbd{C-e 9} sets
the fastest rate.
@end table
@node Parameter Setting Commands, Spelling, Control Commands, Commands
@subsection Parameter Setting Commands
@cindex parameters
These commands set various properties of the speech output. They all
apply on the current Speech Dispatcher connection (for more
information about Speech Dispatcher connections, @pxref{Connection
Voices}), unless there are invoked with a prefix argument. With a
numeric prefix argument they apply on all speechd-el connections, with
a universal prefix argument they apply on all Speech Dispatcher
connections.
Commands affecting basic parameters of the text-to-speech process:
@table @kbd
@item C-e d l
@kindex C-e d l
@findex speechd-speak-set-language
@cindex language
Set default language of the connection. Specify it as an RFC 1766
language code (e.g. @code{en}, @code{cs}, etc.).
@item C-e d .
@kindex C-e d .
@findex speechd-set-punctuation-mode
@cindex punctuation mode
Specify how to handle punctuation, whether to read it or ignore it.
@code{all} mode reads all punctuation characters, @code{none} mode
skips them all quietly, and @code{some} mode reads a selected subset
of punctuation characters specified in the Speech Dispatcher
configuration.
@item C-e d c
@kindex C-e d c
@findex speechd-set-capital-character-mode
@cindex capital character mode
Set capital letter indication mode. @code{icon} means signal them
with a sound icon, @code{spell} means spell them using a special
spelling table, and @code{none} means no indication.
@end table
Commands affecting speech output properties:
@table @kbd
@item C-e d v
@kindex C-e d v
@findex speechd-set-voice
@cindex voice
Set default voice to be used by the synthesizer
(@code{speechd-set-voice}). You may select one from the voice set
offered by your Speech Dispatcher installation.
@item C-e d C-v
@kindex C-e d C-v
@findex speechd-set-synthesizer-voice
@cindex voice
Set default voice to be used by the synthesizer directly by its
synthesizer dependent name (@code{speechd-set-synthesizer-voice}).
You may select one from the voice set offered by the currently
selected Speech Dispatcher output module. This works only with Speech
Dispatcher 0.6.3 or higher and not all Speech Dispatcher output
modules support this function.
@item C-e d r
@kindex C-e d r
@findex speechd-set-rate
@cindex rate
Set exact speech rate, ranging from -100 (slowest) to 100 (fastest)
(@code{speechd-set-rate}). Most often you will probably want to
use the @code{speechd-speak-key-set-predefined-rate} command bound to
@kbd{C-e @var{number}} instead, see @ref{Control Commands}.
@item C-e d p
@kindex C-e d p
@findex speechd-set-pitch
@cindex pitch
Set voice pitch, ranging from -100 (lowest) to 100 (highest)
(@code{speechd-set-pitch}).
@item C-e d V
@kindex C-e d V
@findex speechd-set-volume
@cindex volume
Set voice volume, ranging from -100 (lowest) to 100 (highest)
(@code{speechd-set-volume}).
@end table
Commands affecting the speech synthesizer:
@table @kbd
@item C-e d o
@kindex C-e d o
@findex speechd-set-output-module
@cindex output module
Switch Speech Dispatcher to the given output module
(@code{speechd-set-output-module}). Give the module name when
you are prompted for the argument.
@end table
@node Spelling, Other Commands, Parameter Setting Commands, Commands
@subsection Spelling
@cindex spelling
@cindex speechd-speak-spell-mode
There are two ways to use spelling in speechd-el. The first one is
the @code{speechd-speak-spell-mode}, which is a minor mode that you
can enable for a buffer. The mode is useful if you want to spell more
of the buffer contents.
The second spelling method is using the following command:
@table @kbd
@item C-e C-l
@kindex C-e C-l
@findex speechd-speak-spell
Cause the following command to spell the text it reads
(@code{speechd-speak-spell}). For instance, if you want to spell the
word after the cursor, you can type @kbd{C-e C-l C-e w}.
@end table
@node Other Commands, , Spelling, Commands
@subsection Other Commands
@kindex C-x C-c
In case Emacs gets completely crazy and refuses to run commands
including @kbd{C-x C-c} because of a bug in speechd-el or in an
alternative output related custom definition, you can try to invoke
the following command as the last resort:
@table @kbd
@item C-e C-x
@kindex C-e C-x
@findex speechd-unspeak
@cindex recovery
Try to disable all modes, hooks and wrappers installed by
@code{speechd-speak} (@code{speechd-unspeak}).
@end table
The following commands are rarely used, mostly for diagnosing
purposes:
@table @kbd
@item C-e z
@kindex C-e z
@findex speechd-repeat
Repeat the last output text
(@code{speechd-repeat}).
@item M-x speechd-say-text
@findex speechd-say-text
Prompt for a text and read it.
@end table
@node Customization, Advanced Customization, Commands, speechd-el User Manual
@section Customization
All the customization options described below are accessible in the
customization group @samp{speechd-el} and its subgroups.
@menu
* Driver Selection:: Choosing output devices.
* Connection Setup:: Where to connect to.
* Default Priorities:: Priorities of various kinds of messages.
* Basic Speaking:: Simple options.
* Auto-Reading Buffers:: Making certain buffers speak automatically.
* Reading State:: Speaking Emacs state changes.
* Signalling:: Signalling empty lines, etc.
* Text Properties:: Handling faces and special pieces of text.
* Languages:: Using multiple languages.
* Voices:: Defining different voices.
* Connection Voices:: Setting connection parameters.
* Multiple Connections:: Different parameters for some modes & buffers.
* Keys:: Customizing command keys.
* Braille Display Keys:: Binding actions to Braille display keys.
* Modes:: Minor mode hooks.
* Debugging:: Make debugger quiet.
@end menu
@node Driver Selection, Connection Setup, Customization, Customization
@subsection Selecting Drivers
By default speechd-el speaks to @code{ssip} and @code{brltty}
drivers. You can change the set of active drivers by customizing the
following variable:
@vtable @code
@item speechd-out-active-drivers
List of names of active output drivers.
@end vtable
If a driver that does not work is present in the variable (e.g. the
list contains the @code{brltty} symbol while BRLTTY is not actually
running), you receive an error message. To prevent the error message,
remove the driver from this variable.
When you want to enable or disable some driver temporarily, you can
use the following commands:
@ftable @kbd
@item M-x speechd-out-enable-driver
@findex speechd-out-enable-driver
Enable the given output driver.
@item M-x speechd-out-disable-driver
@findex speechd-out-disable-driver
Disable the given output driver.
@end ftable
@node Connection Setup, Default Priorities, Driver Selection, Customization
@subsection Speech Dispatcher Connection Configuration
Connection configuration variables allow you connect to Speech
Dispatcher or BRLTTY running on a remote host or a non-default port
and to specify other TCP connection parameters.
Speech Dispatcher connection options:
@vtable @code
@item speechd-connection-method
Connection method to Speech Dispatcher. Possible values are symbols
@code{unix-socket} for Unix domain sockets and @code{inet-socket} for
Internet sockets on a given host and port.
@item speechd-host
@cindex host
Name of the host running Speech Dispatcher to connect to, given as a
string. Default is either the contents of the shell variable
@code{SPEECHD_HOST} variable if set, or @code{"localhost"}. Value of
this variable matters only when Internet sockets are used for
communication with Speech Dispatcher.
@item speechd-port
@cindex port
Port number to connect to. Default is either the contents of the
shell variable @code{SPEECHD_PORT} if set, or the default Speech
Dispatcher port. Value of this variable matters only when Internet
sockets are used for communication with Speech Dispatcher.
@item speechd-autospawn
If non-@code{nil}, Emacs will attempt to automatically start Speech
Dispatcher. This means that if speechd-el gets a speech request and
the Speech Dispatcher server is not running already, speechd-el will
launch it.
@item speechd-timeout
@cindex timeout
Maximum number of seconds to wait for a Speech Dispatcher answer. If
it is exceeded, speechd-el closes the connection. Normally, Speech
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:
@vtable @code
@item brltty-default-host
Name of the host running BRLTTY to connect to, given as a string.
Default is @code{"localhost"}.
@item brltty-default-port
Port number to connect to. It can be either a single number or a list
of numbers; in the latter case the given port numbers are attempted in
the order they are given until Emacs connects to something. Default
is the list of the standard BrlAPI ports.
@item brltty-authentication-file
File containing the BrlAPI authentication key. It is important to set
the variable properly, otherwise the connection to BRLTTY gets
rejected. Default is @code{"/etc/brlapi.key"}.
@item brltty-coding
Coding in which texts should be sent to BRLTTY. Default is
@code{iso-8859-1}; if you use non-Western language, you may need to
change it to display its characters correctly on the Braille display.
@item brltty-tty
Number of the Linux console on which speechd-el runs. If this value
is not set correctly, speechd-el may not interact well with other
applications communicating with BRLTTY. speechd-el tries to find the
correct value itself, if this doesn't work, set this variable properly
or set the @code{CONTROLVT} environment variable.
@item brltty-timeout
Maximum number of seconds to wait for a BRLTTY answer. If it is
exceeded, speechd-el closes the connection. Normally, BRLTTY should
answer protocol commands immediately, but if you talk to BrlAPI in a
strange way through a lagging network, you may want to increase the
limit.
@end vtable
@node Default Priorities, Basic Speaking, Connection Setup, Customization
@subsection Default Priorities
@cindex priorities
If a speechd-el function sends a message to the output device without
an explicitly specified priority, the priorities defined by the
following variables are used. By changing the values, you can achieve
interesting effects. For instance, changing the value of
@code{speechd-default-key-priority} from @code{notification} to
@code{message} makes all typed characters to be echoed and makes them
to interrupt common text reading.
The valid values of all the variables here are: @code{important},
@code{message}, @code{text}, @code{notification}, @code{progress}.
They correspond to Speech Dispatcher priorities, see the Speech
Dispatcher manual for more details.
@vtable @code
@item speechd-default-text-priority
Default priority of most text messages.
@item speechd-default-sound-priority
Default priority of sound icons.
@item speechd-default-char-priority
Default priority of spelled characters.
@item speechd-default-key-priority
Default priority of typed keys.
@end vtable
@node Basic Speaking, Auto-Reading Buffers, Default Priorities, Customization
@subsection Basic Customization of Speaking
@vtable @code
@item speechd-speak-echo
@cindex echoing
Symbol determining how to read typed characters. It can have one of
the following values:
@table @code
@item character
Read characters when they are typed.
@item word
Read only whole words once they are written.
@item nil
Don't echo anything on typing.
@end table
@item speechd-speak-deleted-char
@cindex deletions
Defines which character to speak when deleting a character. If
non-@code{nil}, speak the deleted character, otherwise speak the
adjacent character.
@item speechd-speak-buffer-name
@cindex buffer names
When you switch to another buffer and this variable is non-@code{nil},
read the new buffer name. If the variable value is the symbol
@code{text}, read the text from the cursor position to the end of
line in the new buffer as well. If the variable is @code{nil}, read
the text without speaking the buffer name.
@item speechd-speak-whole-line
@cindex line reading
If non-@code{nil}, read whole line on movement by default. Otherwise
read from the point to the end of line on movement by default.
@item speechd-speak-on-minibuffer-exit
@cindex minibuffer
When this variable is non-@code{nil}, speechd-el reads the text around
cursor after exiting from minibuffer or its recursive level if there
is nothing else to read.
@item speechd-speak-read-command-keys
@cindex command keys
@cindex keys
This variable defines in which situations command keys should be read
when their command is performed. If @code{t}, the command keys are
always read. If @code{nil}, they are never read. If list, it may
contain one or more of the following symbols describing the situations
in which the keys should be read:
@table @code
@item movement
Read the command keys if the cursor has moved, no buffer modification
happened.
@item modification
Buffer was modified, the cursor hasn't moved.
@item movement-modification
Buffer was modified and the cursor was moved.
@end table
If the variable value is @code{t}, the command keys are read before
the command is performed. Otherwise, their reading is delayed after
the command is executed, since the buffer changes and cursor movement
must be detected first.
@item speechd-speak-ignore-command-keys
@cindex command keys
@cindex keys
List of commands that should never echo their command keys.
@item speechd-speak-read-command-name
@cindex command name
If non-@code{nil}, read the command name instead of the command keys
in the situations defined by the variable
@code{speechd-speak-read-command-keys}.
@item speechd-speak-message-time-interval
@cindex messages
@cindex repeating
Minimum time in seconds, after which the same message may be repeated.
If the message is the same as the last one, it is not spoken unless the number
of seconds defined here has passed from the last spoken message.
@end vtable
@node Auto-Reading Buffers, Reading State, Basic Speaking, Customization
@subsection Auto-Reading Buffers
@cindex buffers
@cindex inserted text
It sometimes useful to start reading some buffers without user's
explicit request. For instance, if a help command is invoked, the
user usually wants to read the help text immediately. The following
variables contain lists of names of the buffers that may be read
automatically if they get changed by the last command and are visible
in some window of the current frame.
@vtable @code
@item speechd-speak-auto-speak-buffers
Content of these buffers is read after the command on the above
conditions if nothing else (e.g. text around a new cursor position) is
to be read.
@item speechd-speak-force-auto-speak-buffers
Like @code{speechd-speak-auto-speak-buffers} except that the buffer
content is read forcibly, even when something else could be read.
@end vtable
The following variables define how to handle texts inserted during
performing user commands. Only newly inserted text is read, the
options don't affect processing of deleted text. Also, the options
don't affect insertions within commands processed in a special way by
speechd-el or user definitions, like @code{self-insert-command}.
@vtable @code
@item speechd-speak-buffer-insertions
Defines whether insertions in the current buffer should be read
automatically. The value may be one of the following symbols:
@table @code
@item nil
Don't read the inserted texts.
@item t
Read all the inserted texts.
@item one-line
Read only the first lines of inserted texts.
@item whole-buffer
Read whole buffer if it was modified in any way.
@end table
@item speechd-speak-insertions-in-buffers
List of names of buffers, in which insertions are automatically
read, whether the buffer is current or not and regardless the
@code{speechd-speak-buffer-insertions} variable.
@item speechd-speak-priority-insertions-in-buffers
List of names of buffers, in which insertions are automatically read
immediately as they appear, not only after a command is evaluated as
with @code{speechd-speak-insertions-in-buffers}. This is typically
useful in comint buffers.
@item speechd-speak-align-buffer-insertions
If non-@code{nil}, the insertion text to be read is extended to the
beginning of the first word affected by the insertion. This is
particularly useful in completion functions.
@end vtable
If the last command modified the current buffer and moved its cursor
to a completely different position, the new cursor position is not
indicated in the alternative output. You can change it through the
following variable:
@vtable @code
@item speechd-speak-movement-on-insertions
If @code{t}, read the text around new cursor position even when the
current buffer was modified. If @code{read-only}, read it only in
read-only buffers. If @code{nil}, don't read it.
@end vtable
@node Reading State, Signalling, Auto-Reading Buffers, Customization
@subsection Reading State Changes
speechd-el can read information about current Emacs state, like
current buffer name, major and minor modes or other buffer attributes,
see @xref{Informatory Commands}. Changes in the Emacs state
information can be reported automatically, according to the user
configuration:
@vtable @code
@item speechd-speak-state-changes
List of identifiers of the Emacs state changes to be automatically
reported. The following symbols are recognized as state change
identifiers:
@table @code
@item buffer-name
@item buffer-identification
(only in Emacs@tie{}22 or higher)
@item buffer-modified
@item buffer-read-only
@item frame-name
@item frame-identification
(only in Emacs@tie{}22 or higher)
@item header-line
(only in Emacs@tie{}22 or higher)
@item major-mode
@item minor-modes
@item buffer-file-coding
@item terminal-coding
@item input-method
@item process
@end table
@item speechd-speak-display-modes
List of minor modes to be read by their display string rather than
name. To use the display form of a mode identification may be useful
in cases when the display form is more concise than the mode name or
when the display form changes without actual change of the mode.
@end vtable
@node Signalling, Text Properties, Reading State, Customization
@subsection Signalling
@cindex icons
Certain situations may be signalled by icons. @dfn{Icon} is typically
a short sound or a special indication on a Braille
display@footnote{Icons are not yet implemented this way in the Braille
library, plain texts are displayed instead.} signalling some event
(such as displaying a message, entering prompt, or reaching an empty
line). The following variable enables or disables the predefined
indications. To learn how to define your own indications,
@xref{Advanced Customization}.
@vtable @code
@item speechd-speak-signal-events
List of symbols, containing names of events to signal with an icon.
The following event names are supported:
@table @code
@item start
Start or restart of speechd-el.
@item empty
@cindex empty text
Empty text in various situations.
@item beginning-of-line
@cindex line
@cindex beginning of line
Reaching beginning of line after the
@code{forward-char} and @code{backward-char} commands.
@item end-of-line
@cindex end of line
Reaching end of line after the
@code{forward-char} and @code{backward-char} commands.
@item minibuffer
Entering minibuffer.
@item message
Messages in echo area follow.
@end table
@end vtable
@node Text Properties, Languages, Signalling, Customization
@subsection Text Properties
@cindex text properties
@cindex faces
@cindex cursor
@cindex movement
By default, after a movement command speechd-el reads the current
line. But if the cursor position is surrounded by a text having text
properties (typically faces, but any text properties count),
speechd-el may read just the piece of the text around the cursor
having uniform properties.
Also, if font lock mode is enabled, faces may be mapped to different
voices.
@vtable @code
@item speechd-speak-by-properties-on-movement
Method of selection of the piece of text to be read on movement.
The variable may take one of the following values.
@table @asis
@item @code{nil}
Text properties are not considered at all.
@item @code{t}
All text properties are considered.
@item list of faces
Only the named faces are considered.
@end table
@item speechd-speak-by-properties-always
List of commands that always consider text properties, even when the
@code{speechd-speak-by-properties-on-movement} variable is @code{nil}.
@item speechd-speak-by-properties-never
List of commands that never consider text properties, even when the
@code{speechd-speak-by-properties-on-movement} variable is
non-@code{nil}.
@item speechd-speak-faces
This variable allows you to invoke actions when the cursor ends up on
a certain face after a user command is performed. The variable value
is an alist with elements of the form @code{(@var{face}
. @var{action})}.
If a movement command leaves the cursor on a @var{face} and there is
no explicit reading bound to the command, @var{action} is invoked.
If @var{action} is a string, that string is read. If @var{action}
is a function, it is invoked, with no arguments.
@item speechd-face-voices
Mapping of faces to voices. The variable value is an alist with
elements of the form @code{(@var{face} . @var{voice})} where
@var{face} is a face and @var{voice} is a voice identifier defined in
@code{speechd-voices}, see @ref{Voices}. Each face is spoken in the
corresponding voice. If there's no item for a given face in this
variable, the face is spoken in the current voice.
Note that the mapping takes the effect only if font lock mode is
enabled.
@end vtable
@node Languages, Voices, Text Properties, Customization
@subsection Using multiple languages
@cindex languages
You can use speechd-el with multiple languages. However, the process
can't be easily automated, since ordinary text does not contain any
information about its language. So if you want to use speechd-el with
the output being spoken in multiple languages, you must provide
speechd-el some hints.
The language settings described below currently apply only to the
spoken output, to select the proper voice. They don't affect the
Braille output; but you may want to set language coding for Braille,
@xref{Connection Setup}.
@vindex speechd-language
@cindex RFC 1766
The basic means for providing language information to speechd-el is
the variable @code{speechd-language}. Each time speechd-el is about
to speak a piece of text, it checks the variable for the language code
and if it is non-@code{nil}, it speaks the text in the corresponding
language. The non-@code{nil} value must be a string of the RFC 1766
language code (e.g. @code{en}, @code{cs}, etc.).
Most often you will probably want to set the variable in a particular
file, see @ref{File Variables,,,emacs,GNU Emacs Manual}, or as a
buffer local variable, see @ref{Locals,,,emacs,GNU Emacs
Manual}, in mode hooks, see @ref{Hooks,,,emacs,GNU Emacs Manual}.
@findex speechd-language
@cindex @code{language} text property
If a piece of the text has the @code{language} property containing the
RFC 1766 language code, it is spoken in the corresponding language,
regardless of other settings. You can use the @code{speechd-language}
function to put the property on a string in your Elisp programs.
Another good way of using multiple languages is to use multiple
connections for separating language dependent buffers or modes, see
@ref{Multiple Connections}, and to set the @code{language} parameter
for each such a connection, see @ref{Connection Voices}.
If nothing helps better, you can select languages according to the
current input method:
@vtable @code
@item speechd-speak-input-method-languages
Alist mapping input methods to languages. Each of the alist elements
is of the form @code{(@var{input-method-name} . @var{language})},
where @var{input-method-name} is a string naming the input method and
@var{language} is an RFC 1766 language code accepted by SSIP
(e.g. @code{en}, @code{cs}, etc.). If the current input method is
present in the alist, the corresponding language is selected unless
overridden by another setting.
@end vtable
@node Voices, Connection Voices, Languages, Customization
@subsection Defining voices
@cindex voices
@cindex parameters
You can define special voices in speechd-el that can be used in
different situations, e.g. to speak different faces in different
voices (@pxref{Text Properties}) or to set different punctuation modes
for different kinds of buffers (@pxref{Multiple Connections}).
speechd-el voices define not only basic voice characteristics, but
also speech characteristics like pitch or rate and special properties
like punctuation reading or capital character signalization.
Voice definition is contained in the following variable:
@vtable @code
@item speechd-voices
Alist of voice identifiers and their parameters.
Each element of the list is of the form @code{(@var{voice-id}
. @var{parameters})}, where @var{voice-id} is a symbol under which the
voice will be accessed and @var{parameters} is an alist of parameter
identifiers and parameter values. Valid parameter names are the
following symbols: @code{language}, @code{gender}, @code{age},
@code{style}, @code{name}, @code{rate}, @code{pitch}, @code{volume},
@code{punctuation-mode}, @code{capital-character-mode},
@code{message-priority}, @code{output-module}. Please note that any
parameter entry present will change the corresponding parameter, even
if the parameter value is @code{nil} or empty; if you don't want to
change the parameter in any way by the voice, don't put it to the list
(and don't enable its entry in customize).
@code{name} value is a string identifying Speech Dispatcher voice
name. If it is not given, the parameters @code{gender}, @code{age},
and @code{style} are considered to select a Speech Dispatcher voice.
@code{gender} value can be one of the symbols @code{male},
@code{female}, @code{neutral}. @code{age} can be one of the symbols
@code{middle-adult}, @code{child}. @code{neutral}. @code{style} can
be one of the numbers @code{1}, @code{2}, @code{3} (@code{style}
values are likely to be changed in future).
The @code{message-priority} parameter sets priority of any message of
the voice. Its value is any of the message priority symbols.
See the corresponding @code{speechd-set-*} functions for valid values
of other parameters.
The voice named @code{nil} is special, it defines a default voice.
Explicit definition of its parameters is optional.
@end vtable
@node Connection Voices, Multiple Connections, Voices, Customization
@subsection Connection Voices
@cindex voices
With the help of the following variable you can let set various
connection parameters, like speech rate, language, etc.,
automatically. speechd-el can open multiple connections according to
various criteria (@pxref{Multiple Connections}), you can set different
parameters to different connections, based on their names.
@vtable @code
@item speechd-connection-voices
Alist of connection names and corresponding voices. Each list element
is of the form @code{(@var{connection-name} . @var{voice})}, where
@var{connection-name} is a connection name given as a string and
@var{voice} is a voice identifier defined in the variable
@code{speechd-voices}.
The default voice (named @code{nil}) is used for connections that are
not present in this variable.
@end vtable
So that changing the value of the variable could take the full effect,
the open connections must be reopened. Unless you use the
customization interface, you must invoke the @kbd{C-u M-x
speechd-speak} command to ensure this.
There is a command to help you with setting connection voice and its
parameters:
@table @kbd
@item C-e C-a
@kindex C-e C-a
@findex speechd-add-connection-settings
Store the current connection parameters to a specified voice in the
@code{speechd-voices} variable and set that voice for the current
connection in the @code{speechd-connection-voices} variable.
Please note you are still responsible to save the variables if you
want to use them in future sessions.
@end table
@node Multiple Connections, Keys, Connection Voices, Customization
@subsection Multiple Connections
@cindex connections
You can arrange speechd-el to use separate connections to Speech
Dispatcher for certain buffers or major modes. This is basically
useful to allow independent parameter setting for those buffers and
major modes, both by hand and through the configuration
(@pxref{Connection Voices}).
Each Speech Dispatcher connection has its unique name. By default,
speechd-el uses a connection named @code{"default"}. All you need to
create a separate connection is to let speechd-el choose a different
connection name in certain situations. The process of connection name
selection is driven by the @code{speechd-speak-connections} variable.
@vtable @code
@item speechd-speak-connections
Alist mapping major modes and buffers to Speech Dispatcher
connections. Each element of the alist is of the form
@code{(@var{mode-or-buffer} . @var{connection-name})}.
When speechd-el wants to send a message, it tests the current
environment against the @var{mode-or-buffer} entries.
@var{mode-or-buffer} may be one of the following objects, in the order
of priority from the highest to the lowest:
@itemize @bullet
@item
a list, representing a function call that should return a
non-@code{nil} value if and only if the element should be applied
@item
regular expression matching desired buffer names
@item
the symbol @code{:minibuffer}, representing minibuffers
@item
major mode symbol
@item
@code{nil}, representing non-buffer areas, e.g. echo area
@item
@code{t}, representing the default value if nothing else matches
@end itemize
If more entries match in some situation, the entry with the highest
priority is used.
@var{connection-name} is an arbitrary non-empty string naming the
corresponding connection. If no connection with such a name is open
in the running speechd-el, it is automatically created when there's
something to send to it.
@item speechd-cancelable-connections
@cindex stop
List of names of connections that are cancelled by default when a
cancel function is called.
@end vtable
@node Keys, Braille Display Keys, Multiple Connections, Customization
@subsection Keys
@cindex keys
@cindex prefix key
@cindex key map
The command keys of speechd-el are defined by the
@code{speechd-speak-prefix} variable and the
@code{speechd-speak-mode-map} key map.
@vtable @code
@item speechd-speak-prefix
This variable defines the prefix key of the speechd-el commands, which
is @kbd{C-e} by default. If you change the variable value after
speaking has already been started through the @code{speechd-speak}
command and you do not set it through the customization interface, you
must rerun the @code{speechd-speak} so that the change took any
effect.
@item speechd-speak-mode-map
This key map holds the mapping of the keys following the prefix key.
You can set keys here in the usual way, e.g.
@lisp
(define-key speechd-speak-mode-map "t" 'speechd-say-text)
@end lisp
to get the @code{speechd-say-text} command bound to the @code{C-e t}
key (assuming @code{C-e} is the prefix key).
@end vtable
@node Braille Display Keys, Modes, Keys, Customization
@subsection Braille Display Keys
@cindex Braille keys
When using Braille display output, speechd-el can bind actions to the
Braille display keys. The Braille key bindings are defined in the
following variables:
@vtable @code
@item speechd-braille-key-functions
Alist of Braille display key codes and corresponding Emacs functions.
If the given key is pressed, the corresponding function is called with
a @code{speechd-brltty-driver} instance as its single argument (read
the source code for information about speechd-el output drivers).
The key codes are either integers (for BRLTTY 3.7 and older) or lists
containing three integers (for BRLTTY 3.8 and newer). See the default
variable value for examples of possible key codes.
The assigned functions needn't be interactive. Actually as the
functions may be invoked by asynchronous events any time at any place,
they shouldn't modify current environment in any inappropriate way.
For this reason it is recommended @emph{not} to assign user commands
to the keys here.
@file{speechd-brltty.el} contains some predefined functions that can
be assigned to the Braille display keys here:
@cindex Braille functions
@ftable @code
@item speechd-brltty-scroll-left
Scroll towards the beginning of the currently displayed message.
@item speechd-brltty-scroll-right
Scroll towards the end of the currently displayed message.
@item speechd-brltty-scroll-to-bol
Scroll to the beginning of the currently displayed message.
@item speechd-brltty-scroll-to-eol
Scroll to the end of the currently displayed message.
@item speechd-brltty-scroll-to-cursor
Scroll to the cursor position (if any) in the displayed message.
@item speechd-brltty-finish-message
Stop displaying the current message and display the next one.
@item speechd-brltty-cancel
Stop displaying the current message and discard all messages waiting
in the queue.
@item speechd-brltty-previous-message
Display the previous message from the history.
@item speechd-brltty-next-message
Display the next message from the history.
@item speechd-brltty-first-message
Display the first message in the history.
@item speechd-brltty-last-message
Display the last message in the history.
@end ftable
Additionally, the following macro is provided:
@ftable @code
@item speechd-brltty-command-key-function @var{key}
Insert function for handling @var{key} as a general input key. This
is useful for handling Braille keys acting as general character input
keys.
@end ftable
The @code{speechd-braille-key-functions} variable contains some
default bindings initially, but as the keys and their codes differ a
lot for various Braille displays, you probably need to adjust it for
your particular device. You can figure out the display key codes by
setting the @code{speechd-braille-show-unknown-keys} variable to
@code{t} and pressing the display keys.
@item speechd-braille-show-unknown-keys
If non-@code{nil}, show codes of the pressed Braille keys that have no
function assigned in @code{speechd-braille-key-functions}. This is
useful to figure out the Braille key codes.
@end vtable
With BrlTTY 3.8 and higher BrlTTY can handle many braille keys itself
in X environment. So speechd-el doesn't try to handle most keys
itself by default. Instead it handles only keys assigned in
@code{speechd-braille-key-functions}. If this is a problem, typically
when looking for braille key codes, the following command can be
useful:
@table @kbd
@item C-e C-b k
@kindex C-e C-b k
@findex speechd-speak-toggle-braille-keys
Toggle handling braille keys by speechd-el. If BrlTTY handles the
keys (this is the default behavior), speechd-el receives only keys
which are assigned to commands in
@code{speechd-braille-key-functions}. If speechd-el handles the keys,
then BrlTTY sends all the pressed keys to speechd-el without
processing them itself.
@end table
@node Modes, Debugging, Braille Display Keys, Customization
@subsection Minor mode hooks
@cindex minor modes
@cindex hooks
speechd-el provides a minor mode that enables and disables the
reading, @xref{Starting Alternative Output}. You can let perform custom
actions on entering it through the following hook.
@vtable @code
@item speechd-speak-mode-hook
Hook run when speechd-speak minor mode is enabled.
@end vtable
@node Debugging, , Modes, Customization
@subsection Debugging speechd-el
@cindex debugging
When you try to debug speechd-speak functions, you can experience the
problem of recursive reading in the Elisp debugger. To avoid it, you
can instruct speechd-el to be quiet in Elisp debuggers:
@vtable @code
@item speechd-speak-in-debugger
If @code{nil}, speechd-speak functions won't be reading in Elisp debuggers.
@end vtable
@node Advanced Customization, Problems, Customization, speechd-el User Manual
@section Defining Your Own Command Feedbacks
@cindex extensions
Writing your own feedback definitions generally requires knowledge of
Elisp programming. But don't be afraid, you can set basic things
without it, just following instructions here.
speechd-el allows you to say a text, output an icon, or call any Elisp
expression before or after a command or a function is invoked. There
are two macros that allow you to do it, while ensuring everything is
set up properly:
@ftable @code
@item speechd-speak-command-feedback @var{command} @var{position} @var{feedback}
Install feedback invocation on @var{command}. @code{command} is a
name of an interactive function (use @kbd{C-h C-c} to get a name of
the command bound to a given key).
@var{position} may be one of the symbols @code{before} and
@code{after} to call the feedback before or after the command is
invoked.
@code{feedback} may be a string or any Elisp expression. If it is a
string (a text enclosed in double quotes), it defines a text to be
spoken or a sound icon to be played. If the string starts with an
asterisk (@code{*}), it names a sound icon (the asterisk is not a part
of the name), otherwise it is a normal text.
Example:
@cindex @code{suspend-emacs}
@lisp
(speechd-speak-command-feedback suspend-emacs before "Suspending Emacs!")
@end lisp
You can put this line of Elisp code to your @file{~/.emacs} to ensure
you are informed when you invoke the @code{suspend-emacs} command
(usually bound to @kbd{C-z}).
@item speechd-speak-function-feedback @var{function} @var{position} @var{feedback}
This is the same as @code{speechd-speak-command-feedback}, except it
is called anytime the given function is invoked, whether interactively
or not. Also, @var{function} may be any function, not only an
interactive command.
@end ftable
@emph{Please note:}
@itemize @bullet
@item
Due to Emacs deficiency, the feedback mechanism may not work on
built-in functions.
@item
Be careful if you want to install function feedbacks without help of
the macros above. The macros install code ensuring nothing is spoken
if @code{speechd-speak-mode} is disabled and other similar
precautions. If you do not use them, you should make those
precautions yourself.
@end itemize
@node Problems, Tips, Advanced Customization, speechd-el User Manual
@section Problems You May Encounter
@cindex problems
@itemize @bullet
@cindex Info
@item
@emph{Why are some menu items in Info not read?}
This is due the way how Emacs fontifies the menu items. Try to set
the @code{Info-fontify-maximum-menu-size} variable to @code{0} to
avoid the problem.
@cindex appointments
@cindex diary
@item
@emph{How to make appointments read their notifications?}
Set the variable @code{appt-msg-window} to @code{nil}. Also, adding
@code{"diary"} to the @code{speechd-speak-auto-speak-buffer} variable
may be useful.
@cindex w3m-el
@cindex URL speaking
@item
@emph{How to avoid printing URL when moving through links in w3m-el?}
Add the following code to your @file{~/.emacs}:
@lisp
(defadvice w3m-print-this-url (around my-w3m-print-this-url activate)
(when (eq this-command 'w3m-print-this-url)
ad-do-it))
@end lisp
@cindex TAB characters
@item
@emph{How to avoid excessive occurrences of TAB (C-i) and NL (C-j)
characters on a Braille display in some buffers
(e.g. @code{*Completion*} buffer)?}
Braille displays generally display exact content, which is usually
what you want. But sometimes TAB characters are inserted to Emacs
buffers for the sole purpose of visual formatting. You can tell Emacs
to suppress this behavior when possible by adding the following code
to your @file{~/.emacs}:
@lisp
(setq-default indent-tabs-mode nil)
@end lisp
@cindex repeated reading
@item
@emph{In some situations, when a modified text is read after
performing a command, the text is read in separate pieces and some of
the pieces are repeated.}
Buffer modifications can be performed by many different ways in Elisp
programs. speechd-el is unable to track them always satisfactory. If
you have a reasonable idea how to improve buffer modification reading,
please tell us.
As a workaround, if you encounter this problem when performing some
often used commands, you might want to define your own speaking
feedbacks of those commands. @xref{Advanced Customization}, for more
details.
@cindex delays
@cindex garbage collection
@cindex @code{gc-cons-threshold}
@item
@emph{There are sometimes small delays (about 1 second) before
something is read after a command.}
Maybe Emacs is garbage collecting in the meantime. Try to increase
the value of the @code{gc-cons-threshold} variable, e.g. to 4000000.
It may increase or reduce the performance, depending on your
environment and particular requirements.
If you didn't byte compile the source @file{*.el} files, do so.
If you are an experienced Elisp hacker and you can find out why
speechd-el produces significant amount of data increasing the
frequency of garbage collection and how to make the things better,
your help is welcome!
@item
@emph{During holding down the @kbd{C-n} key, the screen gets frozen
and the cursor doesn't move for a while.}
Emacs redisplay routines are generally not invoked when Emacs is busy.
speechd-el combined with your autorepeat may achieve such a state
quite easily. If that's a real problem to you, you can reduce your
autorepeat rate or buy a faster computer.
Also, if you didn't byte compile the source @file{*.el} files, do so.
Certainly, any tips increasing speechd-el performance are welcome.
@end itemize
@node Tips, Bug Reporting, Problems, speechd-el User Manual
@section Useful Emacs tips
Don't forget that Elisp allows you to define many useful functions.
Typically, you may want to define commands reporting some information,
which can be easily identified on the Emacs screen, but which is not
so easily provided in the standard speech output interface.
Some examples:
@itemize @bullet
@item
@emph{Reporting current date in calendar:}
@cindex day in calendar
@lisp
(defun report-day ()
(interactive)
(message "%s" (calendar-date-string (calendar-cursor-to-date t))))
@end lisp
@item
@emph{Reporting current diary appointments:}
@cindex appointments
@lisp
(defun report-current-appointments ()
(interactive)
(let ((appt-now-displayed nil))
(appt-check)))
@end lisp
@item
@emph{Reviewing ispell choices}
@cindex ispell
When you invoke the @code{ispell-word} command and the checked word is
mispelled, ispell offers you the list of alternative spellings. You
can let speechd-el repeat the list by pressing @kbd{C-a} in the ispell
prompt. When you want to review the choices closely, press @kbd{C-r}
to enter recursive edit and then switch to the @code{*Choices*} window
with @kbd{C-x o}. After you review the choices, you can return back
to the ispell prompt by pressing @kbd{C-M-c}.
@end itemize
@node Bug Reporting, , Tips, speechd-el User Manual
@section How to Report speechd-el or Speech Dispatcher Bugs
@cindex bug reporting
When you encounter a speechd-el bug, you can report it to us using the
following command. Before doing it, please read the whole text of
this section to allow handling your bug report in a more efficient way.
@ftable @kbd
@item M-x speechd-bug
@findex speechd-bug
Report a speechd-el or Speech Dispatcher bug. The command asks you
for some information and then asks you whether you can reproduce the
bug. If you can, answer @kbd{y} and start reproducing the bug
immediately. As soon as the bug is reproduced, type @kbd{C-e C-f}.
Then you can (and should) further edit the generated mail and send it
in the usual way.
@item M-x speechd-bug-reproduce
@findex speechd-bug-reproduce
@kindex C-e C-f
Start reproducing a speechd-el or Speech Dispatcher bug. All user and
Speech Dispatcher actions are watched from this moment.
Bug reproduction is finished by pressing the @kbd{C-e C-f} keys.
After the bug reproduction is finished, information about it is
inserted into the buffer where the @code{speechd-bug-reproduce}
command was invoked.
This command is useful when you want to provide information about a
bug without generating new bug report.
@end ftable
When reporting the bugs, please always remember the following
instructions:
@itemize @bullet
@item
Write as much information about the problem as possible. Describe
what doesn't work, what's the expected behavior, what actions have
triggered the bug, what's special about your Emacs environment or
Speech Dispatcher configuration, etc. Don't try to analyze too much
which information is important and which is not --- everything may be
important to the developers, so try not to forget to mention anything
that might be important, better more than less. Missing information
may cause the developers won't be able to handle the bug at all.
@item
Be as much precise as possible. Don't expect the developers to know
the context or to know the way you typically use Emacs and speechd-el.
Write in exact terms --- instead of just writing ``when I invoke foo''
write better ``when I press the keys `M-x foo RET', thus invoking the
`foo' command''; or instead of writing ``doesn't speak what I expect''
write like ``speaks `blah blah' instead of `bleh bleh bleh' what is I
expect, since `bleh bleh bleh' is the text of the whole line''.
@item
When reproducing the bug, try to have the Speech Dispatcher logging
enabled to the highest level --- set the @code{LogLevel} option to
@code{5} in your @file{speechd.conf} configuration file.
@item
When reproducing the bug, don't do any extra actions and invoke
@kbd{C-e C-f} as soon as the bug is reproduce. Thus you avoid losing
the relevant information of the automatically extracted log files in
an unnecessary garbage.
@item
You can also look at the Speech Dispatcher bug reporting instructions,
see @ref{Reporting Bugs,,,speechd,Speech Dispatcher}.
@end itemize
@c ****************************************************************************
@node speechd-el Elisp Library, Contact Information, speechd-el User Manual, Top
@chapter speechd-el Emacs Lisp Library
The speechd-el code can be classified into several parts:
@itemize @bullet
@item
Low-level libraries for Speech Dispatcher and BrlAPI access
implemented in the files @file{speechd.el} and @file{brltty.el}.
@item
General device independent output mechanism defined in the
@file{speechd-out.el} file. Its particular device implementations are
in the files @file{speechd-ssip.el} and @file{speechd-brltty.el}.
@item
User interface implemented in @file{speechd-speak.el}.
@end itemize
You can use the libraries to communicate with Speech Dispatcher,
BRLTTY or other devices in your own programs.
Right now, there's no real programmer's manual to the libraries.
Please read docstrings of available variables, functions and macros.
Nevertheless, here are some instructions you can and should follow:
@itemize @bullet
@item
Don't use any functions, variables or other Lisp objects, names of
which start with prefixes separated by double dashes (such as
@code{speechd--} or @code{speechd-speak--}). These objects are
considered private and may change incompatibly or disappear at any
time without notice.
@item
@vindex speechd-client-name
If you want to select or create a particular SSIP connection, do so by
binding the @code{speechd-client-name} variable:
@lisp
(let ((speechd-client-name "something"))
... the code using the connection "something" ... )
@end lisp
Please note it's usually bad idea to open two concurrent Speech
Dispatcher connections sharing the same client name.
@item
Otherwise there should be no special pitfalls and you should be safe
to do anything what makes sense.
@end itemize
You can also look at @ref{Advanced Customization}.
@c ****************************************************************************
@node Contact Information, Copying This Manual, speechd-el Elisp Library, Top
@chapter Contact Information
@cindex authors
@cindex bugs
@cindex contact
If you want to report a bug on speechd-el, send complete information
regarding the bug to the bug tracking address
@email{speechd-el@@bugs.freebsoft.org}. If you have a patch to
speechd-el, you can send it to the same address.
@emph{Please}, before sending us any bug report, read the bug
reporting instructions, see @ref{Bug Reporting}. Thus you allow us to
process your bug report more efficiently, resulting in a better
response to the report and faster resolving of the issue.
If you have any questions, suggestions, or anything else to tell us,
feel free to contact us at the e-mail address
@email{speechd@@freebsoft.org}.
@c ****************************************************************************
@node Copying This Manual, Index, Contact Information, Top
@appendix Copying Conditions of This Manual
@menu
* GNU Free Documentation License::
* GNU General Public License::
@end menu
@node GNU Free Documentation License, GNU General Public License, Copying This Manual, Copying This Manual
@section GNU Free Documentation License
@cindex FDL, GNU Free Documentation License
@center Version 1.2, November 2002
@include fdl.texi
@node GNU General Public License, , GNU Free Documentation License, Copying This Manual
@section GNU General Public License
@cindex GPL, GNU General Public License
@center Version 3, 29 June 2007
@include gpl.texi
@c ****************************************************************************
@node Index, , Copying This Manual, Top
@unnumbered Index
@printindex cp
@bye
@c LocalWords: texinfo setfilename speechd settitle syncodeindex fn cp ky vr
@c LocalWords: Brailcom dircategory direntry titlepage vskip pt filll dir url
@c LocalWords: insertcopying ifnottex cindex Elib autoload kbd findex kindex
@c LocalWords: pxref sexp SPC itemx var unspeak vtable xref asis alist ftable
@c LocalWords: docstrings minibuffers emph vindex fdl texi printindex gc foo
@c LocalWords: RET bleh LogLevel conf comint localhost
speechd-el-2.6/speechd-log-extractor 0000644 0001750 0001750 00000002705 12206216327 015647 0 ustar pdm pdm #!/usr/bin/env perl
# Copyright (C) 2004 Brailcom, o.p.s.
#
# Authors: Tomáš Cerha , Milan Zamazal
#
# COPYRIGHT NOTICE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
use strict;
my ($begin, $end, $compress) = @ARGV;
die "Usage: $0 begin end [--compress]\n"
unless (defined($begin) and defined($end)
and (not defined($compress) or $compress eq '--compress'));
my ($zip) = grep(defined, `which bzip2`, `which gzip`) if defined($compress);
if (defined($zip)) {
open(OUT, "|$zip") or die "Unable to open pipe to $zip: $!";
} else {
*OUT = *STDOUT;
}
my $inside = 0;
while () {
if ($inside == 1) {
print OUT;
if (/$end/o) {
last;
}
}
else {
if (/$begin/o) {
$inside = 1;
print OUT;
}
}
}
close(OUT) if (defined($compress));
speechd-el-2.6/speechd-out.el 0000644 0001750 0001750 00000020663 12206216327 014266 0 ustar pdm pdm ;;; speechd-out.el --- Alternative output interface
;; Copyright (C) 2004, 2005, 2006, 2008 Brailcom, o.p.s.
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Code:
(eval-when-compile (require 'cl))
(require 'eieio)
(require 'speechd-common)
(defvar speechd-out--drivers '())
(defcustom speechd-out-active-drivers '(ssip brltty)
"List of names of the drivers to send output to."
:type '(repeat symbol)
:group 'speechd-el)
(defvar speechd-out--event-mapping
'((empty . empty-text)
(whitespace . whitespace)
(beginning-of-line . beginning-of-line)
(end-of-line . end-of-line)
(start . start)
(finish . finish)
(minibuffer . prompt)
(message . message)))
;;; Internal infrastructure
(defmacro speechd-out--loop-drivers (var &rest body)
(let ((var* (car var))
($speechd-out-errors (gensym))
($error (gensym))
($error-data (gensym))
($err (gensym)))
`(let ((,$speechd-out-errors '()))
(dolist (,var* speechd-out--drivers)
(when (memq (speechd-driver.name ,var*) speechd-out-active-drivers)
(condition-case ,$err (progn ,@body)
(error
(push ,$err ,$speechd-out-errors)))))
(when ,$speechd-out-errors
;; How to signal all the errors?
(destructuring-bind
(,$error . ,$error-data) (first ,$speechd-out-errors)
(setq ,$speechd-out-errors (cdr ,$speechd-out-errors))
(while (and ,$speechd-out-errors
(eq (caar ,$speechd-out-errors) ,$error))
(setq ,$error-data (append ,$error-data
(cdar ,$speechd-out-errors)))
(setq ,$speechd-out-errors (cdr ,$speechd-out-errors)))
(signal ,$error ,$error-data))))))
(defun speechd-out--loop-drivers-op (operation &rest args)
(speechd-out--loop-drivers (driver)
(apply operation driver args)))
(defun speechd-out--icon-name (icon)
(let ((mapping (cdr (assq icon speechd-out--event-mapping))))
(when mapping
(symbol-name mapping))))
;;; Driver API
(defclass speechd-driver ()
((name :initarg :name
:reader speechd-driver.name)))
(defmethod initialize-instance :after
((this speechd-driver) slots)
(if (not (slot-boundp this 'name))
(error "Driver name not given")))
(defun speechd-out-register-driver (driver)
(let ((class (class-of driver)))
(labels ((replace (list)
(cond
((null list)
(list driver))
((eq (class-of (car list)) class)
(cons driver (cdr list)))
(t
(cons (car list) (replace (cdr list)))))))
(setq speechd-out--drivers (replace speechd-out--drivers)))))
(defmethod speechd.cancel ((driver speechd-driver) all))
(defmethod speechd.stop ((driver speechd-driver) all))
(defmethod speechd.pause ((driver speechd-driver) all))
(defmethod speechd.resume ((driver speechd-driver) all))
(defmethod speechd.repeat ((driver speechd-driver)))
(defmethod speechd.block ((driver speechd-driver) function))
(defmethod speechd.text ((driver speechd-driver) text cursor))
(defmethod speechd.icon ((driver speechd-driver) icon))
(defmethod speechd.char ((driver speechd-driver) char))
(defmethod speechd.key ((driver speechd-driver) key))
(defmethod speechd.set ((driver speechd-driver) parameter value))
(defmethod speechd.shutdown ((driver speechd-driver)))
(defvar speechd.update nil)
;;; Interface functions and variables
(defstruct speechd-out-update
text
cursor
group)
(defmacro speechd-out-with-updated-text (spec &rest body)
`(let ((speechd.update ,spec))
,@body))
(defun speechd-out-cancel (&optional all)
(interactive "P")
(speechd-out--loop-drivers-op #'speechd.cancel all))
(defun speechd-out-stop (&optional all)
(interactive "P")
(speechd-out--loop-drivers-op #'speechd.stop all))
(defun speechd-out-pause (&optional all)
(interactive "P")
(speechd-out--loop-drivers-op #'speechd.pause all))
(defun speechd-out-resume (&optional all)
(interactive "P")
(speechd-out--loop-drivers-op #'speechd.resume all))
(defun speechd-out-repeat ()
(interactive)
(speechd-out--loop-drivers-op #'speechd.repeat))
(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)
(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))
(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)
(speechd-out--loop-drivers (driver)
(speechd.set driver 'priority priority)
(lexical-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)))))))
(defun* speechd-out-text (text &key (priority speechd-default-text-priority)
icon cursor)
(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))
(speechd.block driver (lambda ()
(when icon-name%
(speechd.icon driver% icon-name%))
(speechd.text driver% text% cursor%)))))))
(defun speechd-out-set (parameter value)
(speechd-out--loop-drivers (driver)
(speechd.set driver parameter value)))
(defun speechd-out-shutdown (&optional inactive-only)
(dolist (driver speechd-out--drivers)
(when (or (not inactive-only)
(not (memq (speechd-driver.name driver)
speechd-out-active-drivers)))
(speechd.shutdown driver))))
(defun speechd-out-enable-driver (driver)
"Enable given driver."
(interactive
(list (intern
(completing-read "Enable driver: "
(mapcar 'list
(mapcar 'symbol-name
(set-difference
(mapcar 'speechd-driver.name
speechd-out--drivers)
speechd-out-active-drivers)))
nil t))))
(unless (memq driver speechd-out-active-drivers)
(push driver speechd-out-active-drivers)))
(defun speechd-out-disable-driver (driver)
"Disable given driver and disconnect from its output device."
(interactive
(list (intern
(completing-read "Disable driver: "
(mapcar 'list
(mapcar 'symbol-name
speechd-out-active-drivers))
nil t))))
(setq speechd-out-active-drivers (remove driver speechd-out-active-drivers))
(speechd-out-shutdown t))
;;; Announce
(provide 'speechd-out)
;;; speechd-out.el ends here
speechd-el-2.6/speechd-speak.el 0000644 0001750 0001750 00000255075 12206216327 014571 0 ustar pdm pdm ;;; speechd-speak.el --- simple speechd-el based Emacs client
;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010 Brailcom, o.p.s.
;; Copyright (C) 2012, 2013 Milan Zamazal
;; Author: Milan Zamazal
;; COPYRIGHT NOTICE
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Commentary:
;; This is an Emacs client to speechd. Some ideas taken from the Emacspeak
;; package (http://emacspeak.sourceforge.net) by T. V. Raman.
;;; Code:
(eval-when-compile (require 'cl))
(require 'speechd)
(require 'speechd-common)
(require 'speechd-out)
(require 'speechd-brltty)
(require 'speechd-ssip)
;;; User options
(defgroup speechd-speak ()
"Speechd-el user client customization."
:group 'speechd-el)
(defcustom speechd-speak-echo 'character
"Symbol determining how to read typed characters.
It can have one of the following values:
`character' -- read characters when they are typed
`word' -- read only whole words when they are written
`nil' -- don't echo anything on typing"
:type '(choice (const :tag "Characters" character)
(const :tag "Words" word)
(const :tag "Nothing" nil))
:group 'speechd-speak)
(defcustom speechd-speak-deleted-char t
"If non-nil, speak the deleted char, otherwise speak the adjacent char."
:type 'boolean
:group 'speechd-speak)
(defcustom speechd-speak-buffer-name 'text
"If non-nil, speak buffer name on a buffer change.
If the value is the symbol `text', speak the text from the cursor position in
the new buffer to the end of line as well. If nil, speak the text only, not
the buffer name."
:type '(choice (const :tag "Buffer name and buffer text" text)
(const :tag "Buffer name" t)
(const :tag "Buffer text" nil))
:group 'speechd-speak)
(defcustom speechd-speak-on-minibuffer-exit t
"If non-nil, always try to speak something when exiting the minibuffer."
:type 'boolean
:group 'speechd-speak)
(defcustom speechd-speak-auto-speak-buffers '("*Help*")
"List of names of other-window buffers to speak if nothing else fits.
If nothing else is to be spoken after a command and a visible window in the
current frame displaying a buffer with a name contained in this list is
changed, the contents of the window buffer is spoken."
:type '(repeat (string :tag "Buffer name"))
:group 'speechd-speak)
(defcustom speechd-speak-force-auto-speak-buffers '()
"List of names of other-window buffers to speak on visible changes.
Like `speechd-speak-auto-speak-buffers' except that the window content is
spoken even when there are other messages to speak."
:type '(repeat (string :tag "Buffer name"))
:group 'speechd-speak)
(defcustom speechd-speak-buffer-insertions 'one-line
"Defines whether insertions in a current buffer should be read automatically.
The value is a symbol and can be from the following set:
- nil means don't speak them
- t means speak them all
- `one-line' means speak only first line of any change
- `whole-buffer' means speak whole buffer if it was changed in any way
Only newly inserted text is read, the option doesn't affect processing of
deleted text. Also, the option doesn't affect insertions within commands
processed in a different way by speechd-speak or user definitions."
:type '(choice (const :tag "Never" nil)
(const :tag "One-line changes only" one-line)
(const :tag "Always" t)
(const :tag "Read whole buffer" whole-buffer))
:group 'speechd-speak)
(defcustom speechd-speak-insertions-in-buffers
'(" widget-choose" "*Choices*")
"List of names of buffers, in which insertions are automatically spoken.
See also `speechd-speak-buffer-insertions'."
:type '(repeat (string :tag "Buffer name"))
:group 'speechd-speak)
(defcustom speechd-speak-priority-insertions-in-buffers '()
"List of names of buffers, in which insertions are spoken immediately.
Unlike `speechd-speak-insertions-in-buffers', speaking is not delayed until a
command is completed.
This is typically useful in comint buffers."
:type '(repeat (string :tag "Buffer name"))
:group 'speechd-speak)
(defcustom speechd-speak-align-buffer-insertions t
"If non-nil, read insertions aligned to the beginning of the first word."
:type 'boolean
:group 'speechd-speak)
(defcustom speechd-speak-movement-on-insertions 'read-only
"If t, speak the text around moved cursor even in modified buffers.
If nil, additional cursor movement doesn't cause speaking the text around the
new cursor position in modified buffers.
If `read-only', speak the text around cursor in read-only buffers only."
:type '(choice (const :tag "Always" t)
(const :tag "Never" nil)
(const :tag "In read-only buffers" read-only))
:group 'speechd-speak)
(defcustom speechd-speak-read-command-keys t
"Defines whether command keys should be read after their command.
If t, always read command keys, before the command is performed.
If nil, never read them.
Otherwise it is a list, consisting of one or more of the following symbols:
`movement' -- read the keys if the cursor has moved without any buffer change
`modification' -- read the keys if the buffer was modified without moving the
cursor
`modification-movement' -- read the keys if the buffer was modified and the
cursor has moved
and the keys are read after the command is performed."
:type '(choice (const :tag "Always" t)
(const :tag "Never" nil)
(set :tag "Sometimes"
(const movement)
(const modification)
(const modification-movement)))
:group 'speechd-speak)
(defcustom speechd-speak-allow-prompt-commands t
"If non-nil, allow speechd-speak commands in read-char prompts."
:type 'boolean
:group 'speechd-speak)
(defcustom speechd-speak-ignore-command-keys
'(forward-char backward-char right-char left-char next-line previous-line
delete-char comint-delchar-or-maybe-eof delete-backward-char
backward-delete-char-untabify
c-electric-backspace c-electric-delete-forward)
"List of commands for which their keys are never read."
:type '(repeat function)
:group 'speechd-speak)
(defcustom speechd-speak-read-command-name nil
"If non-nil, read command name instead of command keys."
:type 'boolean
: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
the current line by default if the cursor has moved. However, if this variable
is t, it speaks the uniform text around the cursor, where \"uniform\"
means the maximum amount of text without any text property change.
If the variable is a list of faces, uniform text is spoken only when the cursor
is on one of the named faces.
Speaking uniform text only works if font-lock-mode is enabled for the current
buffer.
See also `speechd-speak-by-properties-always' and
`speechd-speak-by-properties-never'."
:type '(choice (const :tag "Always" t)
(repeat :tag "On faces" (face :tag "Face")))
:group 'speechd-speak)
(defcustom speechd-speak-by-properties-always '()
"List of commands to always speak by properties on movement.
The elements of the list are command names, symbols.
See `speechd-speak-by-properties-on-movement' for more information about
property speaking."
:type '(repeat
(function :tag "Command" :match (lambda (w val) (commandp val))))
:group 'speechd-speak)
(defcustom speechd-speak-by-properties-never '()
"List of commands to never speak by properties on movement.
The elements of the list are command names, symbols.
See `speechd-speak-by-properties-on-movement' for more information about
property speaking."
:type '(repeat
(function :tag "Command" :match (lambda (w val) (commandp val))))
:group 'speechd-speak)
(defcustom speechd-speak-faces '()
"Alist of faces and speaking functions.
Each element of the list is of the form (FACE . ACTION).
If a movement command leaves the cursor on a FACE and there is no explicit
speaking bound to the command, ACTION is invoked.
If ACTION is a string, the string is spoken.
If ACTION is a function, it is invoked, with no arguments."
:type '(alist
:key-type face
:value-type (choice
(string :tag "String to speak")
(function :tag "Function to call"
:match (lambda (w val) (commandp val)))))
:group 'speechd-speak)
(defcustom speechd-speak-display-modes '(gnus-agent-mode)
"List of minor modes to be spoken by their display string rather than name."
:type '(repeat symbol)
:group 'speechd-speak)
(defcustom speechd-speak-whole-line nil
"If non-nil, speak whole line on movement by default.
Otherwise speak from the point to the end of line on movement by default."
:type 'boolean
:group 'speechd-speak)
(defcustom speechd-speak-separator-regexp nil
"If non-nil don't read parts of a line separated by the given regexp.
This is typically useful in w3m where columns are separated only
by whitespace. \" \" may be good value of this variable in such
a case."
:type 'regexp
:group 'speechd-speak)
(defcustom speechd-speak-message-time-interval 30
"Minimum time in seconds, after which the same message may be repeated.
If the message is the same as the last one, it is not spoken unless the number
of seconds defined here has passed from the last spoken message."
:type 'integer
:group 'speechd-speak)
(defcustom speechd-speak-connections '()
"Alist mapping major modes and buffers to speechd connection.
By default, there's a single connection to speechd, named \"default\". This
variable can define special connections for particular major modes and buffers.
Each element of the alist is of the form (MODE-OR-BUFFER . CONNECTION-NAME).
MODE-OR-BUFFER may be, in the order of preference from the highest to the
lowest:
- a list, representing a function call returning non-nil iff the element should
be applied
- buffer name
- the symbol `:minibuffer', representing minibuffers
- major mode symbol
- nil, representing non-buffer areas, e.g. echo area
- t, representing the default value if nothing else matches
CONNECTION-NAME is an arbitrary non-empty string naming the corresponding
connection. If connection with such a name doesn't exist, it is automatically
created."
:type '(alist :key-type
(choice :tag "Matcher" :value nil
(const :tag "Default" t)
(const :tag "Non-buffers" nil)
(const :tag "Minibuffer" :value :minibuffer)
(symbol :tag "Major mode" :value fundamental-mode)
(regexp :tag "Buffer name regexp" :value "")
(restricted-sexp :tag "Function call"
:match-alternatives (listp)))
:value-type (string :tag "Connection name"))
:group 'speechd-speak)
(defcustom speechd-speak-signal-events
'(empty whitespace beginning-of-line end-of-line start finish minibuffer
message)
"List of symbolic names of events to signal with a standard icon.
The following actions are supported: `empty', `beginning-of-line',
`end-of-line', `start', `finish', `minibuffer', `message'."
:type '(set (const empty)
(const whitespace)
(const beginning-of-line)
(const end-of-line)
(const start)
(const finish)
(const minibuffer)
(const message))
:group 'speechd-speak)
(defcustom speechd-speak-input-method-languages '()
"Alist mapping input methods to languages.
Each of the alist element is of the form (INPUT-METHOD-NAME . LANGUAGE), where
INPUT-METHOD-NAME is a string naming the input method and LANGUAGE is an ISO
language code accepted by SSIP.
If the current input method is present in the alist, the corresponding language
is selected unless overridden by another setting."
:type '(alist :key-type (string :tag "Input method")
:value-type (string :tag "Language code"))
:group 'speechd)
(defcustom speechd-speak-in-debugger t
"If nil, speechd-speak functions won't speak in Elisp debuggers.
This may be useful when debugging speechd-el itself."
:type 'boolean
:group 'speechd-speak)
(defcustom speechd-speak-prefix "\C-e"
"Default prefix key used for speechd-speak commands."
:set (lambda (name value)
(set-default name value)
(speechd-speak--build-mode-map))
:initialize 'custom-initialize-default
:type 'sexp
:group 'speechd-speak)
(defcustom speechd-speak-hook nil
"Hook run in the `speechd-speak' function."
:options '((lambda () (require 'speechd-ssip))
(lambda () (require 'speechd-brltty)))
:type 'hook
:group 'speechd-speak)
;;; Internal constants
(defconst speechd-speak--c-buffer-name "*Completions*")
;;; Debugging support
(defvar speechd-speak--debug ())
(defvar speechd-speak--max-debug-length 12)
(defvar speechd-speak--debug-all nil)
(defvar speechd-speak--debug-mark nil)
(defun speechd-speak--debug (info &optional optional)
(when (or (not optional) speechd-speak--debug-all)
(setq speechd-speak--debug
(cons info
(if (and (not speechd-speak--debug-all)
(>= (length speechd-speak--debug)
speechd-speak--max-debug-length))
(butlast speechd-speak--debug)
speechd-speak--debug)))))
;;; Control functions
(defvar speechd-speak--predefined-rates
'((1 . -100)
(2 . -75)
(3 . -50)
(4 . -25)
(5 . 0)
(6 . 25)
(7 . 50)
(8 . 75)
(9 . 100)))
(defun speechd-speak-set-predefined-rate (level)
"Set speech rate to one of nine predefined levels.
Level 1 is the slowest, level 9 is the fastest."
(interactive "nSpeech rate level (1-9): ")
(setq level (min (max level 1) 9))
(let ((rate (cdr (assoc level speechd-speak--predefined-rates))))
(speechd-set-rate rate)
(message "Speech rate set to %d" rate)))
(defvar speechd-speak--char-to-number
'((?1 . 1) (?2 . 2) (?3 . 3) (?4 . 4) (?5 . 5)
(?6 . 6) (?7 . 7) (?8 . 8) (?9 . 9)))
(defun speechd-speak-key-set-predefined-rate ()
"Set speech rate to one of nine predefined levels via a key binding.
Level 1 is the slowest, level 9 is the fastest."
(interactive)
(let ((level (cdr (assoc last-input-event speechd-speak--char-to-number))))
(when level
(speechd-speak-set-predefined-rate level))))
;;; Supporting functions and options
(defvar speechd-speak-command-done nil
"When non-nil, no post command speaking is performed, except for keys.
This variable is reset to nil before each command in pre-command-hook.")
(defun speechd-speak--name (&rest args)
(intern (mapconcat #'symbol-name args "-")))
(defvar speechd-speak-mode nil) ; forward definition to make everything happy
(defvar speechd-speak--started nil)
(defvar speechd-speak--last-buffer-mode t)
(defvar speechd-speak--last-connection-name nil)
(defvar speechd-speak--last-connections nil)
(defvar speechd-speak--default-connection-name "default")
(defvar speechd-speak--special-area nil)
(defvar speechd-speak--emulate-minibuffer nil)
(defvar speechd-speak--client-name-set nil)
(make-variable-buffer-local 'speechd-speak--client-name-set)
(defun speechd-speak--connection-name ()
(let ((buffer-mode (if speechd-speak--special-area
nil
(cons major-mode (buffer-name)))))
(cond
(speechd-speak--client-name-set
speechd-client-name)
((and (not speechd-speak--client-name-set)
(eq speechd-speak-connections speechd-speak--last-connections)
(equal buffer-mode speechd-speak--last-buffer-mode))
speechd-speak--last-connection-name)
(t
(setq speechd-speak--last-buffer-mode buffer-mode
speechd-speak--last-connections speechd-speak-connections
speechd-speak--last-connection-name
(if buffer-mode
(or (cdr (or
;; minibuffer-like prompts
(and speechd-speak--emulate-minibuffer
(assoc :minibuffer speechd-speak-connections))
;; functional test
(let ((specs speechd-speak-connections)
(result nil))
(while (and (not result) specs)
(if (and (consp (caar specs))
(eval (caar specs)))
(setq result (car specs))
(setq specs (cdr specs))))
result)
;; buffer name
(let ((buffer-name (buffer-name)))
(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))
;; major mode
(assq major-mode speechd-speak-connections)
;; default
(assq t speechd-speak-connections)))
speechd-speak--default-connection-name)
(or (cdr (assq nil speechd-speak-connections))
speechd-speak--default-connection-name)))
(set (make-local-variable 'speechd-client-name)
speechd-speak--last-connection-name)))))
(defun speechd-speak--in-debugger ()
(and (not speechd-speak-in-debugger)
(or (eq major-mode 'debugger-mode)
(and (boundp 'edebug-active) edebug-active))))
(defmacro speechd-speak--maybe-speak* (&rest body)
`(when (and speechd-speak-mode
(not (speechd-speak--in-debugger)))
,@body))
(defmacro speechd-speak--maybe-speak (&rest body)
`(speechd-speak--maybe-speak*
(let ((speechd-client-name (speechd-speak--connection-name))
(speechd-language
(or (and speechd-speak-input-method-languages
current-input-method
(cdr (assoc current-input-method
speechd-speak-input-method-languages)))
speechd-language)))
,@body)))
(defmacro speechd-speak--interactive (&rest body)
`(let ((speechd-speak-mode (or (called-interactively-p 'interactive)
(and speechd-speak-mode
(not (speechd-speak--in-debugger)))))
(speechd-default-text-priority (if (called-interactively-p 'interactive)
'message
speechd-default-text-priority)))
,@body))
(defun speechd-speak--remove-invisible-text (text)
(let ((pieces '())
(max (length text))
(pos 0)
(invisibility-spec (if (eq buffer-invisibility-spec t)
t
(mapcar (lambda (s) (if (consp s) (car s) s))
buffer-invisibility-spec))))
(while (and pos (< pos max))
(let ((next-pos (next-single-char-property-change pos 'invisible text)))
(when (let ((invisibility (get-char-property pos 'invisible text)))
(not (cond
((eq invisibility-spec t)
invisibility)
((consp invisibility)
(intersection invisibility-spec invisibility))
(t
(memq invisibility buffer-invisibility-spec)))))
(push (substring text pos next-pos) pieces))
(setq pos next-pos)))
(apply 'concat (nreverse pieces))))
(defun speechd-speak--text (text &rest args)
(speechd-speak--maybe-speak
;; TODO: replace repeating patterns
;; TODO: handle selective display
(setq text (speechd-speak--remove-invisible-text text))
(when speechd-speak--debug-mark
(speechd-speak--debug (cons speechd-speak--debug-mark text) t))
(apply #'speechd-out-text text args)))
(defun speechd-speak--char (char &rest args)
(speechd-speak--maybe-speak
(apply #'speechd-out-char char args)))
(defvar speechd-speak--last-report "")
(defun speechd-speak-report (message &rest args)
"Output text or icon MESSAGE.
If MESSAGE is a non-empty string, it is the text to output. If it is a non-nil
symbol present in the `speechd-speak-signal-events' variable, it is the icon to
output. Otherwise nothing happens.
ARGS are appended to the arguments of the corresponding speaking
function (`speechd-out-text' or `speechd-out-icon') without change after the
message argument."
(speechd-speak--maybe-speak
(when (and message
(not (string= message ""))
(not (equal message speechd-speak--last-report))
(or (stringp message)
(memq message speechd-speak-signal-events)))
(apply (if (symbolp message) #'speechd-out-icon #'speechd-out-text)
message args)
(setq speechd-speak--last-report message))))
(defun speechd-speak-read-char (&optional char)
"Output character CHAR.
If CHAR is nil, output the character just after current point."
(interactive)
(speechd-speak--interactive
(speechd-speak--char (or char (following-char)))))
(defun speechd-speak-read-region (&optional beg end empty-text)
"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."
(interactive "r")
(speechd-speak--interactive
(let* ((beg (or beg (mark)))
(end (or end (point)))
(text (speechd-speak--buffer-substring beg end)))
(cond
((string= text "")
(speechd-speak-report (or empty-text 'empty)
:priority speechd-default-text-priority))
((save-match-data (string-match "\\`[ \t]+\\'" text))
(speechd-speak-report 'whitespace
:priority speechd-default-text-priority))
(t
(let* ((point (point))
(cursor (and (>= point beg) (<= point end) (- (point) beg))))
(speechd-speak--text text :cursor cursor)))))))
(defun speechd-speak-read-line (&optional rest-only)
"Output current line.
If the prefix argument is given, output the line only from the current point
to the end of the line."
(interactive "P")
(speechd-speak--interactive
(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)))
(when speechd-speak-separator-regexp
(save-match-data
(save-excursion
(when (re-search-backward speechd-speak-separator-regexp beg t)
(setq beg (match-end 0))))
(save-excursion
(when (re-search-forward speechd-speak-separator-regexp end t)
(setq end (match-beginning 0))))))
(speechd-speak-read-region beg end
(when (speechd-speak--in-minibuffer-p) "")))))
(defun speechd-speak-read-next-line ()
"Speak the next line after the current line.
If there is no such line, play the empty text icon."
(interactive)
(speechd-speak--interactive
(save-excursion
(if (= (forward-line 1) 0)
(speechd-speak-read-line)
(speechd-speak-report 'empty)))))
(defun speechd-speak-read-previous-line ()
"Speak the previous line before the current line.
If there is no such line, play the empty text icon."
(interactive)
(speechd-speak--interactive
(save-excursion
(if (= (forward-line -1) 0)
(speechd-speak-read-line)
(speechd-speak-report 'empty)))))
(defun speechd-speak-read-buffer (&optional buffer)
"Read BUFFER.
If BUFFER is nil, read current buffer."
(interactive)
(speechd-speak--interactive
(save-excursion
(when buffer
(set-buffer buffer))
(speechd-speak-read-region (point-min) (point-max)))))
(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))))
(defun speechd-speak-read-rectangle (beg end)
"Read text in the region-rectangle."
(interactive "r")
(speechd-speak--interactive
(speechd-speak--text
(mapconcat #'identity (extract-rectangle beg end) "\n"))))
(defun speechd-speak-read-other-window ()
"Read buffer of the last recently used window."
(interactive)
(speechd-speak--interactive
(speechd-speak-read-buffer (window-buffer (get-lru-window)))))
(defun speechd-speak-read-mode-line ()
"Read mode line.
This function works only in Emacs 22 or higher."
(interactive)
(when (fboundp 'format-mode-line)
(speechd-speak--interactive
(speechd-speak--text (format-mode-line mode-line-format t)))))
(defun speechd-speak--window-contents ()
(sit-for 0) ; to update window start and end
(speechd-speak-read-region (window-start) (window-end)))
(defun speechd-speak--uniform-text-around-point ()
(let ((beg (speechd-speak--previous-property-change (1+ (point))))
(end (speechd-speak--next-property-change (point))))
(speechd-speak-read-region beg end)))
(defun speechd-speak--speak-piece (start)
(let ((point (point)))
(if (> (count-lines start point) 1)
(speechd-speak-read-line)
(speechd-speak-read-region start point))))
(defun speechd-speak--speak-current-column ()
(speechd-speak--text (format "Column %d" (current-column))))
(defmacro speechd-speak--def-speak-object (type)
(let* ((function-name (speechd-speak--name 'speechd-speak-read type))
(backward-function (speechd-speak--name 'backward type))
(forward-function (speechd-speak--name 'forward type)))
`(defun ,function-name ()
,(format "Speak current %s." type)
(interactive)
(speechd-speak--interactive
(save-excursion
(let* ((point (point))
(end (progn (,forward-function 1) (point)))
(beg (progn (,backward-function 1) (point))))
(when (<= (progn (,forward-function 1) (point)) point)
(setq beg end))
(speechd-speak-read-region beg end)))))))
(speechd-speak--def-speak-object word)
(speechd-speak--def-speak-object sentence)
(speechd-speak--def-speak-object paragraph)
(speechd-speak--def-speak-object page)
(speechd-speak--def-speak-object sexp)
(defstruct speechd-speak--command-info-struct
marker
modified
(changes '())
(change-end nil)
(deleted-chars nil)
(other-changes '())
other-changes-buffer
other-window
other-buffer-modified
completion-buffer-modified
minibuffer-contents
info)
(defmacro speechd-speak--cinfo (slot)
`(,(speechd-speak--name 'speechd-speak--command-info-struct slot)
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)
(let ((marker (speechd-speak--cinfo marker)))
(and marker (marker-position marker))))
(defvar speechd-speak--command-start-info (make-vector 5 nil))
(defmacro speechd-speak--with-minibuffer-depth (&rest body)
`(let ((depth (minibuffer-depth)))
(when (>= depth (length speechd-speak--command-start-info))
(setq speechd-speak--command-start-info
(vconcat speechd-speak--command-start-info
(make-vector
(- (1+ depth)
(length speechd-speak--command-start-info))
nil))))
,@body))
(defun speechd-speak--in-minibuffer-p ()
(window-minibuffer-p (selected-window)))
(defun speechd-speak--command-start-info ()
(speechd-speak--with-minibuffer-depth
(aref speechd-speak--command-start-info depth)))
(defun speechd-speak--set-command-start-info (&optional reset)
(speechd-speak--with-minibuffer-depth
(aset speechd-speak--command-start-info depth
(if reset
nil
(ignore-errors
(let ((other-window (next-window)))
(make-speechd-speak--command-info-struct
:marker (point-marker)
:modified (buffer-modified-tick)
:other-window other-window
:other-buffer-modified
(and other-window
(buffer-modified-tick (window-buffer other-window)))
:completion-buffer-modified
(let ((buffer (get-buffer speechd-speak--c-buffer-name)))
(and buffer (buffer-modified-tick buffer)))
:minibuffer-contents
(if (speechd-speak--in-minibuffer-p)
(minibuffer-contents)
'unset)
:info (speechd-speak--current-info)
)))))))
(defun speechd-speak--reset-command-start-info ()
(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
,@body)))
(defmacro speechd-speak--defadvice (function class &rest body)
(let* ((function* function)
(functions (if (listp function*) function* (list function*)))
(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)))
functions))))
(defmacro speechd-speak--report (feedback &rest args)
(if (stringp feedback)
`(speechd-speak-report ,feedback ,@args)
feedback))
(defmacro speechd-speak-function-feedback (function position feedback)
"Report FEEDBACK on each invocation of FUNCTION.
FUNCTION is a function name.
POSITION may be one of the symbols `before' (the feedback is run before the
function is invoked) or `after' (the feedback is run after the function is
invoked.
FEEDBACK is a string to be given as the argument of the `speechd-speak-report'
function or a sexp to be evaluated."
`(speechd-speak--defadvice ,(list function) ,position
(speechd-speak--report ,feedback :priority 'message)))
(defmacro speechd-speak-command-feedback (function position feedback)
"Report FEEDBACK on each invocation of FUNCTION.
The arguments are the same as in `speechd-speak-function-feedback'.
Unlike `speechd-speak-function-feedback', the feedback is reported only when
FUNCTION is invoked interactively."
`(speechd-speak--defadvice ,(list function) ,position
(when (called-interactively-p 'interactive)
(speechd-speak--report ,feedback :priority 'message))))
(defmacro speechd-speak--command-feedback (commands position &rest body)
(let ((commands* (if (listp commands) commands (list commands)))
(position* position)
(body* `(progn (speechd-speak--reset-command-start-info) ,@body)))
`(progn
,@(mapcar #'(lambda (command)
`(speechd-speak--defadvice ,command ,position*
,(if (eq position* 'around)
`(if (called-interactively-p 'interactive)
,body*
ad-do-it)
`(when (called-interactively-p 'interactive)
,body*))))
commands*)
,(unless (eq position 'before)
`(setq speechd-speak-command-done t)))))
(defmacro speechd-speak--command-feedback-region (commands)
`(speechd-speak--command-feedback ,commands around
(let ((start (point)))
(prog1 ad-do-it
(speechd-speak--speak-piece start)))))
(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)))
;; 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))))
(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
;; should retain enough context anyway.
(setq point i-overlays-start))
(previous-char-property-change point limit)))
(defmacro speechd-speak--with-updated-text (&rest body)
`(speechd-out-with-updated-text (speechd-speak--updated-text)
,@body))
(defun speechd-speak-set-language (language)
"Set default language to LANGUAGE.
Language must be an RFC 1766 language code, as a string."
(interactive "sLanguage: ")
(speechd-set-language language)
(setq speechd-language 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))
;;; Basic speaking
;; These two simply don't work in Emacs 21.3 when invoked via key binding.
;; They're called directly in Emacs 21, to speed them up; no advice is invoked
;; in such a case.
;; (speechd-speak--command-feedback (self-insert-command) after
;; (speechd-speak--char (preceding-char)))
;; (speechd-speak--command-feedback (forward-char backward-char) after
;; (speechd-speak-read-char))
(speechd-speak--command-feedback (next-line previous-line) after
(speechd-speak-read-line))
(speechd-speak--command-feedback (forward-word backward-word) after
(speechd-speak-read-word))
(speechd-speak--command-feedback (forward-sentence backward-sentence) after
(speechd-speak-read-sentence))
(speechd-speak--command-feedback (forward-paragraph backward-paragraph) after
(speechd-speak-read-paragraph))
(speechd-speak--command-feedback (forward-page backward-page) after
(speechd-speak-read-page))
(speechd-speak--command-feedback (scroll-up scroll-down) after
(speechd-speak--window-contents))
(speechd-speak--command-feedback-region
(backward-sexp forward-sexp forward-list backward-list up-list
backward-up-list down-list))
(speechd-speak--command-feedback (upcase-word downcase-word capitalize-word)
after
(speechd-speak-read-word))
(defun speechd-speak--store-deleted-chars (text)
(speechd-speak--with-command-start-info
(setf (speechd-speak--cinfo deleted-chars)
(if (speechd-speak--cinfo deleted-chars)
t
text))))
(speechd-speak--defadvice (delete-backward-char backward-delete-char) around
(if (speechd-speak--command-start-info)
(speechd-speak--with-command-start-info
(let ((speechd-speak--deleted-chars
(when speechd-speak-deleted-char
(speechd-speak--buffer-substring
(max (- (point) (or (ad-get-arg 0) 1))
(point-min))
(point)))))
ad-do-it
(speechd-speak--store-deleted-chars (if speechd-speak-deleted-char
speechd-speak--deleted-chars
(format "%c" (preceding-char))))))
ad-do-it))
(speechd-speak--defadvice (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))
(point-max))))))
ad-do-it
(speechd-speak--store-deleted-chars (if speechd-speak-deleted-char
speechd-speak--deleted-chars
(format "%c" (following-char))))))
(speechd-speak--command-feedback (quoted-insert) after
(speechd-speak-read-char (preceding-char)))
(speechd-speak--command-feedback (newline newline-and-indent) before
(speechd-speak-read-line))
(speechd-speak--command-feedback (undo) after
(speechd-speak-read-line))
;;; Killing and yanking
(speechd-speak--command-feedback (kill-word) before
(speechd-speak-read-word))
(speechd-speak--command-feedback (backward-kill-word) before
(save-excursion
(forward-word -1)
(speechd-speak-read-word)))
(speechd-speak--command-feedback (kill-line) before
(speechd-speak-read-line))
(speechd-speak--command-feedback (kill-sexp) before
(speechd-speak-read-sexp))
(speechd-speak--command-feedback (kill-sentence) before
(speechd-speak-read-sentence))
(speechd-speak--command-feedback (zap-to-char) after
(speechd-speak-read-line))
(speechd-speak--command-feedback (yank yank-pop) after
(speechd-speak-read-region))
(speechd-speak--command-feedback (kill-region completion-kill-region) around
(let ((nlines (count-lines (region-beginning) (region-end))))
(prog1 ad-do-it
(speechd-speak--maybe-speak*
(message "Killed region containing %s lines" nlines)))))
;;; Messages
(defvar speechd-speak--last-message "")
(defvar speechd-speak--last-spoken-message "")
(defvar speechd-speak--last-spoken-message-time 0)
(defun speechd-speak-last-message ()
"Speak last message from the echo area."
(interactive)
(speechd-speak--interactive
(let ((speechd-speak-input-method-languages nil)
(speechd-language "en"))
(speechd-speak--text speechd-speak--last-message))))
(defun speechd-speak--read-message (message)
(let ((speechd-speak--special-area t))
(speechd-speak--maybe-speak ; necessary to select proper connection
(speechd-speak--minibuffer-prompt message :icon 'message
:priority 'progress))))
(defun speechd-speak--message (message &optional reset-last-spoken)
(speechd-speak--maybe-speak*
(when (and message
(or (not (string= message speechd-speak--last-spoken-message))
(>= (- (float-time) speechd-speak--last-spoken-message-time)
speechd-speak-message-time-interval)))
(let* ((oldlen (length speechd-speak--last-spoken-message))
(len (length message))
;; The following tries to handle answers to y-or-n questions, e.g.
;; "Do something? (y or n) y", which are reported as a single
;; string, including the prompt.
(message* (if (and (= (- len oldlen) 1)
(save-match-data
(string-match "\?.*) .$" message))
(string= (substring message 0 oldlen)
speechd-speak--last-spoken-message))
(substring message oldlen)
message)))
(setq speechd-speak--last-message message
speechd-speak--last-spoken-message message
speechd-speak--last-spoken-message-time (float-time))
(speechd-speak--read-message message*)))
(when reset-last-spoken
(setq speechd-speak--last-spoken-message ""))))
(defun speechd-speak--current-message (&optional reset-last-spoken)
(speechd-speak--message (current-message) reset-last-spoken))
(speechd-speak--defadvice message after
(speechd-speak--current-message))
(defmacro speechd-speak--unhide-message (function)
;; If `message' is invoked within a built-in function, there's no way to get
;; notified automatically about it. So we have to wrap the built-in
;; functions displaying messages to check for the otherwise hidden messages.
`(speechd-speak--defadvice ,function after
(unless (string= (current-message) speechd-speak--last-message)
(speechd-speak--current-message))))
(speechd-speak--unhide-message write-region)
;;; Minibuffer
(defvar speechd-speak--minibuffer-inherited-language nil)
(speechd-speak--defadvice read-from-minibuffer around
(let ((speechd-speak--minibuffer-inherited-language
(and (ad-get-arg 6) speechd-language)))
ad-do-it))
(defun speechd-speak--prompt (prompt &optional no-icon)
(speechd-speak--text prompt :priority 'message
:icon (unless no-icon 'minibuffer)))
(defun speechd-speak--speak-minibuffer-prompt ()
(speechd-speak--with-command-start-info
;; Discard changes, otherwise they would be read *after* the prompt, perhaps
;; confusing the user
(setf (speechd-speak--cinfo changes) '()))
(let ((speechd-language "en")
(speechd-speak-input-method-languages nil))
(speechd-speak--prompt (minibuffer-prompt)))
(speechd-speak--prompt (minibuffer-contents) t))
(defun speechd-speak--minibuffer-setup-hook ()
(set (make-local-variable 'speechd-language)
speechd-speak--minibuffer-inherited-language)
(speechd-speak--enforce-speak-mode)
(speechd-speak--with-command-start-info
(setf (speechd-speak--cinfo minibuffer-contents) (minibuffer-contents)))
(speechd-speak--speak-minibuffer-prompt))
(defun speechd-speak--minibuffer-exit-hook ()
(speechd-speak--with-command-start-info
(setf (speechd-speak--cinfo minibuffer-contents) 'unset)))
(defun speechd-speak--speak-minibuffer ()
(speechd-speak--text (minibuffer-contents)))
(defvar speechd-speak--last-other-changes "")
(defvar speechd-speak--last-other-changes-buffer nil)
(defun speechd-speak--read-changes (text buffer &rest speak-args)
(with-current-buffer (or (get-buffer buffer) (current-buffer))
(apply #'speechd-speak--text text speak-args)))
(defun speechd-speak--read-other-changes ()
(speechd-speak--with-command-start-info
(when (speechd-speak--cinfo other-changes)
(let ((speechd-speak--special-area nil)
(buffer (get-buffer (speechd-speak--cinfo other-changes-buffer)))
(text (mapconcat
#'identity
(nreverse (speechd-speak--cinfo other-changes)) "")))
(setq speechd-speak--last-other-changes text
speechd-speak--last-other-changes-buffer buffer)
(speechd-speak--read-changes text buffer :priority 'message))
(setf (speechd-speak--cinfo other-changes) '()))))
(defun speechd-speak-last-insertions ()
"Speak last insertions read in buffers with automatic insertion speaking.
This command applies to buffers defined in
`speechd-speak-insertions-in-buffers' and
`speechd-speak-priority-insertions-in-buffers'."
(interactive)
(speechd-speak--interactive
(let ((speechd-speak--special-area nil))
(speechd-speak--read-changes speechd-speak--last-other-changes
speechd-speak--last-other-changes-buffer))))
(defun speechd-speak--minibuffer-prompt (prompt &rest args)
(speechd-speak--read-other-changes)
(let ((speechd-language "en")
(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))
;; 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
;; messages to the echo area by invoking other built-in functions. There's no
;; easy way to catch the prompts and messages, the only way to deal with this
;; is to use idle timers.
(defvar speechd-speak--message-timer nil)
(defun speechd-speak--message-timer ()
(let ((message (current-message)))
(when (and cursor-in-echo-area
(not (string= message speechd-speak--last-spoken-message)))
(let ((speechd-speak--emulate-minibuffer t))
(speechd-speak--minibuffer-prompt message))
(setq speechd-speak--last-spoken-message message))))
;; 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))
(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)))
(when prompt
(let ((speechd-speak--emulate-minibuffer t)
(speechd-language (if (ad-get-arg 1) speechd-language "en")))
(speechd-speak--minibuffer-prompt prompt :priority 'message)))))
;;; Repetition in character reading commands
(defvar speechd-speak-read-char-keymap (make-sparse-keymap)
"Keymap used by speechd-el for repetitions during reading characters.
Only single characters are allowed in the keymap.")
(define-key speechd-speak-read-char-keymap
"\C-a" 'speechd-speak-last-insertions)
(define-key speechd-speak-read-char-keymap
"\C-e" 'speechd-speak-last-message)
(speechd-speak--defadvice read-char-exclusive around
(if speechd-speak-allow-prompt-commands
(let ((char nil))
(while (not char)
ad-do-it
(setq char ad-return-value)
(let ((command (lookup-key speechd-speak-read-char-keymap
(vector char))))
(when command
(setq char nil)
(call-interactively command))))
char)
ad-do-it))
;;; Commands
(defun speechd-speak--updated-text ()
(let ((line-beg (line-beginning-position))
(line-end (line-end-position)))
(make-speechd-out-update :text (speechd-speak--buffer-substring line-beg line-end)
:cursor (- (point) line-beg) :group 'line)))
(defun speechd-speak--command-keys (&optional priority)
(speechd-speak--maybe-speak
(let* ((keys-to-output '())
(text-to-output nil)
(command-keys (append (this-command-keys-vector) nil)))
(while (and command-keys (not text-to-output))
(let ((key (car command-keys)))
(push key keys-to-output)
(setq text-to-output
(and (equal (event-basic-type key) ?x)
(equal (event-modifiers key) '(meta))
(apply #'concat
(mapcar #'(lambda (k)
(let ((km (event-modifiers k))
(kb (event-basic-type k)))
(if (or (not (numberp kb))
(< kb 32) (>= kb 128)
km)
(char-to-string kb)
"")))
(cdr command-keys)))))
(setq command-keys (cdr command-keys))))
(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)))
(last-end (speechd-speak--cinfo change-end))
(text (speechd-speak--buffer-substring beg end t)))
(setf (speechd-speak--cinfo change-end) end)
(cond
((and last (string= last text))
;; nothing to do
)
((and last-end (= last-end beg))
(rplaca (speechd-speak--cinfo changes)
(concat last (speechd-speak--buffer-substring beg end t))))
(t
(push text (speechd-speak--cinfo changes))))))
(defun speechd-speak--buffer-substring (beg end &optional maybe-align-p)
(let ((text (buffer-substring
(if (and maybe-align-p
speechd-speak-align-buffer-insertions
(not (eq this-command 'self-insert-command)))
(save-excursion
(goto-char beg)
(when (save-match-data
(and (looking-at "\\w")
(not (looking-at "\\<"))))
(backward-word 1))
(point))
beg)
end)))
(dolist (o (overlays-in beg end))
(let ((face (overlay-get o 'face))
(invisible (overlay-get o 'invisible)))
(when (or face invisible)
(let ((beg* (max (overlay-start o) beg))
(end* (min (overlay-end o) end)))
(add-text-properties (- beg* beg) (- end* beg)
`(face ,face invisible ,invisible) text)))))
text))
(defun speechd-speak--minibuffer-update-report (info old new)
(speechd-speak--add-command-text
info
(+ (minibuffer-prompt-end)
(if (and (<= (length old) (length new))
(string= old (substring new 0 (length old))))
(length old)
0))
(point-max)))
(defun speechd-speak--minibuffer-update (beg end len)
(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)))))
(defun speechd-speak--read-buffer-change (buffer-name text)
(with-current-buffer (or (get-buffer buffer-name)
(get-buffer "*scratch*")
(current-buffer))
(speechd-speak--text text :priority 'message)))
(defvar speechd-speak--current-change-string nil)
(defun speechd-speak--before-change-hook (beg end)
;; Beware, before-change-functions may be sometimes called for several times
;; with different arguments (an Emacs bug?)
(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)
(speechd-speak--enforce-speak-mode)
(speechd-speak--with-command-start-info
(unless (or (= beg end)
;; Avoid reading changes when only text properties have changed
(equal speechd-speak--current-change-string
(buffer-substring-no-properties beg end)))
(cond
((or (member (buffer-name) speechd-speak-priority-insertions-in-buffers)
(speechd-speak--in-comint-p)
;; Asynchronous buffer changes
(and (not this-command)
(member (buffer-name) speechd-speak-insertions-in-buffers)))
(unless (memq this-command '(self-insert-command quoted-insert newline
newline-and-indent undo yank yank-pop))
;; Don't align buffer substring here so that the last word of comint
;; input is not read
(speechd-speak--read-buffer-change
(buffer-name) (speechd-speak--buffer-substring beg end nil))))
((not this-command)
;; Asynchronous buffer change -- we are not interested in it by
;; default
nil)
((member (buffer-name) speechd-speak-insertions-in-buffers)
(setf (speechd-speak--cinfo other-changes-buffer) (buffer-name))
(push (speechd-speak--buffer-substring beg end t)
(speechd-speak--cinfo other-changes)))
((eq (current-buffer) (speechd-speak--cinfo buffer))
(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))))))
(setq speechd-speak--current-change-string nil))
(defconst speechd-speak--dont-cancel-on-commands
'(speechd-speak speechd-unspeak
speechd-out-cancel speechd-out-stop speechd-out-pause speechd-out-resume))
(defun speechd-speak--pre-command-hook ()
(condition-case err
(progn
(unless (or (memq this-command speechd-speak--dont-cancel-on-commands)
(and (eq this-command 'self-insert-command)
(eq speechd-speak-echo 'word)))
(speechd-out-cancel))
(speechd-speak--set-command-start-info)
(setq speechd-speak--last-report "")
(setq speechd-speak-command-done nil)
(when speechd-speak-spell-command
(speechd-speak-spell-mode 1))
(speechd-speak--maybe-speak
(when (and (eq speechd-speak-read-command-keys t)
(not (eq this-command 'self-insert-command))
(not (memq this-command
speechd-speak-ignore-command-keys)))
(speechd-speak--command-keys 'message))
;; Some parameters of interactive commands don't set up the
;; minibuffer, so we have to speak the prompt in a special way.
(let ((interactive (and (commandp this-command)
(cadr (interactive-form this-command)))))
(save-match-data
(when (and (stringp interactive)
(string-match "^[@*]*\\([eipPmnr]\n\\)*[ckK]\\(.+\\)"
interactive))
(speechd-speak--prompt (match-string 2 interactive)))))))
(error
(speechd-speak--debug (list 'pre-command-hook-error err))
(signal (car err) (cdr err))))
(add-hook 'pre-command-hook 'speechd-speak--pre-command-hook))
(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
((t) `(eq state nil))
(sometimes `(not (eq state t)))
(t t))))
`(defun ,name (state buffer-changed buffer-modified point-moved
in-minibuffer other-buffer)
(if (and ,state-condition
,guard)
(let ((speechd-speak--debug-mark (quote ,name)))
,@body
,new-state)
state))))
(speechd-speak--post-defun special-commands t t
;; Speak commands that can't speak in a regular way
(and (not speechd-speak-command-done)
(memq this-command '(forward-char backward-char right-char left-char)))
(speechd-speak--with-updated-text
(cond
((looking-at "^")
(speechd-speak--char (following-char) :icon 'beginning-of-line))
((looking-at "$")
(speechd-speak-report 'end-of-line
:priority speechd-default-char-priority))
(t
(speechd-speak-read-char)))))
(speechd-speak--post-defun buffer-switch t t
;; Any buffer switch
(and buffer-changed (not speechd-speak-command-done))
(when speechd-speak-buffer-name
(speechd-speak--text (buffer-name) :priority 'message))
(when (memq speechd-speak-buffer-name '(text nil))
(speechd-speak-read-line t)))
(speechd-speak--post-defun deleted-chars t t
;; Reading delete-char etc. interactive feedback
(let ((deleted-chars (speechd-speak--cinfo deleted-chars))
(changes (speechd-speak--cinfo changes)))
(and (stringp deleted-chars)
(or (null changes)
(and (= (length changes) 1)
(equal (first changes) deleted-chars)))))
(when (eq speechd-speak-read-command-keys t)
;; Cancel reading the DEL key etc. -- perhaps too daring?
(speechd-out-cancel))
(speechd-speak--with-updated-text
(let ((deleted-chars (speechd-speak--cinfo deleted-chars)))
(if (= (length deleted-chars) 1)
(speechd-speak-read-char (string-to-char deleted-chars))
(speechd-speak--text deleted-chars)))))
(speechd-speak--post-defun command-keys t nil
;; Keys that invoked the command
(and (not (memq this-command speechd-speak-ignore-command-keys))
(not (eq this-command 'self-insert-command))
(not (eq speechd-speak-read-command-keys t))
(or (and buffer-modified point-moved
(memq 'modification-movement speechd-speak-read-command-keys))
(and buffer-modified (not point-moved)
(memq 'modification speechd-speak-read-command-keys))
(and (not buffer-modified) point-moved
(memq 'movement speechd-speak-read-command-keys))))
(if speechd-speak-read-command-name
(speechd-speak--text (symbol-name this-command) :priority 'message)
(speechd-speak--command-keys 'message)))
(speechd-speak--post-defun command-done t t
;; No speaking when the command has already been handled in a special way
speechd-speak-command-done)
(speechd-speak--post-defun info-change t nil
;; General status information has changed
(not (equal (speechd-speak--cinfo info) (speechd-speak--current-info)))
(let ((old-info (speechd-speak--cinfo info))
(new-info (speechd-speak--current-info)))
(dolist (item new-info)
(let* ((id (car item))
(new (cdr item))
(old (cdr (assq id old-info))))
(when (and (memq id speechd-speak-state-changes)
(not (equal old new)))
(funcall (speechd-speak--name 'speechd-speak--update id)
old new))))))
(speechd-speak--post-defun speaking-commands nil t
;; Avoid additional reading on speaking commands
(let ((command-name (symbol-name this-command))
(prefix "speechd-speak-read-"))
(and (> (length command-name) (length prefix))
(string= (substring command-name 0 (length command-name)) prefix))))
(speechd-speak--post-defun buffer-modifications t
(cond
((eq this-command 'self-insert-command) t)
((not speechd-speak-movement-on-insertions) t)
((and (eq speechd-speak-movement-on-insertions 'read-only)
(not buffer-read-only))
t)
(t 'insertions))
;; Any buffer modification, including completion, abbrev expansions and
;; self-insert-command
buffer-modified
;; We handle self-insert-command in a special way. We don't speak the
;; inserted character itself, we only read other buffer modifications caused
;; by the command (typically abbrev expansions). Instead of speaking the
;; inserted character, we try to speak the command key.
(let ((self-insert (eq this-command 'self-insert-command))
(changes (speechd-speak--cinfo changes)))
(when speechd-speak-buffer-insertions
(let ((text (mapconcat #'identity
(funcall (if self-insert
#'butlast #'identity)
(reverse changes))
" ")))
(when (and self-insert
(> (length (first changes)) 1))
(setq text (concat text " " (first changes))))
(cond
((and (eq speechd-speak-buffer-insertions 'whole-buffer)
(not self-insert))
(speechd-speak-read-buffer))
(t
(speechd-speak--text (if (eq speechd-speak-buffer-insertions t)
text
(save-match-data
(string-match "^.*$" text)
(match-string 0 text))))))))
(when (and self-insert
speechd-speak-echo
(not (memq 'self-insert-command
speechd-speak-ignore-command-keys)))
(case speechd-speak-echo
(word
(let ((point (point)))
(when (and (> point 1)
(not (save-match-data (string-match "\\w" (buffer-substring (1- point) point)))))
(speechd-speak--text (buffer-substring (save-excursion (forward-word -1) (point)) point)))))
(character
(speechd-speak--with-updated-text
(speechd-speak--command-keys 'notification)))))))
(speechd-speak--post-defun completions t t
;; *Completions* buffer
(and in-minibuffer
(get-buffer speechd-speak--c-buffer-name)
(/= (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")
(speechd-speak-input-method-languages nil))
(goto-char (point-min))
(save-match-data
(re-search-forward "\n\n+" nil t))
(speechd-speak-read-region (point) (point-max) nil))))
(speechd-speak--post-defun special-face-movement sometimes
(or (not (stringp (cdr (assq (get-char-property (point) 'face)
speechd-speak-faces))))
state)
;; Special face hit
(and (not in-minibuffer)
point-moved
(assq (get-char-property (point) 'face) speechd-speak-faces))
(let ((action (cdr (assq (get-char-property (point) 'face)
speechd-speak-faces))))
(cond
((stringp action)
(speechd-speak--text action :priority 'message))
((functionp action)
(ignore-errors
(funcall action))))))
(speechd-speak--post-defun text-property-movement sometimes t
;; General text or overlay property hit
(and (not in-minibuffer)
point-moved
(not (memq this-command speechd-speak-by-properties-never))
(or (eq speechd-speak-by-properties-on-movement t)
(memq this-command speechd-speak-by-properties-always)
(memq (get-char-property (point) 'face)
speechd-speak-by-properties-on-movement))
(or (let ((properties (text-properties-at (point)))
(look-props '(face font-lock-face mouse-face display help-echo
keymap local-map read-only field))
(marked nil))
(while (and look-props (not marked))
(setq marked (plist-member properties (car look-props)))
(setq look-props (cdr look-props)))
marked)
(overlays-at (point)))
(let ((position (speechd-speak--cinfo point)))
(or (> (speechd-speak--previous-property-change
(1+ (point)) position)
position)
(<= (speechd-speak--next-property-change
(point) (1+ position))
position))))
(speechd-speak--uniform-text-around-point))
(speechd-speak--post-defun plain-movement sometimes t
;; Other kinds of movement
point-moved
(speechd-speak-read-line (not speechd-speak-whole-line)))
(speechd-speak--post-defun other-window-event t 'other-window
;; Something interesting in other window
(and (not in-minibuffer)
other-buffer
(member (buffer-name other-buffer) speechd-speak-auto-speak-buffers)
(or (not (eq (next-window) (speechd-speak--cinfo other-window)))
(not (= (buffer-modified-tick other-buffer)
(speechd-speak--cinfo other-buffer-modified)))))
(speechd-speak-read-buffer (window-buffer (next-window))))
(speechd-speak--post-defun other-window-buffer nil t
;; Other window buffer is very interesting
(and (not (eq state 'other-window))
(not in-minibuffer)
other-buffer
(member (buffer-name other-buffer)
speechd-speak-force-auto-speak-buffers)
(or (not (eq (next-window) (speechd-speak--cinfo other-window)))
(not (= (buffer-modified-tick other-buffer)
(speechd-speak--cinfo other-buffer-modified)))))
(speechd-speak-read-buffer (window-buffer (next-window))))
(speechd-speak--post-defun minibuffer-exit t t
(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
'(speechd-speak--post-read-special-commands
speechd-speak--post-read-buffer-switch
speechd-speak--post-read-deleted-chars
speechd-speak--post-read-command-keys
speechd-speak--post-read-command-done
speechd-speak--post-read-info-change
speechd-speak--post-read-speaking-commands
speechd-speak--post-read-buffer-modifications
speechd-speak--post-read-completions
speechd-speak--post-read-special-face-movement
speechd-speak--post-read-text-property-movement
speechd-speak--post-read-plain-movement
speechd-speak--post-read-other-window-event
speechd-speak--post-read-other-window-buffer
speechd-speak--post-read-minibuffer-exit))
(defvar speechd-speak--post-command-speaking nil)
(defun speechd-speak--post-command-hook ()
(speechd-speak--enforce-speak-mode)
(when (and speechd-speak-spell-command speechd-speak-spell-mode)
;; Only in spell mode to avoid disabling it after speechd-speak-spell
(setq speechd-speak-spell-command nil)
(speechd-speak-spell-mode 0))
;; Now, try to speak something useful
(speechd-speak--maybe-speak
(condition-case err
(progn
;; Messages should be handled by an after change function.
;; Unfortunately, in Emacs 21 after change functions in the
;; *Messages* buffer don't work in many situations. This is a
;; property of the Emacs implementation, so the mechanism can't be
;; used.
(speechd-speak--current-message t)
(speechd-speak--with-command-start-info
(let* ((state nil)
(buffer-changed (not (eq (speechd-speak--cinfo buffer)
(current-buffer))))
(buffer-modified (and (not buffer-changed)
(/= (speechd-speak--cinfo modified)
(buffer-modified-tick))))
(point-moved (and (not buffer-changed)
(not (= (speechd-speak--cinfo point)
(point)))))
(in-minibuffer (speechd-speak--in-minibuffer-p))
(other-window (next-window))
(other-buffer (let* ((buffer (and other-window
(window-buffer
other-window))))
(unless (eq buffer (current-buffer))
buffer))))
(dolist (f speechd-speak--post-command-speaking)
(let ((new-state state))
(condition-case err
(setq new-state (funcall f state buffer-changed
buffer-modified point-moved
in-minibuffer other-buffer))
(error
(speechd-speak--debug
(list 'post-command-hook-error f err))
(setq speechd-speak--post-command-speaking
(remove f speechd-speak--post-command-speaking))))
(setq state new-state)))
(setq speechd-speak--last-minibuffer-depth (minibuffer-depth)))))
(error
(speechd-speak--debug (list 'post-command-hook-top-error err))
(signal (car err) (cdr err))))
(add-hook 'post-command-hook 'speechd-speak--post-command-hook)))
;;; Comint
(speechd-speak--command-feedback comint-show-output after
(speechd-speak-read-region))
;;; Completions, menus, etc.
(defun speechd-speak--speak-completion ()
;; Taken from `choose-completion'
(let (beg end completion (buffer completion-reference-buffer))
(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))
(setq end (1- (point)) beg (point)))
(if (null beg)
(error "No completion here"))
(setq beg (previous-single-property-change beg 'mouse-face))
(setq end (or (next-single-property-change end 'mouse-face) (point-max)))
(setq completion (speechd-speak--buffer-substring beg end))
(speechd-speak--text completion)
(speechd-speak--reset-command-start-info)))
(speechd-speak--command-feedback (next-completion previous-completion) after
(speechd-speak--speak-completion))
(speechd-speak--command-feedback choose-completion before
(speechd-speak--speak-completion))
(speechd-speak--defadvice widget-choose around
(let ((widget-menu-minibuffer-flag (or speechd-speak-mode
widget-menu-minibuffer-flag)))
ad-do-it))
;;; Other functions and packages
(speechd-speak--command-feedback (occur-prev occur-next
occur-mode-goto-occurence)
after
(speechd-speak-read-line))
(speechd-speak--command-feedback transpose-chars after
(speechd-speak--char (following-char)))
(speechd-speak--command-feedback transpose-lines after
(speechd-speak-read-line))
(speechd-speak--command-feedback transpose-words after
(speechd-speak-read-word))
(speechd-speak--command-feedback transpose-sexps after
(speechd-speak-read-sexp))
(speechd-speak--command-feedback undefined after
(speechd-speak--text "No command on this key"))
(speechd-speak--command-feedback indent-for-tab-command after
(speechd-speak--speak-current-column))
(defvar speechd-speak--handle-braille-keys nil)
(defun speechd-speak-toggle-braille-keys ()
(interactive)
(speechd-out-set 'brltty-accept-keys (not speechd-speak--handle-braille-keys))
(setq speechd-speak--handle-braille-keys (not speechd-speak--handle-braille-keys))
(message "Braille keys handled by %s" (if speechd-speak--handle-braille-keys "speechd-el" "BrlTTY")))
;;; Spelling
(define-minor-mode speechd-speak-spell-mode
"Toggle spelling.
When the mode is enabled, all spoken text is spelled."
nil " Spell" nil
(set (make-local-variable 'speechd-spell) speechd-speak-spell-mode))
(defvar speechd-speak-spell-command nil)
(defun speechd-speak-spell ()
"Let the very next command to spell the text it reads."
(interactive)
(unless speechd-speak-spell-mode
(setq speechd-speak-spell-command t)))
;;; Informatory commands
(defvar speechd-speak-info-map (make-sparse-keymap))
(defvar speechd-speak--info-updates nil)
(defmacro* speechd-speak--watch (name get-function
&key on-change info info-string key)
`(locally
(fset (quote ,(speechd-speak--name 'speechd-speak--get name))
,get-function)
,(when info
`(fset (quote ,(speechd-speak--name 'speechd-speak name 'info))
#'(lambda (info)
(interactive)
(funcall ,info info))))
,(when info-string
`(fset (quote ,(speechd-speak--name 'speechd-speak name 'info))
#'(lambda ()
(interactive)
(speechd-speak--text
(format ,info-string
(funcall
(function ,(speechd-speak--name
'speechd-speak--get name))))))))
,(when (and (or info info-string) key)
`(define-key speechd-speak-info-map ,key
(quote ,(speechd-speak--name 'speechd-speak name 'info))))
,(when on-change
`(defun ,(speechd-speak--name 'speechd-speak--update name) (old new)
(speechd-speak--maybe-speak
(let ((speechd-default-text-priority 'message)
(speechd-language "en")
(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)
(speechd-speak--text (format "Buffer %s" new))))
(speechd-speak--watch buffer-identification
#'(lambda ()
(when (fboundp 'format-mode-line)
(let ((ident (format-mode-line mode-line-buffer-identification)))
(set-text-properties 0 (length ident) nil ident)
ident)))
: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)
(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)
(speechd-speak--text
(if new "Buffer writable" "Buffer read-only"))))
(defun speechd-speak-buffer-info ()
"Speak current buffer information."
(interactive)
(speechd-speak--text
(format "Buffer %s, %s %s %s; %s"
(speechd-speak--get-buffer-name)
(or vc-mode "")
(if (speechd-speak--get-buffer-read-only) "read only" "")
(if (speechd-speak--get-buffer-modified) "modified" "")
(let ((ident (speechd-speak--get-buffer-identification)))
(if ident
(format "buffer identification: %s" ident)
"")))))
(define-key speechd-speak-info-map "b" 'speechd-speak-buffer-info)
(speechd-speak--watch frame-name #'(lambda () (frame-parameter nil 'name))
:on-change #'(lambda (old new)
(speechd-speak--text
(format "Frame changed to: %s; was: %s" new old))))
(speechd-speak--watch frame-identification
#'(lambda ()
(when (fboundp 'format-mode-line)
(let ((ident (format-mode-line mode-line-frame-identification)))
(set-text-properties 0 (length ident) nil ident)
ident)))
:on-change #'(lambda (old new)
(speechd-speak--text
(format "Frame identification changed to: %s" new))))
(defun speechd-speak-frame-info ()
"Speak current frame information."
(interactive)
(speechd-speak--text
(format "Frame: %s; %s"
(speechd-speak--get-frame-name)
(let ((ident (speechd-speak--get-frame-identification)))
(if ident
(format "frame identification: %s" ident)
"")))))
(define-key speechd-speak-info-map "f" 'speechd-speak-frame-info)
(speechd-speak--watch header-line
#'(lambda ()
(if (fboundp 'format-mode-line)
(let ((line (format-mode-line header-line-format)))
(if (string= line "") "empty" line))
"unknown"))
:on-change #'(lambda (old new)
(speechd-speak--text
(format "Header line changed to: %s" new)))
:info-string "Header line: %s"
:key "h")
(speechd-speak--watch major-mode #'(lambda () mode-name)
:on-change #'(lambda (old new)
(speechd-speak--text
(format "Major mode changed to: %s; was: %s" new old))))
(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)))
:on-change #'(lambda (old new)
(flet ((set-difference (x y)
(loop for i in x
unless (memq i y)
collect i)))
(let ((disabled (set-difference old new))
(enabled (set-difference new old)))
(when enabled
(speechd-speak--text
(format "Enabled minor modes: %s" enabled)))
(when disabled
(speechd-speak--text
(format "Disabled minor modes: %s" disabled)))))))
(defun speechd-speak-mode-info ()
"Speak information about current major and minor modes."
(interactive)
(speechd-speak--text
(format "Major mode: %s; minor modes: %s"
(speechd-speak--get-major-mode)
(speechd-speak--get-minor-modes))))
(define-key speechd-speak-info-map "m" 'speechd-speak-mode-info)
(speechd-speak--watch buffer-file-coding
#'(lambda () buffer-file-coding-system)
:on-change #'(lambda (old new)
(speechd-speak--text
(format "Buffer file coding changed to: %s; was %s"
new old))))
(speechd-speak--watch terminal-coding #'terminal-coding-system
:on-change #'(lambda (old new)
(speechd-speak--text
(format "Terminal coding changed to: %s; was: %s" new old))))
(defun speechd-speak-coding-info ()
"Speak information about current codings."
(interactive)
(speechd-speak--text
(format "Buffer file coding is %s, terminal coding is %s"
(speechd-speak--get-buffer-file-coding)
(speechd-speak--get-terminal-coding))))
(define-key speechd-speak-info-map "c" 'speechd-speak-coding-info)
(speechd-speak--watch input-method #'(lambda ()
(or current-input-method "none"))
:on-change #'(lambda (old new)
(speechd-speak--text
(format "Input method changed to: %s; was: %s" new old)))
:info-string "Input method %s"
:key "i")
(speechd-speak--watch process
#'(lambda ()
(let ((process (get-buffer-process (current-buffer))))
(and process (process-status process))))
:on-change #'(lambda (old new)
(speechd-speak--text
(format "Process status changed to: %s; was: %s" new old)))
:info-string "Process status: %s"
:key "p")
(defcustom speechd-speak-state-changes
'(buffer-identification buffer-read-only frame-name frame-identification
major-mode minor-modes buffer-file-coding terminal-coding input-method
process)
"List of identifiers of the Emacs state changes to be automatically reported.
The following symbols are valid state change identifiers: `buffer-name',
`buffer-identification', `buffer-modified', `buffer-read-only', `frame-name',
`frame-identification', `header-line', `major-mode', `minor-modes',
`buffer-file-coding', `terminal-coding', `input-method', `process'."
:type `(set ,@(mapcar #'(lambda (i) `(const ,i))
(reverse speechd-speak--info-updates)))
:group 'speechd-speak)
(defun speechd-speak--current-info ()
(sort (mapcar #'(lambda (i)
(cons i (funcall
(speechd-speak--name 'speechd-speak--get i))))
speechd-speak--info-updates)
#'(lambda (x y) (string< (symbol-name (car x))
(symbol-name (car y))))))
;;; Mode definition
(defvar speechd-speak-mode-map nil
"Keymap used by speechd-speak-mode.")
(define-prefix-command 'speechd-speak-prefix-command 'speechd-speak-mode-map)
(define-key speechd-speak-mode-map "b" 'speechd-speak-read-buffer)
(define-key speechd-speak-mode-map "c" 'speechd-speak-read-char)
(define-key speechd-speak-mode-map "i" 'speechd-speak-last-insertions)
(define-key speechd-speak-mode-map "l" 'speechd-speak-read-line)
(define-key speechd-speak-mode-map "m" 'speechd-speak-last-message)
(define-key speechd-speak-mode-map "o" 'speechd-speak-read-other-window)
(define-key speechd-speak-mode-map "p" 'speechd-out-pause)
(define-key speechd-speak-mode-map "q" 'speechd-speak-toggle-speaking)
(define-key speechd-speak-mode-map "r" 'speechd-speak-read-region)
(define-key speechd-speak-mode-map "s" 'speechd-out-stop)
(define-key speechd-speak-mode-map "w" 'speechd-speak-read-word)
(define-key speechd-speak-mode-map "x" 'speechd-out-cancel)
(define-key speechd-speak-mode-map "z" 'speechd-out-repeat)
(define-key speechd-speak-mode-map "." 'speechd-speak-read-sentence)
(define-key speechd-speak-mode-map "{" 'speechd-speak-read-paragraph)
(define-key speechd-speak-mode-map " " 'speechd-out-resume)
(define-key speechd-speak-mode-map "'" 'speechd-speak-read-sexp)
(define-key speechd-speak-mode-map "[" 'speechd-speak-read-page)
(define-key speechd-speak-mode-map ">" 'speechd-speak-read-rest-of-buffer)
(define-key speechd-speak-mode-map "\C-a" 'speechd-add-connection-settings)
(define-key speechd-speak-mode-map "\C-i" speechd-speak-info-map)
(define-key speechd-speak-mode-map "\C-l" 'speechd-speak-spell)
(define-key speechd-speak-mode-map "\C-m" 'speechd-speak-read-mode-line)
(define-key speechd-speak-mode-map "\C-n" 'speechd-speak-read-next-line)
(define-key speechd-speak-mode-map "\C-p" 'speechd-speak-read-previous-line)
(define-key speechd-speak-mode-map "\C-r" 'speechd-speak-read-rectangle)
(define-key speechd-speak-mode-map "\C-s" 'speechd-speak)
(define-key speechd-speak-mode-map "\C-x" 'speechd-unspeak)
(define-key speechd-speak-mode-map "\C-bk" 'speechd-speak-toggle-braille-keys)
(dotimes (i 9)
(define-key speechd-speak-mode-map (format "%s" (1+ i))
'speechd-speak-key-set-predefined-rate))
(define-key speechd-speak-mode-map "d." 'speechd-set-punctuation-mode)
(define-key speechd-speak-mode-map "dc" 'speechd-set-capital-character-mode)
(define-key speechd-speak-mode-map "dl" 'speechd-speak-set-language)
(define-key speechd-speak-mode-map "do" 'speechd-set-output-module)
(define-key speechd-speak-mode-map "dp" 'speechd-set-pitch)
(define-key speechd-speak-mode-map "dr" 'speechd-set-rate)
(define-key speechd-speak-mode-map "dv" 'speechd-set-voice)
(define-key speechd-speak-mode-map "d\C-v" 'speechd-set-synthesizer-voice)
(define-key speechd-speak-mode-map "dV" 'speechd-set-volume)
(defvar speechd-speak--mode-map (make-sparse-keymap))
(defvar speechd-speak--prefix nil)
(defun speechd-speak--build-mode-map ()
(let ((map speechd-speak--mode-map))
(when speechd-speak--prefix
(define-key map speechd-speak--prefix nil))
(setq speechd-speak--prefix speechd-speak-prefix)
(define-key map speechd-speak-prefix 'speechd-speak-prefix-command)
(unless (lookup-key speechd-speak-mode-map speechd-speak-prefix)
(define-key map (concat speechd-speak-prefix speechd-speak-prefix)
(lookup-key global-map speechd-speak-prefix)))))
(define-minor-mode speechd-speak-map-mode
"Toggle use of speechd-speak keymap.
With no argument, this command toggles the mode.
Non-null prefix argument turns on the mode.
Null prefix argument turns off the mode."
nil nil speechd-speak--mode-map)
(easy-mmode-define-global-mode
global-speechd-speak-map-mode speechd-speak-map-mode
(lambda () (speechd-speak-map-mode 1))
:group 'speechd-speak)
(defun speechd-speak--shutdown ()
;; We don't have to call CANCEL here, since Emacs exit is usually called
;; interactively, so it is preceded by the pre-command CANCEL. Moreover,
;; calling CANCEL here means trouble with stopping the final exit messages.
(speechd-speak-report 'finish :priority 'important))
;;;###autoload
(define-minor-mode speechd-speak-mode
"Toggle speaking, the speechd-speak mode.
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.
The following key bindings are offered by speechd-speak mode, prefixed with
the value of the `speechd-speak-prefix' variable:
\\{speechd-speak-mode-map}
"
nil " S" speechd-speak--mode-map
(if speechd-speak-mode
(progn
(speechd-speak-map-mode 1)
(add-hook 'pre-command-hook 'speechd-speak--pre-command-hook)
(add-hook 'post-command-hook 'speechd-speak--post-command-hook)
(add-hook 'before-change-functions 'speechd-speak--before-change-hook)
(add-hook 'after-change-functions 'speechd-speak--after-change-hook)
(add-hook 'minibuffer-setup-hook 'speechd-speak--minibuffer-setup-hook)
(add-hook 'minibuffer-exit-hook 'speechd-speak--minibuffer-exit-hook)
(add-hook 'kill-emacs-hook 'speechd-speak--shutdown))
;; We used to call `speechd-cancel' here, but that slows down global mode
;; disabling if there are many buffers present. So `speechd-cancel' is
;; called only on global mode disabling now.
)
(when (called-interactively-p 'interactive)
(let ((state (if speechd-speak-mode "on" "off"))
(speechd-speak-mode t))
(message "Speaking turned %s" state))))
;;;###autoload
(easy-mmode-define-global-mode
global-speechd-speak-mode speechd-speak-mode
(lambda () (speechd-speak-mode 1))
:group 'speechd-speak)
(speechd-speak--defadvice global-speechd-speak-mode before
(when global-speechd-speak-mode
(speechd-out-cancel)))
;; global-speechd-speak-map-mode is not enabled until kill-all-local-variables
;; is called. So we have to be a bit more aggressive about it sometimes. The
;; same applies to global-speechd-speak-mode.
(defun speechd-speak--enforce-speak-mode ()
(flet ((enforce-mode (global-mode local-mode-var)
(when (and global-mode
(not (symbol-value local-mode-var))
(not (local-variable-p local-mode-var)))
(funcall local-mode-var 1))))
(enforce-mode global-speechd-speak-map-mode 'speechd-speak-map-mode)
(enforce-mode global-speechd-speak-mode 'speechd-speak-mode)))
(defun speechd-speak-toggle-speaking (arg)
"Toggle speaking.
When prefix ARG is non-nil, toggle it locally, otherwise toggle it globally."
(interactive "P")
(if arg
(speechd-speak-mode)
(global-speechd-speak-mode))
(when (called-interactively-p 'interactive)
(let ((state (if speechd-speak-mode "on" "off"))
(speechd-speak-mode t))
(message "Speaking turned %s %s" state (if arg "locally" "globally")))))
(defun speechd-unspeak ()
"Try to avoid invoking any speechd-speak function.
This command is useful as the last help in case speechd-speak gets crazy and
starts blocking your Emacs functions."
(interactive)
(setq speechd-speak--started nil)
(ignore-errors (global-speechd-speak-mode -1))
(when speechd-speak--message-timer
(cancel-timer speechd-speak--message-timer)
(setq speechd-speak--message-timer nil))
(remove-hook 'pre-command-hook 'speechd-speak--pre-command-hook)
(remove-hook 'post-command-hook 'speechd-speak--post-command-hook)
(remove-hook 'before-change-functions 'speechd-speak--before-change-hook)
(remove-hook 'after-change-functions 'speechd-speak--after-change-hook)
(remove-hook 'minibuffer-setup-hook 'speechd-speak--minibuffer-setup-hook)
(remove-hook 'minibuffer-exit-hook 'speechd-speak--minibuffer-exit-hook)
(remove-hook 'kill-emacs-hook 'speechd-speak--shutdown)
(speechd-out-shutdown)
(global-speechd-speak-map-mode -1))
;;;###autoload
(defun speechd-speak ()
"Start or restart speaking."
(interactive)
(when speechd-speak--started
(speechd-unspeak))
(setq speechd-speak--started t)
(speechd-speak--build-mode-map)
(setq speechd-speak--post-command-speaking
speechd-speak--post-command-speaking-defaults)
(global-speechd-speak-mode 1)
(global-speechd-speak-map-mode 1)
(speechd-speak--debug 'start)
(condition-case err (speechd-speak-report 'start)
(speechd-connection-error
(message (format "%s: %s" (car err) (cdr err)))
(sit-for 2)
(message "Customize `speechd-out-active-drivers' to disable drivers you don't use.")))
(setq speechd-speak--message-timer
(run-with-idle-timer 0 t 'speechd-speak--message-timer))
(run-hooks 'speechd-speak-hook))
;;; Announce
(provide 'speechd-speak)
;;; speechd-speak.el ends here
speechd-el-2.6/speechd-speak.pdf 0000644 0001750 0001750 00000100501 12206216327 014721 0 ustar pdm pdm %PDF-1.2
%Çì¢
6 0 obj
<>
stream
xœu’ËnÂ0E÷þŠYR ?âו]Y²ê.
! R¿¾c"–béÌøÞñMÎÀQ kØË–Ùt™AÝ3ŽŽ¸çt5Ð0éjˆoœë´‚®b¦áú¾¼bjvqóJ[ÙÂ,'7Où†ZLÈŒDM-ä-NUUn?ò#]«©!_³ÑgÓŸŠK¹ºPÑÈ…»×ŠÃ:@Î<à¼-Ê>ªðL%:„c¦M"_ÍoW*1S÷Ó«ãær¨sw£Ø)Ðd~@‹ªº4‡:Ù'ɹ
Ô˜g]ÐtI‰(C²h@
‹Ôü’ƒwJ½K"{ÔI¸—8Hò’Á‹f£@i‹ÙÍjÑì‹C¼öéàOÑÅ~XÆ'’.)5é }êÐ6ëb¤ÞyzÒ;<¶ã8¼²2ic¯†s10>
stream
xœT[oÓ0~÷¯ðC"žï±yƒ±7`‹Äs–ºm ¹,É4í ÁŸÆî±n¬ªÔV_ŽÏù.ǹǔ0LÃ'þ6ºG”XÊ1ÃÓ1Ü"nQ¾•0—F <9´E
?ž|‹(Þ¡{ÌŽCÒOÓẼaÆO¨¶¾ÆàÂÏÄšå;hRâªC·£sÍþmõùÆ¥òÕ]|jç±^š½›ÂE(3ùYÝoȈÑ+xÝÕÍ]¨ }J¤Ò ùÜÞM. œH‘OßÛå1¢ÆäAPɈ–6B_œ[Ú~ƒÊ“œRP _Yñ ]Þpš<ðÿ
~t‰S½T«V#€ƒ:6؃ Ãôg€öùÅBpÊ›BM„~ÀËLg"Dˈ<¦cÖÐT5¯DW/‰äfm¿¸i[74¦œ.IÎÂÏQ`ïiÆöLÈÒSO6¿@aˆ¤^wÁ “:ý9òŠUWC7Üâà´¢¹ñü0ŽÃ·Á&HP‚*Ê"6lA>µÏÔG®RdýóS¿ìÝÜw¬`’hÍÚ+ľÃ$Ë„µI’;’ù)ÜûÕ»MµÚ2·AÀŒ?sRaV¤
m↪¬2¼§—U6C×ÁÑ27|èÛ¦^Ú¡÷8M=—ý4<ìþM«Ž°Ú\]}…®œ¯ä‡&2Ê;ü32*½i7Ý1ŒBø8”ˆ¿bdµú¬z±wg02nêþÍu"_Ÿ»X&äz+¦a§ØäØœçk‚u×AZ!~Ê쑵x…õ‡q<œ˜ëß^©ÅoÛzC4)*óºük*åYâ”Öʬ¤ž +µ_ê4ÿÿ׿w›ç:Þ?jÊÓ®×þ†Âç/ŒÐ}endstream
endobj
17 0 obj
643
endobj
24 0 obj
<>
stream
xœu’[jÜ0†ßµ
½u±ª»å¾µ$oI oÀñÈc‡X㱆¬ Ð
e{•¬‹C`ØðÛ.gˆØ¿øoGp)*L!ó8 ª0|S–J08kÐ/×Í{€áœ!Y‹¤_;Â_5øþ‡JW¡îœ‚…« %EÂe¨„õvûIë¶¿©_€K\
çPÀînX¦Æ¶½ž½E LT¶5æà!AJnð~lÚ%dÁœ%zë F\ÈD†çY{Jg9zêì%R¥r¡àIäUDZÛÁC¡òSŠ1óTJD3\‰A™F@1,è:$ŠuÓÄUb›CP1ôA¿"òË`‚ éÖà ÜL°Šè_ ´Ìr¦SD¸Œä’Â*…“ײ QT|’“
Æê¹kZ{Œk.(G¥+"n’Þõç4½mc‡“ùæ<ê°û¸ùROQžØŠq-·o‹³œ`y7¶×˰wž[ïÞLëU®†‚T¨ôA…ÓËWûǪ%ÉuÚâÅ‘må/o‹› Wõô_°ÚnþÒ76@&¯÷º4‘ÐÔå»÷5ü
üûÞsî»endstream
endobj
25 0 obj
461
endobj
30 0 obj
<>
stream
xœu‘MNä0…÷>E-A"5åߨ,ѰLÍ:¤ÝÝAô_:Rs.4×ÃŽíôEJ¤Ï¯^½<Å'»-;2B€#†5ãÐ3a%jHo-„Új ƒg+¦áüýñ‚¬Ùø´¤|º-Ü5ìÇo74« ±P…`êà`°†fË®ï»Íuó‚qƒ Y²«ŸýéÐŽÝÆñD#q;Ÿµ»e„¹ÀûmÛ’)YèM$„J›B~õσT ’óôb¿Ï™Z;/JJŽF¹Œ¼ûÝ:-ªÿqD2RcPÌPE*¥AP‰©$A(B›dÐéK)‚“&lR~ËͧbR ®/SQ¡²½' ê9ÎaŸÕ™œË˜³TT§K+ôç ³Y¿ý°j;Ÿÿ1_s%Öq®’ÈC“QútJkrÅóømU"UØ/“ôï¤Ëš&ßž+C>-J?ocŠO¡â,Yöã~ÚV)ÿ4yµ~hû×”à;ÅŸ´Ëqé\¹}ÿœS;®¦¹ÿ„^lüëd}ßÀ#‹ÏÎBÍòendstream
endobj
31 0 obj
411
endobj
36 0 obj
<>
stream
xœu’MNÃ0…÷>Å,‹DÍØŽg…„èÐ\ ¤N¤¤mTqN]ÿ„‚¥Dúü