From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: C-x RET r utf-8 RET Date: Mon, 08 Dec 2014 15:35:00 +0800 Message-ID: <87iohm1tnf.fsf@ericabrahamsen.net> References: <87d27uzn8g.fsf@skimble.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxslJ-0000Jy-1z for emacs-orgmode@gnu.org; Mon, 08 Dec 2014 02:29:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxslC-0000Mo-J7 for emacs-orgmode@gnu.org; Mon, 08 Dec 2014 02:29:40 -0500 Received: from plane.gmane.org ([80.91.229.3]:51993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxslC-0000Mg-Cb for emacs-orgmode@gnu.org; Mon, 08 Dec 2014 02:29:34 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XxslB-0002nG-Qo for emacs-orgmode@gnu.org; Mon, 08 Dec 2014 08:29:33 +0100 Received: from 61.149.185.27 ([61.149.185.27]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 08 Dec 2014 08:29:33 +0100 Received: from eric by 61.149.185.27 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 08 Dec 2014 08:29:33 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Sharon Kimble 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