Emacs and accessibility

Hi,

For the last couple of years I’ve been facing issues with my right hand and kinda lost control of thumb, index and pink fingers due to a condition called distonia or writer’s cramp.

Because of that I moved from a keyboard centric setup with Gentoo, i3 and vim to a more chill one using Mac os and a ton of mouse that I had to learn to use with the left hand.

This kinda suck because I was a really faster typist and loved to rice my setup and optimize every bit of it and I was using vim for the last 20 years or so.

Trying to improve my quality of life I’m starting to experiment with emacs because I feel it’s easier to hit M-x and type the function name with tabs and all the visuals than try to hit a bunch of random keys on vim to achieve the same thing (and usually doing it wrong). But one thing that I really miss is navigating with hjkl because these keys happen to be underneath my two functional fingers so it’s super simple to walk on the opened file.

On the other hand it’s kind of hard to hit C-n, C-p, etc on emacs. So my question is if you emacs gurus have any suggestion to help me overcome this issue with emacs. I’ve heard about evil mode before but I really don’t know if it is a bad thing to become dependent or if it is a nice project!

EVIL mode is very widely used; if you like the Vim-like paradigm, give it a try. It’s not all-or-nothing; you can switch into “Emacs mode” at any time.

Alternatively, there are various other modal packages that reduce the use of modifiers keys, such as god-mode, boon, and meow (and probably numerous others that I can’t recall…I think ryo is also one).

Something you didn’t mention was keyboards: what kind are you using? Have you tried various ergonomic ones?

As @alphapapa said, you can install evil and switch between the Evil state and regular Emacs bindings via C-z at any time when evil-mode is active. However, if all you need is hjkl, then you could also use the following function and bind it to a convenient key:

(defun forum/michel/hjkl ()
  "Temporarily enable hjkl navigation."
  (interactive)
  ;; Inspired by `text-scale-adjust'.
  (let ((key (event-basic-type last-command-event))
        (echo-keystrokes nil))
    (pcase key
      (?h (backward-char))
      (?j (next-line))        ; bug: will revert to original column
      (?k (previous-line))    ; bug: will revert to original column
      (?l (forward-char)))
    (set-transient-map
     (let ((map (make-sparse-keymap)))
       (dolist (key '(?h ?j ?k ?l))
         (define-key map (vector key)
                     #'forum/michel/hjkl))
       map)
     nil nil "Navigate with %k")))

This allows you to use hjkl to navigate. Any other key will automatically exit the temporary hjkl state.

Note that this ain’t perfect, because both next-line and previous-line are solely meant for interactive use, not for use within Lisp (hence the “bugs”). But this might be good enough at the moment for you, or at least provides some inspiration for your own configuration :slight_smile:

Here’s a demonstration:

hjkl

Hope that helps.

I think line-move-visual will help there.

1 Like

That sounds very serious. As already mentioned there are also other packages, besides evil, that could help. I personally like meow.

That being said, in case you are not already using those I would strongly encourage you to get into ergonomic keyboards & ergonomic layouts. It might be that you are already familiar with them, but I still thought it was worth to point out.

This story could be motivating for you

This is the one I am building:
https://bastardkb.com/charybdis/

All the best for you.

1 Like

You might be interested in an approach like this:

https://emacsconf.org/2023/talks/voice/

I haven’t tried it myself, although it is on my endless list of things to try… Since now I have enough compute to run whisper in real-time.

1 Like

Nice! I’ll take a look at those other packages and see if I can benefit from any of them! Thanks

Thank you! I’ll give this a try too!

Dystonia is a strange condition because it’s a neurological one, so there’s nothing wrong with my hand itself, it’s just my brain that is now bugged and send commands to the wrong muscles while I try to type. And more bizarre is that the issue only happens while typing, thus the disease full name is " Task-specific focal dystonia". They say if you are a musician you can have it only while playing an instrument, or if you are a writer only while writing. In my case it’s only when typing.

So I don’t think a ergonomic keyboard would help since I wouldn’t be able to keep my hand on a proper position. What helps me is a keyboard with a large gap between keys so I don’t accidentally hit the wrong one.

I think I should’ve answer everyone on a single message instead of multiple one, sorry about that!

Forgive the unsolicited advice-giving, but when you said you have focal dystonia, I remembered a video I saw on YouTube recently where a bass guitar player talks about how, after trying many things and seeing many specialists, he finally found that wearing gloves while playing has essentially solved the condition for him, allowing him to continue playing his instrument. Here’s the link, in case it’s of any help to you:

Oh man, this is amazing! His story is exactly like mine. Just bought a pair of gloves and am waiting on them to arrive so I can give it a try. I can’t thank you enough for sharing this with me! You gave me hope and is I was able to I’d be definitely with my fingers crossed haha! Thank you!

6 Likes

I’m happy to hear that. Please let us know how it turns out!