Sharon Kimble <boudic...@skimble.plus.com> writes: > I'm trying to set this > > ╭──── > │C-x RET r utf-8 RET > ╰──── > > as "C-x zx" as I'm finding that I need to use this block-quoted > command fairly regularly for some unknown reason. > > I have set it as > > #+BEGIN_SRC emacs-lisp > (global-set-key (kbd "C-x zx") 'r utf8) > #+END_SRC > > but the system rejects it as the "utf8" stage.
You've got a small confusion here between "key sequence" and "command name". Up at the top, you're typing in the key sequence "C-x RET r". That key sequence calls the command `revert-buffer-with-coding-system'. You can verify this by using "C-h c" (for describe-key-briefly) and then typing "C-x RET r". Or, the other way around, by typing "C-h w" (for where-is), then "revert-buffer-with-coding-system". When you set your global keys, the key sequence needs to point at a _command_, not at more keys. We already know what the command name is, so it will look like: (global-set-key (kbd "C-x zx") 'revert-buffer-with-coding-system) But that doesn't include the utf-8 part: using this key sequence will still prompt you for a coding system. You could do that in a lambda, but it probably won't accept a non-interactive function, so you'll likely want something a little more complicated: (defun my-set-coding-system-to-utf8 () (interactive) (revert-buffer-with-coding-system 'utf-8)) (global-set-key (kbd "C-x zx") 'my-set-coding-system-to-utf8) Give that a shot! Note that the coding system specified is the symbol 'utf-8. It needs to be quoted, and it needs to have the hyphen. I have more than once tried to set my coding systems to 'utf8, to no avail. Yours, Eric