I want to create a mode which in certain states converts all input to uppercase, regardless of the caps-lock status. But I'm at a loss as to how to go for this, and I'm not sure it could even be done. Any help would be appreciated.
You could do worse than look at GNU ELPA's
I was able to do it by adding a buffer local
post-command-hook and upcasing the previous word when the
self-insert-command is executed and I am in the right state.
(add-hook 'post-command-hook 'mymode-post-command-hook nil t) (defun mymode-post-command-hook () (when (and (eq this-command 'self-insert-command) (eq mymode-state 0)) (upcase-word -1)))
I have tested this a bit and seems to work fine. It could probably be slimmer with the
post-self-insert-hook. Thank you for all the suggestions.