From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master a7c65fc666: Allow nil value for filter-buffer-substring-function Date: Tue, 20 Sep 2022 09:23:53 -0400 Message-ID: References: <166359943394.15847.12726646376922950024@vcs2.savannah.gnu.org> <20220919145714.5036DC00872@vcs2.savannah.gnu.org> <87pmfre6y0.fsf@gmail.com> <87h712eado.fsf@gmail.com> 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="36357"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org, Stefan Kangas To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 20 18:56:08 2022 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 1oagXY-0009IY-Dj for ged-emacs-devel@m.gmane-mx.org; Tue, 20 Sep 2022 18:56:08 +0200 Original-Received: from localhost ([::1]:54162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oagXW-0004hU-T7 for ged-emacs-devel@m.gmane-mx.org; Tue, 20 Sep 2022 12:56:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oadEH-00083C-9z for emacs-devel@gnu.org; Tue, 20 Sep 2022 09:24:01 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37471) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oadEE-0002kn-Ad for emacs-devel@gnu.org; Tue, 20 Sep 2022 09:23:59 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 334274416A6; Tue, 20 Sep 2022 09:23:56 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D6FBC441698; Tue, 20 Sep 2022 09:23:54 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1663680234; bh=d42X9ntPyqAyaFqswUr8eZt1YO7danJirbK3URS9F2w=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=G03SbG0Slq0L36i3lm5XnFLOMU6kZ7EJY47CKe5IlmrRdN/P4YRsmz6c5PV72uRGT hDzl+4VmVmgeC2+3SYaU5FJhF70n12zmjpw2ZIjVQ+H/+3Qkrw58l5YtWFTgd9euhM pGjiyq+th15h/pF9rxXHL7mH1jaTeil8PZUIhILVnEoFAYeEtC3rRy6N5BmJ23rIDc 4Q2H15t09qCUxaIXGQqvDYfaC3iH3wkaNkhz1eZ08UyVgY/5pY2FVjZxv3g1B0ZNPi pfx/ersvAc9/SXOVzAwghrPtqdmmhP9tEIO7L/mfH8uaHFH/k/HWNpw//zullyEbzK c9+d8RcPYRyRA== Original-Received: from pastel (unknown [157.52.9.190]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 779CF12055D; Tue, 20 Sep 2022 09:23:54 -0400 (EDT) In-Reply-To: <87h712eado.fsf@gmail.com> (Robert Pluim's message of "Tue, 20 Sep 2022 10:08:19 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:295820 Archived-At: Robert Pluim [2022-09-20 10:08:19] wrote: >>>>>> On Mon, 19 Sep 2022 16:37:04 -0400, Stefan Monnier said: > > >> Ick. If `buffer-substring--filter' is the default function to call= , it > >> should not have the '--' internal function marker. > > Stefan> Why? You're *not* supposed to call `buffer-substring--filter= '. > Stefan> Instead you're supposed to call the value contained in > Stefan> `filter-buffer-substring-function`, whichever it is. (and if= you're > Stefan> modifying this variable, then you're supposed to modify it wi= th > Stefan> `add-function` and your function will then receive the "previ= ous" > Stefan> function to call). > > It=CA=BCs not obvious to me that you=CA=BCre supposed to use `add-functio= n'. And > even if it were, having '--' appear in the public api just feels > wrong. Oh well. It's not the public API. The public API is to call the value that's stored in the variable, whatever that value is. Look at it this way. The choice is between: (defvar foo-function (lambda () ...blabla...)) vs (defvar foo-function #'foo--default) (defun foo--default () ...blabla...) In both cases the actual function is "internal". The second version just gives a name to the function because it's more convenient, hiding a bit more of the internals, and making it possible to use `C-h o` to jump to the definition of the function. The "--" version makes it *possible* to call that function directly, but it still *shouldn't* be called directly: it's still very much internal. Stefan