From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: binding a key to a function with an argument Date: Thu, 23 Jul 2009 08:42:59 +0300 Organization: A noiseless patient Spider Message-ID: <878wiguf8c.fsf@iki.fi> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248331254 24951 80.91.229.12 (23 Jul 2009 06:40:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jul 2009 06:40:54 +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 Jul 23 08:40:47 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 1MTryu-00045K-5n for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Jul 2009 08:40:44 +0200 Original-Received: from localhost ([127.0.0.1]:48663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTryt-0001d4-KA for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Jul 2009 02:40:43 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!feeder.eternal-september.org!eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 16 Original-X-Trace: news.eternal-september.org U2FsdGVkX18X3mGM33l9fSIecw0AWVlaGkKv+hDyECzzGM0VLvh1LqldKEwgdST+MYC9i25azkcziU2+rP7YmN95+5+4BMqHY7trezr24sJjVtmZ9MqRHnAqTYUTfL6TSnyMo7SgXho= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Thu, 23 Jul 2009 05:42:59 +0000 (UTC) X-Auth-Sender: U2FsdGVkX186nmfJAi707TJFRFc66BN4k8vYgVdMHvbodSBVgt9bpQ== Cancel-Lock: sha1:HUPo7AZM4H4OMopmeYGLQKTo408= sha1:Xx0TFsz66AX0MBd1NqzPvZvrn08= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:171157 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:66349 Archived-At: On 2009-07-22 09:13 (-0700), John Withers wrote: > (global-set-key (kbd "C-x C-s") 'save--some-buffers) > > but I can't figure out how to pass the non-nil argument. I have tried a > few different ways and they all throw errors. The second parameter for global-set-key must be a symbol of interactive function and you can only pass interactive prefix arguments to that function. But you can create a new function which calls save-some-buffers with the arguments you like. I use anonymous function (lambda) here: (global-set-key (kbd "C-x C-s") (lambda () (interactive) (save-some-buffers t)))