From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master b75fb81 1/4: Extend button.el to take callback data Date: Thu, 01 Aug 2019 14:22:26 +0200 Message-ID: <87pnlpm5x9.fsf@mouse.gnus.org> References: <20190730132507.32385.70681@vcs0.savannah.gnu.org> <20190730132509.77D2820C0A@vcs0.savannah.gnu.org> <87lfwd2ihn.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="47951"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 01 14:22:58 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1htA6k-000CJu-FR for ged-emacs-devel@m.gmane.org; Thu, 01 Aug 2019 14:22:58 +0200 Original-Received: from localhost ([::1]:55444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htA6j-0000VI-9q for ged-emacs-devel@m.gmane.org; Thu, 01 Aug 2019 08:22:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44834) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htA6K-0000VB-U8 for emacs-devel@gnu.org; Thu, 01 Aug 2019 08:22:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htA6J-00028D-Pg for emacs-devel@gnu.org; Thu, 01 Aug 2019 08:22:32 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:33278) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1htA6J-00023l-JH for emacs-devel@gnu.org; Thu, 01 Aug 2019 08:22:31 -0400 Original-Received: from 77.18.62.220.tmi.telenormobil.no ([77.18.62.220] helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1htA6E-0006gR-WA; Thu, 01 Aug 2019 14:22:29 +0200 In-Reply-To: <87lfwd2ihn.fsf@tcd.ie> (Basil L. Contovounesios's message of "Thu, 01 Aug 2019 15:11:16 +0300") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.231.51 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239095 Archived-At: "Basil L. Contovounesios" writes: > Can you please explain the rationale behind this? I'm not sure it's a > good idea: > > 1. Arbitrary data can already be associated with buttons and retrieved > in their action functions using button-get, button-put, and on button > creation with make{,-text}-button et al. > > 2. AIUI this is a potentially backward-incompatible change, as existing > action functions, which expect to receive a button, may now receive > the value of the button-data property instead. > > So at first glance I'm not convinced the minor convenience of not having > to manually (button-get button 'button-data) or similar in the action > function is worth messing with the pre-existent and cleaner API. Am I > missing something? Button callback functions currently often recreate the data they need by looking at the extent of the buttons. This is an awkward interface, because when creating the buttons, the functions have already determined what the data should be. So it'd a way to de-duplicate code. If you look at the functions in Gnus that use this now, you can see how the callback functions can be completely oblivious to having be called through a button.el callback, which is how it should be. As for the name collision issue -- that's why I didn't call it just `data' or the like. button.el already uses property names like `action', which is unfortunate, as that really is prone to naming collisions, but I grepped through the tree, and there are no in-tree usages of the `button-data' property. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no