Questions tagged [self-insert-command]
10 questions
8
votes
2 answers
Automatically inserting an space when inserting a character depending on the previous character
Usually after inserting punctuation marks like . , : I make an space before inserting the next character.
Is it possible that Emacs automatically do this behavior? For example inserting something like .x results in typing . x where x is an arbitrary…

Name
- 7,689
- 4
- 38
- 84
6
votes
1 answer
Mimic self-insert-command with insert/insert-char?
Due to various/extensive remappings I insert symbols with Control+key, for example Ctrl+9 inserts a left parenthesis (. This works fine with the remappings and the insert/insert-commands, however, modes such as smartparens do not catch this. In my…
user6729
4
votes
4 answers
writing tests for a post-self-insert-command hook
I wrote a minor mode with the purpose of modifying written text on the fly.
It is currently creating a post-self-insert-command-hook, and triggers only on specific keypresses (e.g. the space bar, a semicolon, an open parens).
As an example, the user…

Trevoke
- 2,375
- 21
- 34
4
votes
1 answer
How to approximate pre-self-insert-hook (which doesn't exist)?
Q: how does one approximate the functionality of the non-existent pre-self-insert-hook?
This question is inspired by the curiosity that is the combination of abbrev-mode and self-insert-command. The docstring for the latter:
Insert the character…

Dan
- 32,584
- 6
- 98
- 168
2
votes
1 answer
Translations of self-inserting keys
What exactly determines what is inserted by
self-insert-command? If I change the input-method to greek,
p will insert π, but will still be bound to
self-insert-command, though it patently does not insert itself. C-h k p will say that p is…

Toothrot
- 3,204
- 1
- 12
- 30
1
vote
1 answer
Trouble aliasing ctl-x-map, C-x 8 insert command?
I'm reading the beginning of the Emacs manual on inserting text. It says you can run C-x 8 [ to insert a left single curly quote. That works.
In my init.el I have this:
(define-key global-map [(control t)] ctl-x-map)
I like that because I use a…

Rob N
- 547
- 2
- 12
1
vote
1 answer
Cover the active region with a character
Called with an active region, it will replace all spaces in that region with the character corresponding to the subsequent key press. E.g., if cover-active-region is bound to C-c /, then C-c / h will replace all spaces (not newlines or anything) in…

Dodgie
- 462
- 2
- 14
1
vote
1 answer
eshell backtrace when trying to use character command
I have written a custom interactive command that takes a character as an argument. When I happen to use the key binding for that command while in a eshell buffer where a long-running command is currently running, I get this backtrace:
Debugger…

Joseph Garvin
- 2,061
- 8
- 21
0
votes
1 answer
How to Self Insert Tab When Editing String In go-mode?
The title contains the crux of my question. In go-mode, tabs and auto-indentation generally works well, except when I am editing strings.
When inside of a string, I'd like the tab key to self-insert. Right now, it does nothing.

dave mankoff
- 103
- 2
0
votes
1 answer
Typing common keys (e.g. space, colon) gives "Symbol's function definition is void: nil"
I've recently been trying to convert my startup files to using use-package, so I've been editing my .emacs file a lot. I seem to have myself in a state where some common self-insert-command operations are failing. For instance, I'm editing a…

Ken Williams
- 390
- 2
- 12