From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Omar Polo Newsgroups: gmane.emacs.help Subject: Re: define-key with command arguments Date: Wed, 10 Feb 2021 17:49:28 +0100 Message-ID: <87sg63eulj.fsf@omarpolo.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36905"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.14; emacs 28.0.50 Cc: help-gnu-emacs@gnu.org To: Adam Kandur Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 10 18:03:48 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9su4-0009To-Cw for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 10 Feb 2021 18:03:48 +0100 Original-Received: from localhost ([::1]:60456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9su3-0004wb-Bq for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 10 Feb 2021 12:03:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9sgU-0008KA-82 for help-gnu-emacs@gnu.org; Wed, 10 Feb 2021 11:49:46 -0500 Original-Received: from mail.omarpolo.com ([144.91.116.244]:55570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9sgR-0002FC-P1 for help-gnu-emacs@gnu.org; Wed, 10 Feb 2021 11:49:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omarpolo.com; s=20200327; t=1612975772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/lylt1EBN6C5NyoBq9hBlzDQKmd3p8z7eEoEsCstOKM=; b=k8PeFKYTOF+MU/QXdCdBQuFcnlqRJvugyI/MZPeTwp30/Uv0ynCvZiD2YC8XO4v2trhuHg tzPcpjFC7q9yZ9OphHFEv4Ah+jSiWIPW3UFBuFomnDLJZ7KkeFsdXPH1+SSKWkhSCSQ6BQ NSnxtLO1T/vcEDEnlLKM8hxvMuOfYA8= Original-Received: from localhost (host-80-116-112-105.pool80116.interbusiness.it [80.116.112.105]) by mail.omarpolo.com (OpenSMTPD) with ESMTPSA id 51000c33 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 10 Feb 2021 17:49:32 +0100 (CET) Original-Received: from venera (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 7afdcb63; Wed, 10 Feb 2021 17:49:28 +0100 (CET) In-reply-to: Received-SPF: pass client-ip=144.91.116.244; envelope-from=op@omarpolo.com; helo=mail.omarpolo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127775 Archived-At: Adam Kandur via Users list for the GNU Emacs text editor writes: > hi everyone! is it possible to do something like his > > (define-derived-mode test special-mode "test" > (define-key test-func (kbd "SPC") 'test-func-with (arg))) > so, i wanna pass variable in function i'm going to run with keyboard binding. is it possible? You can use closure, like (define-key a-keymap (kbd "SPC") (lambda () (interactive) (test-func-with arg)))