Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Emacspeak into Doom, or support Emacspeak #4256

Open
devinprater opened this issue Nov 11, 2020 · 8 comments
Open

Integrate Emacspeak into Doom, or support Emacspeak #4256

devinprater opened this issue Nov 11, 2020 · 8 comments
Labels
help wanted Cannot be resolved without outside help is:feature Adds or requests new features, or extends existing ones re:modules Pertains to adding, removing and management of modules
Milestone

Comments

@devinprater
Copy link

devinprater commented Nov 11, 2020

Describe the feature

  • If the feature involves new plugins, include links to them
  • If the feature involves replacement of current functionality, how the new
    functionality is better?
  • If the feature is implemented in another editor or Emacs distro, include:
    • Screenshots or screencasts of it
    • Links to its implementation
    • Names of relevant commands (and not only the keybinds to invoke them)

Emacspeak is a speech system for blind people that turns Emacs into an "auditory desktop." It uses speech, speech characteristic changes, and sounds to convey information, using system TTS functions (Linux: ESpeak (free) or Outloud($5)), Mac (say command). I'm not sure how well it could be integrated into Doom, but it would be nice to have a good, easier-to-use version of Emacs I just point people to, that would actually work well for them, rather than just having to say "Well you can use Emacs, but you have to fiddle with it for hours so you might as well use VS Code if you want to be productive." Emacspeak isn't in any other distribution of Emacs, as far as I know. Emacspeak doesn't replace any other feature. It is loaded using Load-file, so it's not really like packages that are on MELPA. It doesn't have a command to start it, although a doom script could be added to switch it on or load it into the .emacs.el.

I've not tried Doom yet, but I'll update this issue when I have, and if Emacspeak does work it it, just being put into the .emacs.el. I usually use a Windows PC, but Emacspeak for Windows is pretty out of date, so I'll use a MacBook Pro, late 2019 with four thunderbult ports, for this.

@devinprater devinprater added the is:feature Adds or requests new features, or extends existing ones label Nov 11, 2020
@hlissner hlissner added re:modules Pertains to adding, removing and management of modules help wanted Cannot be resolved without outside help status:backlog labels Nov 11, 2020
@hjozwiak
Copy link

Hello,

I figured that I would take a stab at this since I too enjoy using emacs and use Emacspeak. I will put in my packages.el file, as well as the error that I get when I run doom sync.
doom.error.log

packages.txt
Note: when doing this by hand, the steps are make espeak; make config; make.
Strait format is something new to me, so I am not sure what can be done about the particular errors I am getting.

@hjozwiak
Copy link

So I did try to use Doom with Emacspeak after compiling it by hand, and unfortunately I am not sure what else would need to go into getting this to work. When I launch Emacs after adding the load-file call to my ~/.doom/config.el, Emacspeak says the espeak version message but nothing thereafter. @devinprater did you try this also, and if so, what did you discover?

@devinprater
Copy link
Author

devinprater commented Jun 11, 2021 via email

@theophilusx
Copy link

Just in case it helps anyone. I was able to get Emacspeak basically working under doom by doing the following -

  1. Cloned the Emacspeak github repo, run make clean, make config and make
  2. Build the speech server - in my case outloud in the servers directory of the repo
  3. Created a basic emacspeak config file called ~/.doom.d/my-emacspeak.el, which basically sets the speech server, adds the emacspeak repo to the load-path and loads the emacspeak-setup.el file.
  4. Add the following to .doom.d/config.el

