all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* changing a variable with a keystroke
@ 2009-01-14 11:32 Joff
  2009-01-14 12:14 ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: Joff @ 2009-01-14 11:32 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1677 bytes --]

Dear all,

 I'm having trouble trying to create a key combination to set a global
variable. I have tried putting the following in my .emacs file:

(global-set-key (kbd "C-l") nil)
(global-set-key (kbd "C-l C-r") '(setq dired-listing-switches "-lR")

and various permutions of the '(setq .. "-lR") part (with a single quote in
front of the -lR, without the intial single quote etc. This got me various
errors:

(global-set-key (kbd "C-l C-r") (setq dired-listing-switches -lR))   -->
Symbol's value as variable is void: -lR

(global-set-key (kbd "C-l C-r") '(setq dired-listing-switches -lR))  -->
Wrong type argument: commandp, (setq dired-listing-switches -lR) on pressing
C-l C-r

(global-set-key (kbd "C-l C-r") (setq dired-listing-switches "-lR"))  -->
Printed -lR into my buffer when I pressed C-l C-r

and so on...

so then I tried

(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 (?) 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

as you can probably tell, I'm pretty new to lisp/elisp... I have tried
'reading the error messages' and have done a lot of googling, which has got
me this far (and which suggested the above '(defun...set_recursive_dired) )

so could anyone kindly shed some light on why the above don't work, and
perhaps suggest what I should be trying? Is it a syntax thing or am I
missing the point completely?

best,
Joff

[-- Attachment #2: Type: text/html, Size: 2313 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-16 11:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
     [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

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.