From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?R8O2a3R1xJ8=?= Kayaalp Newsgroups: gmane.emacs.devel Subject: Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs] Date: Thu, 14 May 2020 19:30:37 +0300 Message-ID: <87k11exyvm.fsf@gkayaalp.com> References: <0c88192c-3c33-46ed-95cb-b4c6928016e3@default> <87wo5mc04t.fsf@fastmail.fm> <873686bbl5.fsf@russet.org.uk> <87d07963ec.fsf@fastmail.fm> <873685dq73.fsf@russet.org.uk> <87wo5gc0kb.fsf@russet.org.uk> <87lflv5yzx.fsf@bernoul.li> <433E8CA0-CC87-4877-B9D4-D348531B73F8@medranocalvo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="62518"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 0.9.18; emacs 28.0.50 Cc: Jonas Bernoulli , Joost Kremers , emacs-devel@gnu.org, Oleh Krehel , =?utf-8?B?R8O2a3R1xJ8=?= Kayaalp , Phillip Lord , Stefan Monnier To: =?utf-8?Q?Adri=C3=A1n_Medra=C3=B1o?= Calvo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 14 18:31:44 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jZGlq-000G6Z-VW for ged-emacs-devel@m.gmane-mx.org; Thu, 14 May 2020 18:31:42 +0200 Original-Received: from localhost ([::1]:47900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZGlq-0000Rl-0u for ged-emacs-devel@m.gmane-mx.org; Thu, 14 May 2020 12:31:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZGkx-000800-KX for emacs-devel@gnu.org; Thu, 14 May 2020 12:30:48 -0400 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:59839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZGkv-0001BF-75 for emacs-devel@gnu.org; Thu, 14 May 2020 12:30:47 -0400 X-Originating-IP: 159.146.18.34 Original-Received: from localhost (unknown [159.146.18.34]) (Authenticated sender: self@gkayaalp.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 076661BF216; Thu, 14 May 2020 16:30:38 +0000 (UTC) In-reply-to: <433E8CA0-CC87-4877-B9D4-D348531B73F8@medranocalvo.com> Received-SPF: none client-ip=217.70.183.201; envelope-from=self@gkayaalp.com; helo=relay8-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/14 12:30:41 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) BAYES_00=-1.9, FROM_EXCESS_BASE64=0.979, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, URIBL_BLOCKED=0.001, URIBL_SBL=1.623, URIBL_SBL_A=0.1 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:250259 Archived-At: On 2020-05-14 10:26 +03, Adri=C3=A1n Medra=C3=B1o Calvo wrote: >> On 13. May 2020, at 23:03, Jonas Bernoulli wrote: >> >> Stefan Monnier writes: >> >>>> You said that there is a macro like this already in Emacs? >>> >>> I don't think it's in Emacs, but I remember seeing something like >>> that somewhere. >> >> You were probably thinking of Oleh Krehel's short-lambda package. >> >> https://github.com/abo-abo/short-lambda > > There=E2=80=99s also dollar.el, by G=C3=B6ktu=C4=9F Kayaalp (CC=E2=80=99d= ): > > https://github.com/cadadr/elisp/blob/devel/dollar.el Hi, I=E2=80=99m the author of this package. The parent poster has asked me earlier today if I=E2=80=99d consider dollar.el being incorporated to Emacs= . I=E2=80=99m totally on board with it and can help to make it happen if you guys do like it. This whole thread is way too big for me to read in a timely manner, but from what I get there=E2=80=99s an inclination towards the Clojure-like rea= der macro syntax for this. Personally, I=E2=80=99m not that fond of it both aesthetically and because it seems to be potentially a breaking change in the parser. A macro that spits out a closure is better IMHO. Below are some examples of usage from my init.el: ($ (with-current-buffer buf (hl-line-mode -1))) --- ;; If the explicit argument was omitted, this would throw because the ;; arglist of the generated closure would empty (no $... in body). (let ((compilation-buffer-name-function ($ [_] "*Build Emacs Master*"))) (compile "build-emacs-master.sh" t))) --- (mapcar ($ (cons (buffer-name (window-buffer $1)) $1)) (window-list)) --- ;; A named argument (add-to-list 'compilation-finish-functions ($ [_ status] (gk-send-desktop-notification "Compilation finished" status= ))) --- ;; Empty function (i.e. (lambda ()) (setf ring-bell-function ($)) The one trouble with dollar.el is that it currently doesn=E2=80=99t filter = out quoted expressions, so something like ($ =E2=80=99($1)) expands to (lambda ($1 &rest $_) (let (($* (cons (vector $1) $_))) ' ($1))) which is undesirable. I=E2=80=99ve been too lazy to fix it because it would= n=E2=80=99t really come up in practical use (WCGW...), but it shouldn=E2=80=99t be that difficult to implement. It also uses -flatten from dash.el, but adding a seq-flatten function should be trivial. > At first glance, I=E2=80=99d do away with &rest $_ and collecting the > arguments in the $* variable, for better performance. The former > could be left to the named arguments mechanism. It should be possible to get those arguments set up in the macroexpand phase in order to minimise runtime impact. We could=E2=80=99ve a simpler $ and a $$ which supports $* and $_ too. > G=C3=B6ktu=C4=9F Kayaalp, would you be willing to include dollar.el in Em= acs or > GNU ELPA? I=E2=80=99d love that to happen, and I=E2=80=99d prefer Emacs proper becaus= e IMHO this is such an elementary and small feature that you wouldn=E2=80=99t want to n= eed a third party package for it. If it=E2=80=99ll be ELPA nevertheless tho, could I use that version as the upstream (i.e. push commits to the file on ELPA)? I don=E2=80=99t use packa= ge.el so I=E2=80=99m not very up to date on how things are done on ELPA. Cheers, -gk. -- =C4=B0. G=C3=B6ktu=C4=9F Kayaalp / @cadadr / pgp: 024C 30DD 597D 142B 49AC 40EB 465C D949 B101 2427