From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: changing a variable with a keystroke Date: Thu, 15 Jan 2009 19:51:13 +0100 Message-ID: <87eiz4768u.fsf@thinkpad.tsdh.de> References: <50abee650901150048s341c0fb7p8eb8aacae40c3de6@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1232045526 17029 80.91.229.12 (15 Jan 2009 18:52:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Jan 2009 18:52:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 15 19:53:19 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 1LNXL9-0007MO-NV for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Jan 2009 19:53:15 +0100 Original-Received: from localhost ([127.0.0.1]:56294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNXJt-00027a-4c for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Jan 2009 13:51:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNXJU-00023D-51 for help-gnu-emacs@gnu.org; Thu, 15 Jan 2009 13:51:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNXJT-00021P-DO for help-gnu-emacs@gnu.org; Thu, 15 Jan 2009 13:51:31 -0500 Original-Received: from [199.232.76.173] (port=43111 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNXJT-00020w-2x for help-gnu-emacs@gnu.org; Thu, 15 Jan 2009 13:51:31 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:50139 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LNXJS-0004E1-Eo for help-gnu-emacs@gnu.org; Thu, 15 Jan 2009 13:51:30 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LNXJN-0004Jn-QL for help-gnu-emacs@gnu.org; Thu, 15 Jan 2009 18:51:25 +0000 Original-Received: from p54af2595.dip0.t-ipconnect.de ([84.175.37.149]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 15 Jan 2009 18:51:25 +0000 Original-Received: from tassilo by p54af2595.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 15 Jan 2009 18:51:25 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p54af2595.dip0.t-ipconnect.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:RTEkhiQY0/cQIIBXv9rUOctHuyk= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:61373 Archived-At: Joff 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.