From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: changing a variable with a keystroke
Date: Thu, 15 Jan 2009 19:51:13 +0100 [thread overview]
Message-ID: <87eiz4768u.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: 50abee650901150048s341c0fb7p8eb8aacae40c3de6@mail.gmail.com
Joff <jack.joff@gmail.com> writes:
Hi!
>> To fix, you can define your function, then put the function name as
>> the second arg to setkey. But since elisp has a function construct
>> (aka lambda), so you don't need to define it separately.
>> Here's the code:
>> (global-set-key (kbd "C-l C-r")
>> (lambda () (setq dired-listing-switches "-lR"))
>> ) ;; code not tested
>
> This doesn't seem to work: it gives me:
> Wrong type argument: commandp, (lambda nil (setq dired-listing-switches
> "-lR"))
Only commands (functions with `interactive' spec) can be bound to keys,
so simply putting (interactive) afted "lambda ()" should do the trick.
>> Note that what you are doing is strange. Depending what you want to
>> achieve, there are probably better ways.
>>
> What I want to be able to acheive is being able to switch to and from
> dired recursive list 'mode' with a single key combination (rather than
> going through M-x set-variable... etc or C-u s switch. Is there a
> better way to do this?
Dired can do that automatically. See
(info "(emacs)Subdirectories in Dired") <== C-x C-e here!
in the emacs manual.
Bye,
Tassilo
--
It is better to give than to receive. This is especially true of a Chuck
Norris roundhouse kick.
next prev parent reply other threads:[~2009-01-15 18:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.4829.1231934186.26697.help-gnu-emacs@gnu.org>
2009-01-14 22:05 ` changing a variable with a keystroke Xah Lee
2009-01-15 8:48 ` Joff
2009-01-15 18:51 ` Tassilo Horn [this message]
[not found] ` <mailman.4960.1232045493.26697.help-gnu-emacs@gnu.org>
2009-01-16 11:19 ` Muurimäki Perttu
2009-01-14 11:32 Joff
2009-01-14 12:14 ` Juanma Barranquero
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eiz4768u.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.