2

Currently I have to press some modifier combo + letter to trigger ace jump with letter. This is obnoxiously time-consuming for a command I use all the time.

I want to be able to just hold down a key (æ in my case) and press "s" (like I'd do shift-s to write capital S) to trigger ace-jump for s. And so on for the other letters.

The main problem is taking a general letter and triggering the command for that letter, I presume. (I could probably have come up with a hard-coded solution myself and will be hesitant to accept one as an answer.)

PS. ace-jump tag missing.

  • Use (event-basic-type last-command-event) in your command ? – politza Jun 20 '15 at 10:09
  • 1
    So is your question "how can I use a non-modifier key as a modifier key?" – Dan Jun 20 '15 at 15:34
  • Event-basic type will give me the letter it seems. Will play around with it to understand it properly. – The Unfun Cat Jun 21 '15 at 5:57
  • @Dan perhaps to some degree. Ace-jump is a command that is not meant to be used with a modifier, so it is rather how do I convert/call a command that is not meant to be used with a modifier to one that does. – The Unfun Cat Jun 21 '15 at 6:00
  • I might do this on an OS level rather, by making the desired mod key trigger the neccessary prefix combo within emacs. – The Unfun Cat Jun 21 '15 at 6:03
2

You can simulate æ as a modifier using key-chord. I don't have an æ key, so I'll demonstrate with q

(key-chord-mode +1)
(dolist (key (number-sequence 0 255))
  (lexical-let ((key-saved key))
    (key-chord-define-global (vector ?q key)
      (lambda ()
        (interactive)
        (avy-goto-char key-saved)))))

If you plan on always holding æ first, you may be interested in this variant:

(key-chord-mode +1)
(dolist (key (number-sequence 0 255))
  (lexical-let ((key-saved key))
    (global-define-key (vector 'key-chord ?q key)
      (lambda ()
        (interactive)
        (avy-goto-char key-saved)))))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.