I'm trying to bind tab to either a tab or multiple spaces in Latex/ESS-noweb mode but I can't get it to work. I tried (local-set-key (kbd "<tab>") 'self-insert-command) which didn't work, and then (local-set-key (kbd "<tab>") (lambda() (insert " "))) which also didn't work.
Asked
Active
Viewed 239 times
0
Stefan
- 26,404
- 3
- 48
- 85
1 Answers
0
(local-set-key (kbd "<tab>") #'tab-to-tab-stop)
Will make tab behave like it does in other primitive editors.
Moyamo
- 398
- 2
- 7
interactivespec, which makes it a plain function, rather than an interactive command. Functions must be interactive in order to be bound to keys. See https://www.masteringemacs.org/article/mastering-key-bindings-emacs for a great writeup on how to define and bind commands. – Basil Jan 21 '18 at 00:02interactivespec. 2. Only keys that correspond to characters can reasonably be bound toself-insert-command, so your first attempt would be wrong even if it hadinteractive:(kbd "<tab>")is not something that can be used byself-insert-command.