From: harven <harven@free.fr>
To: help-gnu-emacs@gnu.org
Subject: Re: custom keyboard layout? howto redefine keys?
Date: Fri, 10 Apr 2009 18:39:21 +0200 [thread overview]
Message-ID: <m2fxgga2fa.fsf@free.fr> (raw)
In-Reply-To: a7c8eeb5-ddea-40d4-a3a7-849e5cabb2a9@l1g2000yqk.googlegroups.com
nic.d.m.1@googlemail.com writes:
> Thank you very much! I "mixed" your solutions and it worked:
>
> (global-set-key "b" (lambda () (interactive) (ucs-insert "61")))
> (global-set-key "a" (lambda () (interactive) (ucs-insert "62")))
>
> Any idea *why* this works? I don't understand it. What is the meaning
> of "interactive" here?
you could have used instead:
(defun my-command ()
(interactive)
(ucs-insert "61"))
(global-set-key "b" 'my-command)
Interactive means that the function my-command is actually a command,
that is something called interactively using M-x my-command.
Now you will probably never use that command directly, so there is no
need to give it a name.
Hence the lambda which defines an anonymous function, that is a function
without a name, and the interactive which convert it to a command.
It's a bit paradoxical, but global-set-key wants a command, not
a function, as its argument.
> By the way: Is there a possibility to reload the .emacs file without
> restarting emacs?
>
> I tried: M-x load-file .emacs but it doesn't work.
with current buffer being .emacs, do
M-x eval-buffer
prev parent reply other threads:[~2009-04-10 16:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-09 23:40 custom keyboard layout? howto redefine keys? nic.d.m.1
2009-04-10 9:25 ` B. T. Raven
2009-04-10 10:18 ` nic.d.m.1
2009-04-10 15:56 ` rustom
2009-04-10 16:22 ` B. T. Raven
2009-04-10 16:39 ` harven [this message]
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2fxgga2fa.fsf@free.fr \
--to=harven@free.fr \
--cc=help-gnu-emacs@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.
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).