From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeremy Bryant via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66863: [PATCH] Add two docstrings in cl-macs.el Date: Tue, 31 Oct 2023 23:40:04 +0000 Message-ID: <8734xqxstn.fsf@jeremybryant.net> References: <87bkcexvoy.fsf@jeremybryant.net> Reply-To: Jeremy Bryant Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40132"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66863@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 01 00:43:57 2023 Return-path: Envelope-to: geb-bug-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 1qxyOq-000AEP-7Y for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Nov 2023 00:43:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxyOP-0002AY-HC; Tue, 31 Oct 2023 19:43:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qxyOO-0002AQ-IF for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2023 19:43:28 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxyOO-0004ZS-9y for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2023 19:43:28 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qxyOv-0002ua-W0 for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2023 19:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jeremy Bryant Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Oct 2023 23:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66863 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.169879579211121 (code B ref -1); Tue, 31 Oct 2023 23:44:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Oct 2023 23:43:12 +0000 Original-Received: from localhost ([127.0.0.1]:49485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qxyO7-0002tJ-IA for submit@debbugs.gnu.org; Tue, 31 Oct 2023 19:43:11 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:44300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qxyO5-0002t2-8q for submit@debbugs.gnu.org; Tue, 31 Oct 2023 19:43:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qxyNQ-00027I-AD for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2023 19:42:28 -0400 Original-Received: from out-175.mta0.migadu.com ([2001:41d0:1004:224b::af]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qxyNM-0004UT-GG for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2023 19:42:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeremybryant.net; s=key1; t=1698795736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ml/ee1nUHTJTRyr4V0HfG/YWa2k3B9oT265PNhx779U=; b=TCabG8wrePptpx89q6hFcOxmSURVGjyASQDy6aaLsPDmRFB7pAcx1h776WEnwk3WIKqqMw bg2/+507uTVHuQoVTyt3JZH/0WZeqv8pEhgoB4HWWoKrPzUatu7TtLMXy593tMgUz887Aj 9/x+1Ma24dfeyDlwuGbIEuJkIFzKoPKMtQJ8SE0YYOKc6/bUloPcXAf4g1AgM3xDPnG5F+ CAPLqMKhwVw0MtzozkDk/7V6n9j11CL/rvo1HttQZY+3/AoVdFqfZoIrE9yyB2oVJc3ysL SoatvaUMF/5rBR2F0ZNVEIK4b+xgYyK83HKEikzj308HQL79xe5kW6kuMJ4knA== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::af; envelope-from=jb@jeremybryant.net; helo=out-175.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273578 Archived-At: --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-two-docstrings-in-cl-macs.el.patch >From 16298965905b1859aa8a342b98803f4abd6da3f0 Mon Sep 17 00:00:00 2001 From: Jeremy Bryant Date: Tue, 31 Oct 2023 23:37:10 +0000 Subject: [PATCH] Add two docstrings in cl-macs.el * lisp/emacs-lisp/cl-macs.el (cl--simple-exprs-p) (cl--const-expr-p): Add docstrings --- lisp/emacs-lisp/cl-macs.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 43207ce7026..15b56d0e322 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -101,6 +101,7 @@ cl--simple-expr-p (and (> size 0) (1- size)))) (defun cl--simple-exprs-p (xs) + "Map `cl--simple-expr-p' to each element of list XS." (while (and xs (cl--simple-expr-p (car xs))) (setq xs (cdr xs))) (not xs)) @@ -116,8 +117,10 @@ cl--safe-expr-p (while (and (setq x (cdr x)) (cl--safe-expr-p (car x)))) (null x))))) -;;; Check if constant (i.e., no side effects or dependencies). (defun cl--const-expr-p (x) + "Check if X is constant (i.e., no side effects or dependencies). + +See `macroexp-const-p' for similar functionality without cl-lib dependency." (cond ((consp x) (or (eq (car x) 'quote) (and (memq (car x) '(function cl-function)) -- 2.40.1 --=-=-= Content-Type: text/plain Hi Stefan, Revised patch attached and comments below Kind regards Jeremy Bryant Stefan Monnier writes: >> * lisp/emacs-lisp/cl-macs.el (cl--simple-exprs-p) >> (cl--const-expr-p): Add docstrings. > > Hmm... tackling some tricky ones, eh? Apparently yes! > >> (defun cl--simple-exprs-p (xs) >> + "Check if no side effects, and executes quickly, for each element of list XS." >> (while (and xs (cl--simple-expr-p (car xs))) >> (setq xs (cdr xs))) >> (not xs)) > > I think I'd use a ref to `cl--simple-expr-p`, so we don't duplicate the > poorly defined "no side effects, and executes quickly". See revised patch which follows this advice > > Wait... `grep` says this function is not used any more, so maybe the > better option is to delete it. > >> @@ -118,6 +119,7 @@ cl--safe-expr-p >> >> ;;; Check if constant (i.e., no side effects or dependencies). >> (defun cl--const-expr-p (x) >> + "Check if X is constant (i.e., no side effects or dependencies)." >> (cond ((consp x) >> (or (eq (car x) 'quote) >> (and (memq (car x) '(function cl-function)) > > Yeah..hmm.. by order of increasing preference: > - Move the comment to the docstring rather that just copying it. Done > - Clarify the difference with `macroexp-const-p`. Added reference to this with my interpretation of the difference (which could need change or not) > - Declare the function obsoleted by `macroexp-const-p`. > - Delete the function altogether. > > > Stefan --=-=-=--