(add-hook 'after-init-hook (load (expand-file-name "./my-emacspeak.el"))

I found the after-init-hook was required because otherwise, you got errors relating to problems with Emacsepak trying to remap the C-e key (emacspeak uses C-e as a prefix command and remaps end-of-line to C-e e and C-e C-e).

There are still some problems to fix up. I notice some text does not get spoken which should and imagine there are a few doom functions which will probably need emacspeak advice added to them. However, this does get a basic install sort of working.

@hjozwiak
Copy link

I will have to try this; when I tried it by hand, I couldn't get the modifications I made to rate to stick until I restarted Doom, but that caused further issues because I got messages about how the device was not a terminal.

@hlissner hlissner added this to the Backlog milestone Oct 4, 2021
@hlissner hlissner removed the backlog label Oct 4, 2021
@hjozwiak
Copy link

hjozwiak commented Dec 9, 2021

Just in case it helps anyone. I was able to get Emacspeak basically working under doom by doing the following -

  1. Cloned the Emacspeak github repo, run make clean, make config and make
  2. Build the speech server - in my case outloud in the servers directory of the repo
  3. Created a basic emacspeak config file called ~/.doom.d/my-emacspeak.el, which basically sets the speech server, adds the emacspeak repo to the load-path and loads the emacspeak-setup.el file.
  4. Add the following to .doom.d/config.el

(add-hook 'after-init-hook (load (expand-file-name "./my-emacspeak.el"))

I found the after-init-hook was required because otherwise, you got errors relating to problems with Emacsepak trying to remap the C-e key (emacspeak uses C-e as a prefix command and remaps end-of-line to C-e e and C-e C-e).

There are still some problems to fix up. I notice some text does not get spoken which should and imagine there are a few doom functions which will probably need emacspeak advice added to them. However, this does get a basic install sort of working.

Do you have a gist of step three? Will give Doom another look and kick the tires again.

@sparagi
Copy link

sparagi commented Jan 15, 2023

I think I have the basics of doom and emacspeak working together (although not in an ideal way and not enough to solve this issue). I have tested these steps in this environment:

  • Debian 11
  • Freshly created user account
  • Packages installed via apt before these steps begin
    • emacs 1:27.1+1-3.1+deb11u1
    • emacspeak 53.0+dfsg-1
    • espeak 1.48.15+dfsg-2
  • Doom 3.0.0-pre

Steps:

  1. Confirm emacspeak works without doom.
emacspeak &

Before I got my emacspeak installation working, emacspeak would sometimes play a welcome announcement but then not say anything else. Based on symptoms, I think the initial announcement might be a recording that doesn't actually use the engine. I see @hjozwiak had the same problem. For me this was independent of Doom's involvement. I can't remember which thing fixed it, but among other things, I used dpkg-reconfigure emacspeak to explicitly select eSpeak (the speech engine I had installed, which is the nominal default already), and used the system sound equalizer to unmute eSpeak and turn its volume up.

Anyway, after it launches, navigate around a little and make sure it reads something related to what you navigated over before you bring Doom into the mix. Debug if it does not.

  1. Exit emacspeak.

  2. Install doom. Specifically, I did these steps, which I got from some doom install instructions:

git clone --depth 1 --single-branch https://github.com/doomemacs/doomemacs ~/.config/emacs

Make sure .emacs.d links to .config/emacs. If .emacs.d doesn't exist,

ln -s ~/.config/emacs ~/.emacs.d

If .emacs.d already exists, you'll have to sort the situation as you see fit.

Finally:

export PATH=$PATH:$HOME/.config/emacs/bin
doom install

I did not have it create an envvar file.

  1. Launch emacs using the emacspeak script.
emacspeak &

Edited to insert a new step 5:

  1. Confirm Doom is working. There will be a starting sound effect and a completely different welcome buffer.
  2. Use the same process from step 1 to confirm emacspeak works now.
  3. Open a file and confirm that C-e e takes you to the end of the line.

I don't think even this much was working in 2022-11, and it's possible I did something system-wide then (beyond setting emacspeak's speech engine) that I didn't write down. I am new to both doom and emacspeak, and am returning to emacs after a 22 year gap, so I might not know what is supposed to happen, and I might not see all the relevant error messages. Verification by someone else, particularly someone who has used at least one of these packages, particularly on a fresh system, would be much appreciated.

Ideally, I would like both doom and emacspeak to load when one launches emacs via any method. That is what I will try to set up next, using the hints from @theophilusx earlier in this ticket. I dug into the emacspeak launch setup quite a bit before I got it to work, so I think I can construct a my-emacspeak.el.

@ZeroContradictions
Copy link

ZeroContradictions commented Apr 8, 2023

I managed to get Emacspeak working inside Doom-Emacs with the following steps:

  1. cd ~/.config/emacs
  2. git clone https://github.com/tvraman/emacspeak
  3. git clone https://github.com/espeak-ng/espeak-ng
  4. cd servers/native-espeak
  5. cd emacspeak
    • make config
    • make
  6. cd servers/native-espeak
    • make
    • If needed, add the following line to the file, tclespeak.cpp:
      #include "/home/username/.config/emacs/espeak-ng/src/include/espeak-ng/speak_lib.h"
    • make
  7. Add this line to .bash_profile:
    • export DTK_PROGRAM=espeak
  8. Add this line to config.el:
    • (load! "/home/username/.config/emacs/emacspeak/lisp/emacspeak-setup.el")
    • ;; Note: add lines for the (emacspeak-toggle-*) functions and emacspeak-*-echo variables to customize the functionality. Use M-x apropos-command and M-x apropos-variable to find them
  9. sudo apt-get install libespeak-ng-dev
    • Note: installing this library in particular was what made everything work, and I was only able to figure that this library needed to be installed when I translated the Chinese written in this github issues thread: Ubuntu 20.04 build error: /usr/bin/ld: cannot find -lespeak-ng hgneng/ekho#48)
    • sudo apt-get install espeak-data libespeak-dev espeak-ng
    • These lines aren't needed, but they might help, if things aren't working for whatever reason:
      • ln -s /usr/bin/espeak espeak
      • sudo apt-get install tclx8.3 tclx8.3-de
  10. You should be able to run espeak by running this line in the shell now:
    • /home/username/.config/emacs/emacspeak/servers/espeak
  11. Continue following the instructions here: https://tvraman.github.io/emacspeak/manual/Building-And-Testing-The-Speech-Server.html#Testing-The-Selected-Server_002e

I'm not blind or have any vision problems, but I was curious about trying out Emacspeak since I thought it could be a way to continue working at the computer without excessively straining my eyes. While Emacspeak is working correctly in Doom-Emacs as far as I can tell, it would take some time to get used to all the keybindings and speaking that it does, much like everything else there is to learn in technology.

It will be really nice when an Emacspeak module is created for Doom. Sometime it speaks too much (e.g. telling me whenever I switch between the normal, visual, and insert minor modes) or too little in my opinion, and I also wish it would speak different things at different rates.

It would also be convenient if there was the ability to easily turn Emacspeak on or off whenever I want with a keybinding, but I haven't figured out how to turn Emacspeak off when it's already turned on after evaluating /home/username/.config/emacs/emacspeak/servers/espeak. I can evaluate (dtk-toggle-quiet -1) if I want to turn off the sound server in all buffers, but that doesn't completely turn off all the sounds for visiting new buffers, closing open buffers, and other things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Cannot be resolved without outside help is:feature Adds or requests new features, or extends existing ones re:modules Pertains to adding, removing and management of modules
Projects
Status: Unreviewed
Development

No branches or pull requests

6 participants