all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
To: Joff <jack.joff@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: changing a variable with a keystroke
Date: Wed, 14 Jan 2009 13:14:20 +0100	[thread overview]
Message-ID: <f7ccd24b0901140414s2347dcd0rd076a7d6955b0eb2@mail.gmail.com> (raw)
In-Reply-To: <50abee650901140332u1cd4727atd7324d1fedf5a9ac@mail.gmail.com>

On Wed, Jan 14, 2009 at 12:32, Joff <jack.joff@gmail.com> wrote:

> (defun set_recursive_dired () "Set dired mode to recursive view"
>   (interactive "p")
>   (setq dired-listing-switches "-lR"))
>
> (global-set-key (kbd "C-l") nil)
> (global-set-key (kbd "C-l C-r") 'set_recursive_dired)
>
> because I thought setq might not be a command (?)

`setq' is an elisp function (more properly, a "special form"; see the
Emacs Lisp Intro), but it is not an interactive command.  Functions
bound to keys must be interactive commands.

> which got me:
>
> call-interactively: Wrong number of arguments: (lambda nil "Set dired mode
> to recursive view" (interactive "p") (setq dired-listing-switches "-lR")), 1

You are using (interactive "p"), which says that the function has an
argument, but it has none. If you use just (interactive) it will work.
See the documentation for function `interactive'.

However, it's a bit weird that you need a keybinding just to set
switches for dired. Doesn't it work if you just add

  (setq dired-listing-switches "-lR")

to your .emacs file? Unless you don't always want these switches, of course.

    Juanma




  reply	other threads:[~2009-01-14 12:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 11:32 changing a variable with a keystroke Joff
2009-01-14 12:14 ` Juanma Barranquero [this message]
     [not found] <mailman.4829.1231934186.26697.help-gnu-emacs@gnu.org>
2009-01-14 22:05 ` Xah Lee
2009-01-15  8:48   ` Joff
2009-01-15 18:51     ` Tassilo Horn
     [not found]     ` <mailman.4960.1232045493.26697.help-gnu-emacs@gnu.org>
2009-01-16 11:19       ` Muurimäki Perttu

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=f7ccd24b0901140414s2347dcd0rd076a7d6955b0eb2@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=jack.joff@gmail.com \
    /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.