From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: [External] : Re: master a7c65fc666: Allow nil value for filter-buffer-substring-function Date: Thu, 22 Sep 2022 11:59:11 +0200 Message-ID: <87v8pfohlc.fsf@web.de> References: <166359943394.15847.12726646376922950024@vcs2.savannah.gnu.org> <20220919145714.5036DC00872@vcs2.savannah.gnu.org> <87pmfpb4ed.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5681"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:j8km7vLFapLNcywslJOBy74i4wY= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 22 12:08:30 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 1obJ89-0001O9-U1 for ged-emacs-devel@m.gmane-mx.org; Thu, 22 Sep 2022 12:08:29 +0200 Original-Received: from localhost ([::1]:60244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obJ88-0007VJ-KT for ged-emacs-devel@m.gmane-mx.org; Thu, 22 Sep 2022 06:08:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obIzO-0002w9-If for emacs-devel@gnu.org; Thu, 22 Sep 2022 05:59:29 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:34212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obIzK-0008DH-Uv for emacs-devel@gnu.org; Thu, 22 Sep 2022 05:59:24 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1obIzG-0009tj-U9 for emacs-devel@gnu.org; Thu, 22 Sep 2022 11:59:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:295965 Archived-At: Drew Adams writes: > I don't think that point was given. My point was > that an argument that nil should be disallowed for > variables whose names end in `-function' is wrong > (misguided). It may be reasonable for variable > `filter-buffer-substring-function', and for some > other so-named variables. But as a general rule > it's misguided, IMO. Is that written somewhere, or did only say someone that we have that rule, or people should, if possible, follow that rule? In (info "(elisp) Coding Conventions") I read • If the purpose of a variable is to store a single function, give it a name that ends in ‘-function’. If the purpose of a variable is to store a list of functions (i.e., the variable is a hook), please follow the naming conventions for hooks. *Note Hooks::. It doesn't tell anything about the other direction (name -> restriction to certain values). In the Emacs Elisp sources I find over hundred `defvar's of symbols named "*-function" that default to nil. Doesn't seem to be a very strict thing. Maybe a good rule would be "[now that we have nadvice] please think about whether someone or somecode might want to advice that binding before allowing arbitrary values for *-function named variables". Maybe it would a good idea to spell that hint out in the manual if it isn't yet (didn't check). > > I don't think testing the value directly for equivalence > > to some given value is not an important use case: > > You don't think it's _not_ an important use case? > Or was that a typo? I'm guessing the latter, > based on the rest of what you say. Yes, thanks for the correction. > In any case, it may not be important to you, and > it may not be general enough for you or for > everything. But it can be an important use case > for some code - for some `-function' vars, IMO. > > I see no reason that a convention for naming vars > `-function' should be limited to variables whose > value can _only_ be a function. I agree it should not be a strict must. More a guideline to follow when no reasons speak against it. There are cases where other value types and a *-function name fit. > (_Does_ the doc call it out for this var?) Yes. Implicitly, but clearly. > Speaking of which - I think it's a mistake BTW for > function `advice--p' to be "internal". It's fine > that its implementation might change. But it's a > fine function for user code to use. There's no real > alternative, other than directly using the code that > implements it. (Likewise for `advice--car' etc.) Dunno if `advice--p' has non-internal use cases. We have some related "public" functions in nadvice that might suffice: `advice-mapc' and `advice-member-p'. Michael.