emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: Re: C-x RET r utf-8 RET
Date: Mon, 08 Dec 2014 15:35:00 +0800	[thread overview]
Message-ID: <87iohm1tnf.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 87d27uzn8g.fsf@skimble.plus.com

Sharon Kimble <boudiccas@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

  reply	other threads:[~2014-12-08  7:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-08  6:09 C-x RET r utf-8 RET Sharon Kimble
2014-12-08  7:35 ` Eric Abrahamsen [this message]
2014-12-08  9:00   ` Marcin Borkowski
2014-12-08  9:39     ` Eric Abrahamsen
2014-12-08 12:09       ` Marcin Borkowski
2014-12-08 13:34   ` Sharon Kimble

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iohm1tnf.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).