From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joff Newsgroups: gmane.emacs.help Subject: changing a variable with a keystroke Date: Wed, 14 Jan 2009 11:32:30 +0000 Message-ID: <50abee650901140332u1cd4727atd7324d1fedf5a9ac@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_281566_4450655.1231932750575" X-Trace: ger.gmane.org 1231934223 28206 80.91.229.12 (14 Jan 2009 11:57:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Jan 2009 11:57:03 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 14 12:58:15 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LN4Nw-0007L6-6T for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Jan 2009 12:58:13 +0100 Original-Received: from localhost ([127.0.0.1]:40658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LN4Mf-0007Gr-TJ for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Jan 2009 06:56:53 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LN3z8-0002Ni-SP for help-gnu-emacs@gnu.org; Wed, 14 Jan 2009 06:32:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LN3z7-0002Mf-KA for help-gnu-emacs@gnu.org; Wed, 14 Jan 2009 06:32:34 -0500 Original-Received: from [199.232.76.173] (port=40205 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LN3z7-0002MS-6x for help-gnu-emacs@gnu.org; Wed, 14 Jan 2009 06:32:33 -0500 Original-Received: from rv-out-0708.google.com ([209.85.198.245]:46499) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LN3z6-0000ZD-Le for help-gnu-emacs@gnu.org; Wed, 14 Jan 2009 06:32:33 -0500 Original-Received: by rv-out-0708.google.com with SMTP id k29so591985rvb.6 for ; Wed, 14 Jan 2009 03:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=tX+xg2/CUluA7OufaqHkEikd4RB+8yDaGiqVEhr4VtY=; b=kYL6Pkft5MLEejCbLkcnPK5wcHq0UElfb2TBfxXZ8lSn0zvY/HSkOcPlHp/UtVg1YR h4lNXR3u+UXGInEk/xedCHyV3hWdbhp6W8jL2KMt/jlg8xzNpwTHyrQQWxr3eCdNcWUF YFwNfS/VBZPMuXIOvJBV7tvzZLwWNQhbD+h7k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=dg4DW2Qxrdt4s/pRyazRpAsN+MWeNC4nWQgDdLDY7GIupSvFQHYWHdYvrAC0GBo7QO CS3thS7Ft5qlyLc3I90u+w4qHgq99iE/yC9p6cisevunWFMfwWOOCu6Dj0ERWrUisUkP 7xlBoGxDm7oxU196fRayU6m0NzuwB2YgaiasI= Original-Received: by 10.141.69.1 with SMTP id w1mr1996660rvk.119.1231932750611; Wed, 14 Jan 2009 03:32:30 -0800 (PST) Original-Received: by 10.141.35.4 with HTTP; Wed, 14 Jan 2009 03:32:30 -0800 (PST) X-detected-operating-system: by monty-python.gnu.org: Error: [-] ERROR: /var/run/p0f.sock: Connection refused X-Mailman-Approved-At: Wed, 14 Jan 2009 06:56:25 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61324 Archived-At: ------=_Part_281566_4450655.1231932750575 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_281566_4450655.1231932750575 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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
------=_Part_281566_4450655.1231932750575--