1

A trivial Problem?

I have somehow managed to set cand a few other keys to prefix-commands, meaning they wait for a further input (like e.g. C-x does) and so I cannot actually type the letter c when yas-minor-mode is enabled. See here for more details: Remove strange keybindings from YASnippet

I like yas-minor-mode, however, and so would like to remove these prefix keys so the normal character c on my keyboard to actually insert a c into emacs when in yas-minor-mode.

I had tried removing yas-minor-mode and reinstalling - no luck. I tried to redfine the keys with things like global-set-key - again no joy.

Here is another similar looking questions, which made me think I could use the function basic-event-type - but I now think it isn't correct - plus my version 24.5 emacs doesn'T even seem to have that function.

How can I convert a C-key code into a 'normal' key code?

n1k31t4
  • 669
  • 8
  • 18
  • "I have somehow managed to set `c`[...] they wait for a further unput" - this probably due to a snippet with a [`# binding:` header](http://joaotavora.github.io/yasnippet/snippet-development.html#org67f4e69) grabbing these keys. – npostavs Oct 05 '18 at 11:39

1 Answers1

4

Just bind the key that corresponds to the character that you want to insert to self-insert-command. E.g., assuming that the variable holding the keymap you want is yas-minor-mode-map, and if c is the character:

(define-key yas-minor-mode-map "c" 'self-insert-command)

Or for the global-map:

(global-set-key  "c" 'self-insert-command)
Drew
  • 75,699
  • 9
  • 109
  • 225
  • 1
    This is perhaps a "Band-Aid"™, as the behavior described by the original poster should not be happening out of the box. – lawlist Sep 18 '15 at 21:54
  • Thanks, this works for me - I had been looking for a function like 'self-insert-command', but as an Elisp beginner I didn't find it. @lawlist - As I had mentioned in my post, I introduced the error myself after playing around with saome other key binding - it wasn't a problem "out of the box". If I get further issues after Drew's fix, I will update the post here! – n1k31t4 Sep 18 '15 at 22:55
  • 2
    You can find `self-insert-command` by using `C-h k` and typing any key that inserts the char that it names. So if self-insertion still works for `a`, for instance, then `C-h k a` will tell you that `a` is bound to `self-insert-command`. – Drew Sep 18 '15 at 23:36
  • `C-h k` was my 'find of the day' - although somewhat bittersweet... one has to feel quite ashamed for not having known it in the first place! – n1k31t4 Sep 18 '15 at 23:58
  • `C-h C-h` is your friend, and will teach you about `C-h k`, `C-h m`, `C-h v`, and more. – Drew Sep 19 '15 at 01:38