* C-x RET r utf-8 RET
@ 2014-12-08 6:09 Sharon Kimble
2014-12-08 7:35 ` Eric Abrahamsen
0 siblings, 1 reply; 6+ messages in thread
From: Sharon Kimble @ 2014-12-08 6:09 UTC (permalink / raw)
To: org-mode
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
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
--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-x zx") 'r utf8)
#+END_SRC
--8<---------------cut here---------------end--------------->8---
but the system rejects it as the "utf8" stage.
How can I set it please?
Thanks
Sharon.
--
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.4.1.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C-x RET r utf-8 RET
2014-12-08 6:09 C-x RET r utf-8 RET Sharon Kimble
@ 2014-12-08 7:35 ` Eric Abrahamsen
2014-12-08 9:00 ` Marcin Borkowski
2014-12-08 13:34 ` Sharon Kimble
0 siblings, 2 replies; 6+ messages in thread
From: Eric Abrahamsen @ 2014-12-08 7:35 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C-x RET r utf-8 RET
2014-12-08 7:35 ` Eric Abrahamsen
@ 2014-12-08 9:00 ` Marcin Borkowski
2014-12-08 9:39 ` Eric Abrahamsen
2014-12-08 13:34 ` Sharon Kimble
1 sibling, 1 reply; 6+ messages in thread
From: Marcin Borkowski @ 2014-12-08 9:00 UTC (permalink / raw)
To: emacs-orgmode
On 2014-12-08, at 08:35, Eric Abrahamsen wrote:
> [...] You could do that in a lambda, but
> it probably won't accept a non-interactive function, [...]
Out of curiosity: can't a lambda (in e.g. global-set-key) be made
interactive? I did this right now:
(global-set-key (kbd "C-z C-s") (lambda () (interactive) (message "It can be done!")))
and it seems to work. Is it going to change e.g. in future Emacs
versions, IOW, is it deprecated or something?
> Yours,
> Eric
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C-x RET r utf-8 RET
2014-12-08 9:00 ` Marcin Borkowski
@ 2014-12-08 9:39 ` Eric Abrahamsen
2014-12-08 12:09 ` Marcin Borkowski
0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2014-12-08 9:39 UTC (permalink / raw)
To: emacs-orgmode
Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
> On 2014-12-08, at 08:35, Eric Abrahamsen wrote:
>
>> [...] You could do that in a lambda, but
>> it probably won't accept a non-interactive function, [...]
>
> Out of curiosity: can't a lambda (in e.g. global-set-key) be made
> interactive? I did this right now:
>
> (global-set-key (kbd "C-z C-s") (lambda () (interactive) (message "It can be done!")))
>
> and it seems to work. Is it going to change e.g. in future Emacs
> versions, IOW, is it deprecated or something?
No, you're quite right, I was just answering off the cuff, without
thorough thought. It is indeed possible to stick (interactive) inside of
a lambda, though intuition tells me that that it's not generally good
practice -- Emacs' introspection functions will probably at some point
bark at you for not having a named function, and it will make it harder
to use the built-in help functions to figure out what's going on. But
yes, you're right, it's definitely possible.
E
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C-x RET r utf-8 RET
2014-12-08 9:39 ` Eric Abrahamsen
@ 2014-12-08 12:09 ` Marcin Borkowski
0 siblings, 0 replies; 6+ messages in thread
From: Marcin Borkowski @ 2014-12-08 12:09 UTC (permalink / raw)
To: emacs-orgmode
On 2014-12-08, at 10:39, Eric Abrahamsen wrote:
> No, you're quite right, I was just answering off the cuff, without
> thorough thought. It is indeed possible to stick (interactive) inside of
> a lambda, though intuition tells me that that it's not generally good
> practice -- Emacs' introspection functions will probably at some point
> bark at you for not having a named function, and it will make it harder
> to use the built-in help functions to figure out what's going on. But
> yes, you're right, it's definitely possible.
You're probably right - describe-key works (of course), but in an ideal
way (somehow jumping to the source won't work;-) - but a docstring
will!).
> E
Best.
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C-x RET r utf-8 RET
2014-12-08 7:35 ` Eric Abrahamsen
2014-12-08 9:00 ` Marcin Borkowski
@ 2014-12-08 13:34 ` Sharon Kimble
1 sibling, 0 replies; 6+ messages in thread
From: Sharon Kimble @ 2014-12-08 13:34 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 443 bytes --]
Thanks for this Eric, I’ve put your function
[my-set-coding-system-to-utf8] into my "init.org" and also my mono
menu. Unfortunately I had just converted my last two problem pages
into utf8, but I'm now ready for its next bout.
Thanks again
Sharon.
--
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.4.1.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-08 13:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-08 6:09 C-x RET r utf-8 RET Sharon Kimble
2014-12-08 7:35 ` Eric Abrahamsen
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
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).