Fork me on GitHub
#spacemacs
<
2018-06-09
>
spfeiffer18:06:18

And i thought THAT's why you called yourself „ag“ ☺️

twashing19:06:54

Hmm, why doesn’t (global-set-key (kbd "C-/") 'avy-goto-char-2) use that key mapping?

twashing20:06:24

Spacemacs just keeps the old binding.

C-/ runs the command undo-tree-undo (found in undo-tree-map), which is an interactive compiled Lisp function in
'~/.emacs.spacemacs/elpa/undo-tree-0.6.5/undo-tree.el'.

It is bound to C-_, C-/, s-z, <menu-bar> <edit> <undo>, <undo>.

eggsyntax20:06:39

How are you running global-set-key?

twashing20:06:13

Just in an .el file.

twashing20:06:33

packages.el in my own custom layer.

eggsyntax20:06:50

Ah. There I can't help you; I haven't done custom layers at all. I'd try it in .spacemacs (in dotspacemacs/user-config) and see if that works, and also try doing it at runtime. Just to try to isolate.

twashing20:06:00

Yes, exactly. Just evaluating that command at runtime doesn’t work.

eggsyntax20:06:12

My guess is that the other binding is getting loaded later than yours is. If the above doesn't work, I'd also try binding it to something different, and/or binding that combo to something else, again just to isolate. Sorry, I know that's all the obv stuff, I've got no particular insight into why it's not working.

twashing20:06:47

Hmm, it’s just weird… and frustrating.

eggsyntax20:06:01

Oh. OK, if evaling it at runtime doesn't work, that blows my theory. Does it work if you eval (avy-goto-char-2 <SOME-ARGS>) at runtime?

twashing20:06:25

I can certainly run the function. Yep, and that works.

twashing20:06:40

It’s the keybinding that doesn’t work.

twashing20:06:11

And this doesn’t work either. (global-set-key (kbd "C-_, C-/, s-z") 'avy-goto-char-2)

eggsyntax20:06:08

I think it has to be if you can call it at runtime, but: is it possible that avy-goto-char-2 isn't (interactive)?

eggsyntax20:06:51

Can you bind it using define-key or one of the other binding options?

twashing20:06:49

Well my existing kbd works: (global-set-key (kbd "C-c g c") 'avy-goto-char-2)

twashing20:06:05

But this doesn’t (global-set-key (kbd "C-/") 'avy-goto-char-2)

eggsyntax20:06:41

Weird. Some limitation on global-set-key? Beats me. Gotta run, good luck!

twashing20:06:02

Thank-you brother.