From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: global-set-key with function taking arguments Date: Sun, 1 Nov 2020 14:19:22 +0100 Message-ID: References: <87r1pdxqey.fsf@zoho.eu> <87lfflxo76.fsf@zoho.eu> <87h7q9xmim.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14011"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: moasenwood@zoho.eu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 01 14:23:50 2020 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 1kZDKo-0003YE-Kc for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 01 Nov 2020 14:23:50 +0100 Original-Received: from localhost ([::1]:57420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZDKm-0004Om-R0 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 01 Nov 2020 08:23:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZDGg-0004M2-7I for help-gnu-emacs@gnu.org; Sun, 01 Nov 2020 08:19:34 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:35175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZDGa-0005jR-5O for help-gnu-emacs@gnu.org; Sun, 01 Nov 2020 08:19:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1604236762; bh=rMI0DnmzaJ8LgVx2KSBdTgYfzsf2gPZX7dPbL3f+rno=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=QJPidxN4cONEwizFJFENjY7fPsMqFqkE8jD9mgpviZ3eVaBzTIgpZDYrYBdULlYRO yUGFZOsw/VNpSfphhh3DZtQ6lJ66nBwPUdeaHXTrkHn2OkWlkEIGOlrTzDU688P0KY e7/9mIRF4LISBLf03J6YsHm3JeIGNdU5dUnokLuA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs11.server.lan [172.19.170.179]) (via HTTP); Sun, 1 Nov 2020 14:19:22 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <87h7q9xmim.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:Fx8YSRJ9QHFvr6989erQyRJlC2rcQvN17NPedBbHKcRoF9tyjH1ttfCNJFtZjsGSgmpRm UkEXl8zeYNwMEXyEWgubYmGVAPQWqesCA2xXhK+nH8mlirClI9xur1HtJCjI7JHA8moVFbaaCXON VFOzT3Xargoz6h+Yw5x9UgbQcCqbAL5fgmCcXFV18RujrlZa/7iBBLv9Qj0+595x00JJ3OlkCai9 1dxY+LlMgEkYZ+/S2cuyzapWFOkkm5QcjeuZovwfmf5TZT9nAWWPcIbBUhOOFevc+SI1KjYLuHGO nk= X-UI-Out-Filterresults: notjunk:1;V03:K0:4HQebMY8dl0=:Bmro9QL+fm6IQeCdwZ3SqT MT6ucfdMyF7rev+525dmHhYz1UvtA4J2hRwUo5D2mTI5fEv9Xg+wDnSAmigirzmev4bYU/ng+ qw8SLx/4XAXBKt8toYcgJeqKcPAwfsvxo6ZfngVwBa26OYVoAdW3b6ISezqxbbtofE+hKlezU RFzuw3YvBBZ+P01Ij6roh8peVdM34i1CC6R/lYJPO959QscBKWOpSU7/qVT88N+OW72Nicyi2 1vkIGaGotRSg/te/7NBN99wqDcTWE3oVxueb322xOKLk4mlxfmpaC9Jz1ldYaDo9+FKIGrN9F 8cunxrZGoNB9H18ee6JFaLMveFXuH1aGKmSbKND8sJN55JFCgrCSZtpgrJDSPke90OiIg3BST eIDqcHjOp5PohuCtQK8FiLEWWdR2WhdJVVe6crfen+aLkqRE2QdT4iVmFcL+ypDsAyl1aYilR Tuon4kfjd5Zq2FQqQ00akETy0nIeRmdgQbNLRL8u0NLZL8WJPQS/MhuKtn4Wj86fYv9wibzRl Yk8z9gy7M7IDZjW8GAZgEMyHhDW5TKb+Ov4iqLHKNvkcxcdaMFV1vZXAtxDWNMTyWA162+Po9 vgy2j88JswAf0= Received-SPF: pass client-ip=212.227.17.21; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/01 07:28:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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:124858 Archived-At: > IMO proper functions (defuns) should be used with keys, not lambdas. > Except for perhaps very simple or temporary solutions. Agreed. For simple keybindings using a few lines of Emacs In-Built Comman= ds, using Anonymous Function is sensible, rather than having to make a 'defun'= . Anonymous Functions are especially when you see no reason why one would normally call it. Because you may also document the Anonymous Function, the 'lamdba' construct, Anonymous Functions become a pragmatic way of work= ing. Documentation for an Anonymous Function should have the same purpose as fo= r a 'defun'. Conssequently, Documentation for an Anonymous Function should no= t lack much from documentation of a 'defun'. > Sent: Sunday, November 01, 2020 at 1:57 PM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > To: help-gnu-emacs@gnu.org > Subject: Re: global-set-key with function taking arguments > > Christopher Dimech wrote: > > >> ... you mean `describe-function'? > > > > No. I mean describe-key. If you try describe-key for a key binding > > you are not going to get useful documentation with an > > anonymous function. > > Ah, that's what you mean. No, you are right, and I agree! > > > But I might be mistaken. May one include documentation string for > > lambda ()? > > You can! But it doesn't work the same way. C-h f lambda RET > > (lambda ARGS [DOCSTRING] [INTERACTIVE] BODY) > > DOCSTRING is an optional documentation string. > If present, it should describe how to call the function. > But documentation strings are usually not useful in nameless functions= . > > IMO proper functions (defuns) should be used with keys, not lambdas. > Except for perhaps very simple or temporary solutions. > > Because functions are up in the sky - heaven, almost. And keys are by > all means a way, one way, a good way, but not the _only_ way, to > reach them. Functions shouldn't be imprisoned down there, at the same > level as mere keys... > > -- > underground experts united > http://user.it.uu.se/~embe8573 > https://dataswamp.org/~incal > > >