winterTTr / ace-jump-mode

a quick cursor jump mode for emacs

Home Page:https://github.com/winterTTr/ace-jump-mode/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specify character keys

ReneFroger opened this issue · comments

Hello!

First, I would thank you for the great work on Ace Jump mode!

I have an question, I searched everything.

I have set this now:
(setq ace-jump-mode-move-keys
(loop for i from ?a to ?z collect i))
But I would to be more specific, which characters will be used and which will not be used.

I tried various things:

(setq ace-jump-mode-move-keys
abcdef or a b c d e f
(a b c d e f))
("abcdef"))
([abcdef]))
(abcdef))

Nothing worked so far. Have you a suggestion how I could the specific keys getting working?

Thanks in advance!

This should work:

(setq ace-jump-mode-move-keys '(?a ?b ?c ?d ?e ?f))

Thanks YoungFrog! You saved my day!

One question, how could you figure this out? Then I'm learning from that too.

It's hard to tell how I figured it out, because it's the kind of things I'm now used to. The key bits I think are (i) to understand that ?a represents a character and (ii) how to feed a list to emacs (either via explicit construction --see below-- or using a litteral list --like in my earlier suggestion--).

For (i) : the elements that ace-jump expects are 'characters', which can be fed to elisp with the '?' syntax. '?a' represents the character 'a' (and it is in fact represented by emacs as just an integer, namely 97 because of ASCII)

For (ii), let me just give you another way of doing essentially the same thing:

(setq ace-jump-mode-move-keys (list ?a ?b ?c ?d ?e ?f))

which makes it clear that we're creating a list of elements.

If you're interested in the details, you should read the emacs lisp intro or the emacs lisp manual. But that's longer.

Hi YoungFrog,

Thanks for your clear reply. But I was more curious how you're found out to add the single quote ( ' ) before the brackets ( .. ). So it is (setq ace-jump-mode-move-keys '(list ?a ?b ?c ?d ?e ?f)). I never seen this anywhere, except for the commands in keybindings.

Your help is greatly appreciated! Thanks for that!

Either (list ?a ?b ?c ?d ?e ?f) or '(?a ?b ?c ?d ?e ?f).
The single quote allows one to quote so that emacs won't try to evaluate it.

I get it, thanks!

This page: http://www.gnu.org/software/emacs/manual/html_node/elisp/Quoting.html especially the quote/foo was an eye opener for me. As Vim user, I'm gonna like the Lisp language. :)