From unknown Sat Aug 16 18:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: monnier@IRO.UMontreal.CA, bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Sep 2017 17:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 28557@debbugs.gnu.org Cc: Stefan Monnier X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Stefan Monnier Received: via spool by submit@debbugs.gnu.org id=B.15061014805691 (code B ref -1); Fri, 22 Sep 2017 17:32:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Sep 2017 17:31:20 +0000 Received: from localhost ([127.0.0.1]:53162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvRnM-0001Ti-Dc for submit@debbugs.gnu.org; Fri, 22 Sep 2017 13:31:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44665) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvRnK-0001TV-Du for submit@debbugs.gnu.org; Fri, 22 Sep 2017 13:31:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvRnD-0005Gy-HY for submit@debbugs.gnu.org; Fri, 22 Sep 2017 13:31:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46729) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dvRnD-0005Gr-DV for submit@debbugs.gnu.org; Fri, 22 Sep 2017 13:31:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvRnB-000419-Ak for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 13:31:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvRn8-0005D3-Lu for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 13:31:09 -0400 Received: from aibo.runbox.com ([91.220.196.211]:50768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dvRn8-0005BD-4p for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 13:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=nKk5PtkMFXZx2Tmy1q+nCN0V1JemuGJ2OZ9foyWXda4=; b=Au0dUfW93phM39VtTKYLxjr2g tbxM+wKk6pmqzXqqjIp2HB6XzjCEMg17EPZDcyOa76QdD4//rzXxxeubpYyOFnrBZm37AqErCZAg3 5qyna46+m93F0XHNoQZL6yCdWPDcuBVl2EGDh1v5kzOm97DzKJiVnl92I/k/Jyv5jpC3ZLZqawkiu tI1KIMS1NHboxFGbhJrCKOLWOm1qSYAfZ9Ht2ML5q+8FwlmQZsUji6VY75E++2yAIdeGgHDO6bMJC Ua1Z5dVVJqdg9MOhpmh++WZiOk+SRm7sdmlXFhSSxT3ZQ1mQiXKjTM0LiSPn0u1+JKBJaUa+mBKwY vFYNuXMgw==; Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1dvRn3-0005uI-KD for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 19:31:01 +0200 Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront10.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1dvRmO-0001Oo-Jr for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 19:30:21 +0200 From: Gemini Lasswell Date: Fri, 22 Sep 2017 10:30:11 -0700 Message-ID: <87o9q2od3w.fsf@runbox.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) --=-=-= Content-Type: text/plain Since Emacs 25, docstrings can be constructed using (:documentation FORM) in closures, when lexical-binding is on. This isn't documented except in NEWS. Bug #24773 is about Edebug specs which have not been updated to recognize :documentation. I'd like to fix it, so I started trying to figure out which macros accept :documentation forms so I would know which Edebug specs to update, and that effort turned into a collection of tests for the feature, see attached: --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=cconv-tests.el ;;; cconv-tests.el --- Tests for cconv.el functionality -*- lexical-binding: t; -*- ;; Copyright (C) 2017 Free Software Foundation, Inc. ;; Author: Gemini Lasswell ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;;; Code: (require 'ert) (require 'cl-lib) (ert-deftest cconv-tests-lambda-:documentation () "Docstring for lambda can be specified with :documentation." (let ((fun (lambda () (:documentation (concat "lambda" " documentation")) 'lambda-result))) (should (string= (documentation fun) "lambda documentation")) (should (eq (funcall fun) 'lambda-result)))) (ert-deftest cconv-tests-pcase-lambda-:documentation () "Docstring for pcase-lambda can be specified with :documentation." (let ((fun (pcase-lambda (`(,a ,b)) (:documentation (concat "pcase-lambda" " documentation")) (list b a)))) (should (string= (documentation fun) "pcase-lambda documentation")) (should (equal '(2 1) (funcall fun '(1 2)))))) (defun cconv-tests-defun () (:documentation (concat "defun" " documentation")) 'defun-result) (ert-deftest cconv-tests-defun-:documentation () "Docstring for defun can be specified with :documentation." (should (string= (documentation 'cconv-tests-defun) "defun documentation")) (should (eq (cconv-tests-defun) 'defun-result))) (cl-defun cconv-tests-cl-defun () (:documentation (concat "cl-defun" " documentation")) 'cl-defun-result) (ert-deftest cconv-tests-cl-defun-:documentation () "Docstring for cl-defun can be specified with :documentation." (should (string= (documentation 'cconv-tests-cl-defun) "cl-defun documentation")) (should (eq (cconv-tests-cl-defun) 'cl-defun-result))) (defmacro cconv-tests-defmacro () (:documentation (concat "defmacro" " documentation")) '(quote defmacro-result)) (ert-deftest cconv-tests-defmacro-:documentation () "Docstring for defmacro can be specified with :documentation." (should (string= (documentation 'cconv-tests-defmacro) "defmacro documentation")) (should (eq (cconv-tests-defmacro) 'defmacro-result))) (cl-defmacro cconv-tests-cl-defmacro () (:documentation (concat "cl-defmacro" " documentation")) '(quote cl-defmacro-result)) (ert-deftest cconv-tests-cl-defmacro-:documentation () "Docstring for cl-defmacro can be specified with :documentation." (should (string= (documentation 'cconv-tests-cl-defmacro) "cl-defmacro documentation")) (should (eq (cconv-tests-cl-defmacro) 'cl-defmacro-result))) (cl-iter-defun cconv-tests-cl-iter-defun () (:documentation (concat "cl-iter-defun" " documentation")) (iter-yield 'cl-iter-defun-result)) (ert-deftest cconv-tests-cl-iter-defun-:documentation () "Docstring for cl-iter-defun can be specified with :documentation." (should (string= (documentation 'cconv-tests-cl-iter-defun) "cl-iter-defun documentation")) (should (eq (iter-next (cconv-tests-cl-iter-defun)) 'cl-iter-defun-result))) (iter-defun cconv-tests-iter-defun () (:documentation (concat "iter-defun" " documentation")) (iter-yield 'iter-defun-result)) (ert-deftest cconv-tests-iter-defun-:documentation () "Docstring for iter-defun can be specified with :documentation." (should (string= (documentation 'cconv-tests-iter-defun) "iter-defun documentation")) (should (eq (iter-next (cconv-tests-iter-defun)) 'iter-defun-result))) (ert-deftest cconv-tests-iter-lambda-:documentation () "Docstring for iter-lambda can be specified with :documentation." (let ((iter-fun (iter-lambda () (:documentation (concat "iter-lambda" " documentation")) (iter-yield 'iter-lambda-result)))) (should (string= (documentation iter-fun) "iter-lambda documentation")) (should (eq (iter-next (funcall iter-fun)) 'iter-lambda-result)))) (ert-deftest cconv-tests-cl-function-:documentation () "Docstring for cl-function can be specified with :documentation." (let ((fun (cl-function (lambda (&key arg) (:documentation (concat "cl-function" " documentation")) (list arg 'cl-function-result))))) (should (string= (documentation fun) "cl-function documentation")) (should (equal (funcall fun :arg t) '(t cl-function-result))))) (ert-deftest cconv-tests-function-:documentation () "Docstring for lambda inside function can be specified with :documentation." (let ((fun #'(lambda (arg) (:documentation (concat "function" " documentation")) (list arg 'function-result)))) (should (string= (documentation fun) "function documentation")) (should (equal (funcall fun t) '(t function-result))))) (fmakunbound 'cconv-tests-cl-defgeneric) (setplist 'cconv-tests-cl-defgeneric nil) (cl-defgeneric cconv-tests-cl-defgeneric (n) (:documentation (concat "cl-defgeneric" " documentation"))) (cl-defmethod cconv-tests-cl-defgeneric ((n integer)) (:documentation (concat "cl-defmethod" " documentation")) (+ 1 n)) (ert-deftest cconv-tests-cl-defgeneric-:documentation () "Docstring for cl-defgeneric can be specified with :documentation." (let ((descr (describe-function 'cconv-tests-cl-defgeneric))) (set-text-properties 0 (length descr) nil descr) (should (string-match-p "cl-defgeneric documentation" descr)) (should (string-match-p "cl-defmethod documentation" descr))) (should (= 11 (cconv-tests-cl-defgeneric 10)))) (fmakunbound 'cconv-tests-cl-defgeneric-literal) (setplist 'cconv-tests-cl-defgeneric-literal nil) (cl-defgeneric cconv-tests-cl-defgeneric-literal (n) (:documentation "cl-defgeneric-literal documentation")) (cl-defmethod cconv-tests-cl-defgeneric-literal ((n integer)) (:documentation "cl-defmethod-literal documentation") (+ 1 n)) (ert-deftest cconv-tests-cl-defgeneric-literal-:documentation () "Docstring for cl-defgeneric can be specified with :documentation." (let ((descr (describe-function 'cconv-tests-cl-defgeneric-literal))) (set-text-properties 0 (length descr) nil descr) (should (string-match-p "cl-defgeneric-literal documentation" descr)) (should (string-match-p "cl-defmethod-literal documentation" descr))) (should (= 11 (cconv-tests-cl-defgeneric-literal 10)))) (defsubst cconv-tests-defsubst () (:documentation (concat "defsubst" " documentation")) 'defsubst-result) (ert-deftest cconv-tests-defsubst-:documentation () "Docstring for defsubst can be specified with :documentation." (should (string= (documentation 'cconv-tests-defsubst) "defsubst documentation")) (should (eq (cconv-tests-defsubst) 'defsubst-result))) (cl-defsubst cconv-tests-cl-defsubst () (:documentation (concat "cl-defsubst" " documentation")) 'cl-defsubst-result) (ert-deftest cconv-tests-cl-defsubst-:documentation () "Docstring for cl-defsubst can be specified with :documentation." (should (string= (documentation 'cconv-tests-cl-defsubst) "cl-defsubst documentation")) (should (eq (cconv-tests-cl-defsubst) 'cl-defsubst-result))) (provide 'cconv-tests) ;;; cconv-tests.el ends here --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable While doing this I found these bugs: 1. A lambda wrapped by cl-function with a :documentation form will not get a docstring and the :documentation form will be left in the body of the closure. 2. In code run interactively, a :documentation form in cl-defmacro or defmacro will work correctly. However if you byte-compile that code, the byte-compiler stops with the following error message: Symbol=E2=80=99s function definition is void: internal-make-closure 3. A :documentation form in cl-defgeneric only works if its argument is a string literal. In cl-defmethod, it works whether the argument is a string literal or an expression. 4. A :documentation form works in cl-iter-defun and iter-defun, but not in iter-lambda. Stefan, here's a list of macros in which it appears to me that (:documentation FORM) is supposed to work. Is this correct? Am I missing any? lambda pcase-lambda defun defmacro cl-defun cl-defmacro iter-defun cl-iter-defun iter-lambda function cl-function cl-defgeneric cl-defmethod defsubst cl-defsubst --=-=-=-- From unknown Sat Aug 16 18:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 May 2020 01:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gemini Lasswell Cc: 28557@debbugs.gnu.org, Stefan Monnier Received: via spool by 28557-submit@debbugs.gnu.org id=B28557.158846958312439 (code B ref 28557); Sun, 03 May 2020 01:34:01 +0000 Received: (at 28557) by debbugs.gnu.org; 3 May 2020 01:33:03 +0000 Received: from localhost ([127.0.0.1]:54365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jV3V8-0003EZ-Tl for submit@debbugs.gnu.org; Sat, 02 May 2020 21:33:03 -0400 Received: from ted.gofardesign.uk ([67.225.143.91]:41730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jV3V7-0003E3-3Y for 28557@debbugs.gnu.org; Sat, 02 May 2020 21:33:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=r9EnowTZgVCVS5hypNdf6EDSzl8Sj2GvSc273nDnO+0=; b=IAWTODlcKNyh0fwER7yqd1eDh7 LZZ0+nw6XIoJEkOaPdRAF65c5rttoeJF02jHVmvNyVOflJ+Wc3kvuOQ76FQuzPVMMYBtUEQweLC3g QN2NGt73HtwErQk56JXijwDP916jJyr8b/DeEf/YJvQAw5tTMwRb4VU/T6FwM02CkKZwAGxzEp2+i lLAu15ChxWv9nprX9KiPzLXKog1BOg1ItAxcMO0sg1MGbr5E7RBnAnwoOwNeKPdLWSnCxHuO5n7CT r+cEWm+f66a1il1acuLgTIEFi1AINqralQgQcSL0wJPdQ0vFP1E35GmLWQJ8AvX1Y0uvtODrFepdM X7Bmkkfg==; Received: from h-4-70-69.a785.priv.bahnhof.se ([155.4.70.69]:32854 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jV3Uz-001GOc-3H; Sat, 02 May 2020 21:32:53 -0400 From: Stefan Kangas In-Reply-To: <87o9q2od3w.fsf@runbox.com> (Gemini Lasswell's message of "Fri, 22 Sep 2017 10:30:11 -0700") References: <87o9q2od3w.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Sun, 03 May 2020 03:32:50 +0200 Message-ID: <875zdd3irh.fsf@stefankangas.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Gemini Lasswell writes: > Since Emacs 25, docstrings can be constructed using > (:documentation FORM) in closures, when lexical-binding is on. This > isn't documented except in NEWS. Bug #24773 is about Edebug specs > which have not been updated to recognize :documentation. I'd like to > fix it, so I started trying to figure out which macros accept > :documentation forms so I would know which Edebug specs to update, and > that effort turned into a collection of tests for the feature, see > attached: There is a long list of tests here, but it seems like none of this was ever committed to master. Should it be? > While doing this I found these bugs: > > 1. A lambda wrapped by cl-function with a :documentation form will > not get a docstring and the :documentation form will be left in the > body of the closure. > > 2. In code run interactively, a :documentation form in cl-defmacro or > defmacro will work correctly. However if you byte-compile that code, > the byte-compiler stops with the following error message: > Symbol=E2=80=99s function definition is void: internal-make-closure > > 3. A :documentation form in cl-defgeneric only works if its argument > is a string literal. In cl-defmethod, it works whether the argument is > a string literal or an expression. > > 4. A :documentation form works in cl-iter-defun and iter-defun, but > not in iter-lambda. > > Stefan, here's a list of macros in which it appears to me that > (:documentation FORM) is supposed to work. Is this correct? Am I > missing any? > > lambda > pcase-lambda > defun > defmacro > cl-defun > cl-defmacro > iter-defun > cl-iter-defun > iter-lambda > function > cl-function > cl-defgeneric > cl-defmethod > defsubst > cl-defsubst Does anyone know the answers to the above questions? Best regards, Stefan Kangas From unknown Sat Aug 16 18:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 May 2020 14:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: 28557@debbugs.gnu.org, gazally@runbox.com, monnier@IRO.UMontreal.CA Received: via spool by 28557-submit@debbugs.gnu.org id=B28557.158851757418524 (code B ref 28557); Sun, 03 May 2020 14:53:01 +0000 Received: (at 28557) by debbugs.gnu.org; 3 May 2020 14:52:54 +0000 Received: from localhost ([127.0.0.1]:57558 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVFzC-0004oh-Gs for submit@debbugs.gnu.org; Sun, 03 May 2020 10:52:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVFzB-0004oW-A2 for 28557@debbugs.gnu.org; Sun, 03 May 2020 10:52:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53896) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVFz4-0007ug-Jz; Sun, 03 May 2020 10:52:46 -0400 Received: from [176.228.60.248] (port=2298 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jVFz3-0007fW-Mg; Sun, 03 May 2020 10:52:46 -0400 Date: Sun, 03 May 2020 17:52:39 +0300 Message-Id: <83y2q9oytk.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <875zdd3irh.fsf@stefankangas.se> (message from Stefan Kangas on Sun, 03 May 2020 03:32:50 +0200) References: <87o9q2od3w.fsf@runbox.com> <875zdd3irh.fsf@stefankangas.se> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Sun, 03 May 2020 03:32:50 +0200 > Cc: 28557@debbugs.gnu.org, Stefan Monnier > > There is a long list of tests here, but it seems like none of this was > ever committed to master. Should it be? Why not? Tests are always good and can never break anything in Emacs. From unknown Sat Aug 16 18:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 May 2020 19:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 28557@debbugs.gnu.org, gazally@runbox.com, monnier@IRO.UMontreal.CA Received: via spool by 28557-submit@debbugs.gnu.org id=B28557.158853379321673 (code B ref 28557); Sun, 03 May 2020 19:24:02 +0000 Received: (at 28557) by debbugs.gnu.org; 3 May 2020 19:23:13 +0000 Received: from localhost ([127.0.0.1]:58048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVKCm-0005dT-Kp for submit@debbugs.gnu.org; Sun, 03 May 2020 15:23:13 -0400 Received: from ted.gofardesign.uk ([67.225.143.91]:60096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVKCl-0005dI-FA for 28557@debbugs.gnu.org; Sun, 03 May 2020 15:23:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=laB9QiqrqQ4ttfVzgJij3VbCHqcd9wcnPEwHauzajrI=; b=XGc/MUoVit/+ZNhQNPV0JreLzs LLZPzMtzIspGIb+YNqSpJ2mwdwk9/g57YAFFI0DEe26zK7OunCav1dYJwtiWPhArQ9Lv9OAT/soBA h+QOctsjW/2V1JPLwrtGY8FvWqCrd1s8U4NpVZB9P0/RlkARCQIXu7EsH1e0AUj4PJcn+ZwW2rrzu 5NRdINSVVj5xgtUYW1HcspFgBc/LJbrY/hBvOw6mI+Oh2LJf0dqJVWWDJubq174u5SXKO0rQc8/bn OzdSt9QQx9hjO7510K0m5Wp2tVvH8JY8MI4hygpPkKr6fmmWTUAQSPYiYF50dvvOW8UG7iMGeXvtH 7kU3pGxw==; Received: from h-4-70-69.a785.priv.bahnhof.se ([155.4.70.69]:56910 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jVKCa-000ZtZ-8T; Sun, 03 May 2020 15:23:00 -0400 From: Stefan Kangas In-Reply-To: <83y2q9oytk.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 03 May 2020 17:52:39 +0300") References: <87o9q2od3w.fsf@runbox.com> <875zdd3irh.fsf@stefankangas.se> <83y2q9oytk.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Sun, 03 May 2020 21:22:58 +0200 Message-ID: <87sggg257x.fsf@stefankangas.se> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> There is a long list of tests here, but it seems like none of this was >> ever committed to master. Should it be? > > Why not? Tests are always good and can never break anything in Emacs. OK. However, we only got a .el file by Gemini Lasswell, not a patch. Is there any reason not to commit this in his name like in the attached patch? I have made only very minor changes in the attached patch to mark three tests as ':expected-result :failed' and comment out the two tests where the byte-compiler fails. I also wrote a ChangeLog entry. Thanks. Best regards, Stefan Kangas --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-new-cconv-tests-Bug-28557.patch >From daa65afc86c07ee38c792911a6056eb30d34cd5c Mon Sep 17 00:00:00 2001 From: Gemini Lasswell Date: Sun, 3 May 2020 21:15:14 +0200 Subject: [PATCH] Add new cconv-tests (Bug#28557) * test/lisp/emacs-lisp/cconv-tests.el (top-level): Add two commented out tests which the byte-compiler can't handle. (cconv-tests-lambda-:documentation) (cconv-tests-pcase-lambda-:documentation) (cconv-tests-defun-:documentation) (cconv-tests-cl-defun-:documentation) (cconv-tests-cl-iter-defun-:documentation) (cconv-tests-iter-defun-:documentation) (cconv-tests-function-:documentation) (cconv-tests-cl-defgeneric-literal-:documentation) (cconv-tests-defsubst-:documentation) (cconv-tests-cl-defsubst-:documentation): New tests. (cconv-tests-iter-lambda-:documentation) (cconv-tests-cl-function-:documentation) (cconv-tests-cl-defgeneric-:documentation): New failing tests. --- test/lisp/emacs-lisp/cconv-tests.el | 156 ++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el index c8d46541ad..390714590f 100644 --- a/test/lisp/emacs-lisp/cconv-tests.el +++ b/test/lisp/emacs-lisp/cconv-tests.el @@ -2,6 +2,8 @@ ;; Copyright (C) 2018-2020 Free Software Foundation, Inc. +;; Author: Gemini Lasswell + ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify @@ -20,6 +22,160 @@ ;;; Commentary: (require 'ert) +(require 'cl-lib) + +(ert-deftest cconv-tests-lambda-:documentation () + "Docstring for lambda can be specified with :documentation." + (let ((fun (lambda () + (:documentation (concat "lambda" " documentation")) + 'lambda-result))) + (should (string= (documentation fun) "lambda documentation")) + (should (eq (funcall fun) 'lambda-result)))) + +(ert-deftest cconv-tests-pcase-lambda-:documentation () + "Docstring for pcase-lambda can be specified with :documentation." + (let ((fun (pcase-lambda (`(,a ,b)) + (:documentation (concat "pcase-lambda" " documentation")) + (list b a)))) + (should (string= (documentation fun) "pcase-lambda documentation")) + (should (equal '(2 1) (funcall fun '(1 2)))))) + +(defun cconv-tests-defun () + (:documentation (concat "defun" " documentation")) + 'defun-result) +(ert-deftest cconv-tests-defun-:documentation () + "Docstring for defun can be specified with :documentation." + (should (string= (documentation 'cconv-tests-defun) + "defun documentation")) + (should (eq (cconv-tests-defun) 'defun-result))) + +(cl-defun cconv-tests-cl-defun () + (:documentation (concat "cl-defun" " documentation")) + 'cl-defun-result) +(ert-deftest cconv-tests-cl-defun-:documentation () + "Docstring for cl-defun can be specified with :documentation." + (should (string= (documentation 'cconv-tests-cl-defun) + "cl-defun documentation")) + (should (eq (cconv-tests-cl-defun) 'cl-defun-result))) + +;; FIXME: The byte-complier croaks on this. See Bug#28557. +;; (defmacro cconv-tests-defmacro () +;; (:documentation (concat "defmacro" " documentation")) +;; '(quote defmacro-result)) +;; (ert-deftest cconv-tests-defmacro-:documentation () +;; "Docstring for defmacro can be specified with :documentation." +;; (should (string= (documentation 'cconv-tests-defmacro) +;; "defmacro documentation")) +;; (should (eq (cconv-tests-defmacro) 'defmacro-result))) + +;; FIXME: The byte-complier croaks on this. See Bug#28557. +;; (cl-defmacro cconv-tests-cl-defmacro () +;; (:documentation (concat "cl-defmacro" " documentation")) +;; '(quote cl-defmacro-result)) +;; (ert-deftest cconv-tests-cl-defmacro-:documentation () +;; "Docstring for cl-defmacro can be specified with :documentation." +;; (should (string= (documentation 'cconv-tests-cl-defmacro) +;; "cl-defmacro documentation")) +;; (should (eq (cconv-tests-cl-defmacro) 'cl-defmacro-result))) + +(cl-iter-defun cconv-tests-cl-iter-defun () + (:documentation (concat "cl-iter-defun" " documentation")) + (iter-yield 'cl-iter-defun-result)) +(ert-deftest cconv-tests-cl-iter-defun-:documentation () + "Docstring for cl-iter-defun can be specified with :documentation." + (should (string= (documentation 'cconv-tests-cl-iter-defun) + "cl-iter-defun documentation")) + (should (eq (iter-next (cconv-tests-cl-iter-defun)) + 'cl-iter-defun-result))) + +(iter-defun cconv-tests-iter-defun () + (:documentation (concat "iter-defun" " documentation")) + (iter-yield 'iter-defun-result)) +(ert-deftest cconv-tests-iter-defun-:documentation () + "Docstring for iter-defun can be specified with :documentation." + (should (string= (documentation 'cconv-tests-iter-defun) + "iter-defun documentation")) + (should (eq (iter-next (cconv-tests-iter-defun)) 'iter-defun-result))) + +(ert-deftest cconv-tests-iter-lambda-:documentation () + "Docstring for iter-lambda can be specified with :documentation." + ;; FIXME: See Bug#28557. + :expected-result :failed + (let ((iter-fun + (iter-lambda () + (:documentation (concat "iter-lambda" " documentation")) + (iter-yield 'iter-lambda-result)))) + (should (string= (documentation iter-fun) "iter-lambda documentation")) + (should (eq (iter-next (funcall iter-fun)) 'iter-lambda-result)))) + +(ert-deftest cconv-tests-cl-function-:documentation () + "Docstring for cl-function can be specified with :documentation." + ;; FIXME: See Bug#28557. + :expected-result :failed + (let ((fun (cl-function (lambda (&key arg) + (:documentation (concat "cl-function" + " documentation")) + (list arg 'cl-function-result))))) + (should (string= (documentation fun) "cl-function documentation")) + (should (equal (funcall fun :arg t) '(t cl-function-result))))) + +(ert-deftest cconv-tests-function-:documentation () + "Docstring for lambda inside function can be specified with :documentation." + (let ((fun #'(lambda (arg) + (:documentation (concat "function" " documentation")) + (list arg 'function-result)))) + (should (string= (documentation fun) "function documentation")) + (should (equal (funcall fun t) '(t function-result))))) + +(fmakunbound 'cconv-tests-cl-defgeneric) +(setplist 'cconv-tests-cl-defgeneric nil) +(cl-defgeneric cconv-tests-cl-defgeneric (n) + (:documentation (concat "cl-defgeneric" " documentation"))) +(cl-defmethod cconv-tests-cl-defgeneric ((n integer)) + (:documentation (concat "cl-defmethod" " documentation")) + (+ 1 n)) +(ert-deftest cconv-tests-cl-defgeneric-:documentation () + "Docstring for cl-defgeneric can be specified with :documentation." + ;; FIXME: See Bug#28557. + :expected-result :failed + (let ((descr (describe-function 'cconv-tests-cl-defgeneric))) + (set-text-properties 0 (length descr) nil descr) + (should (string-match-p "cl-defgeneric documentation" descr)) + (should (string-match-p "cl-defmethod documentation" descr))) + (should (= 11 (cconv-tests-cl-defgeneric 10)))) + +(fmakunbound 'cconv-tests-cl-defgeneric-literal) +(setplist 'cconv-tests-cl-defgeneric-literal nil) +(cl-defgeneric cconv-tests-cl-defgeneric-literal (n) + (:documentation "cl-defgeneric-literal documentation")) +(cl-defmethod cconv-tests-cl-defgeneric-literal ((n integer)) + (:documentation "cl-defmethod-literal documentation") + (+ 1 n)) +(ert-deftest cconv-tests-cl-defgeneric-literal-:documentation () + "Docstring for cl-defgeneric can be specified with :documentation." + (let ((descr (describe-function 'cconv-tests-cl-defgeneric-literal))) + (set-text-properties 0 (length descr) nil descr) + (should (string-match-p "cl-defgeneric-literal documentation" descr)) + (should (string-match-p "cl-defmethod-literal documentation" descr))) + (should (= 11 (cconv-tests-cl-defgeneric-literal 10)))) + +(defsubst cconv-tests-defsubst () + (:documentation (concat "defsubst" " documentation")) + 'defsubst-result) +(ert-deftest cconv-tests-defsubst-:documentation () + "Docstring for defsubst can be specified with :documentation." + (should (string= (documentation 'cconv-tests-defsubst) + "defsubst documentation")) + (should (eq (cconv-tests-defsubst) 'defsubst-result))) + +(cl-defsubst cconv-tests-cl-defsubst () + (:documentation (concat "cl-defsubst" " documentation")) + 'cl-defsubst-result) +(ert-deftest cconv-tests-cl-defsubst-:documentation () + "Docstring for cl-defsubst can be specified with :documentation." + (should (string= (documentation 'cconv-tests-cl-defsubst) + "cl-defsubst documentation")) + (should (eq (cconv-tests-cl-defsubst) 'cl-defsubst-result))) (ert-deftest cconv-convert-lambda-lifted () "Bug#30872." -- 2.26.2 --=-=-=-- From unknown Sat Aug 16 18:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 May 2020 13:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: 28557@debbugs.gnu.org, gazally@runbox.com, monnier@IRO.UMontreal.CA Received: via spool by 28557-submit@debbugs.gnu.org id=B28557.158860009730816 (code B ref 28557); Mon, 04 May 2020 13:49:01 +0000 Received: (at 28557) by debbugs.gnu.org; 4 May 2020 13:48:17 +0000 Received: from localhost ([127.0.0.1]:59294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVbS7-00080q-Rf for submit@debbugs.gnu.org; Mon, 04 May 2020 09:48:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVbRr-000802-RY for 28557@debbugs.gnu.org; Mon, 04 May 2020 09:48:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57938) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVbRl-00029l-NI; Mon, 04 May 2020 09:47:49 -0400 Received: from [176.228.60.248] (port=2286 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jVbRj-0004pb-Rn; Mon, 04 May 2020 09:47:48 -0400 Date: Mon, 04 May 2020 16:47:45 +0300 Message-Id: <83v9lbolq6.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87sggg257x.fsf@stefankangas.se> (message from Stefan Kangas on Sun, 03 May 2020 21:22:58 +0200) References: <87o9q2od3w.fsf@runbox.com> <875zdd3irh.fsf@stefankangas.se> <83y2q9oytk.fsf@gnu.org> <87sggg257x.fsf@stefankangas.se> X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Cc: 28557@debbugs.gnu.org, gazally@runbox.com, monnier@IRO.UMontreal.CA > Date: Sun, 03 May 2020 21:22:58 +0200 > > > Why not? Tests are always good and can never break anything in Emacs. > > OK. However, we only got a .el file by Gemini Lasswell, not a patch. > > Is there any reason not to commit this in his name like in the > attached patch? I don't see why not, provided that Gemini Lasswell agrees. From unknown Sat Aug 16 18:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Aug 2020 17:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 28557@debbugs.gnu.org, gazally@runbox.com, monnier@iro.umontreal.ca Received: via spool by 28557-submit@debbugs.gnu.org id=B28557.159656081816411 (code B ref 28557); Tue, 04 Aug 2020 17:07:01 +0000 Received: (at 28557) by debbugs.gnu.org; 4 Aug 2020 17:06:58 +0000 Received: from localhost ([127.0.0.1]:49054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k30Ov-0004Gd-Nq for submit@debbugs.gnu.org; Tue, 04 Aug 2020 13:06:58 -0400 Received: from mail-yb1-f170.google.com ([209.85.219.170]:40834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k30Oq-0004GK-FA for 28557@debbugs.gnu.org; Tue, 04 Aug 2020 13:06:56 -0400 Received: by mail-yb1-f170.google.com with SMTP id q3so2837876ybp.7 for <28557@debbugs.gnu.org>; Tue, 04 Aug 2020 10:06:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc; bh=V+S5Rl8HJm3hTLYV/MCxO3BNoZnkpOMLy4IagE+ek+4=; b=rPiqrW5MY8lWsKgNlZXETYyv4GQ0JEgQRthIAZgHbbQHaz4oalnFCFNnurcn8XMeJn Do0E0hQ8oW93Mx/Bh5grCzYxFuGGecVz0bapfkU4eBJWg28ZiV3a/bhmCFPoHOn0HIxD EH2ls07ng18jchDqHBcEIWiv5e8/err8ml5vqPJ4XQm5g94LbZNxX9OIzb2fVO1SBvgB w2IZuxfEMkHIJ5XOPL/VGka3mNA03b/0y5nxJSmjMjeyRZJg7yVIOyGwl+nasz2XSliO q6Meuhlog2+i4TGM1NJai9/Ls+9NBp18U0sO8RYUp15J0k8ZCrjaLFMXKsH/77l9r3IL se2A== X-Gm-Message-State: AOAM532ENtwICvA3gTv74L7Cm+Bnu+zVJoL+Hzz3SvlGK8XmkUsT16+B vhg2uDruYYBC360CNyo7I4OQyE/j5bVGkTFW1CI= X-Google-Smtp-Source: ABdhPJw6dLkH00Pu1iQCMKvwHagwunvap1qkstY4DsjjVGlpAbwobUJ7Pue/ZvgrE2tE30Bd1TFINex7tUfhYhW0a+s= X-Received: by 2002:a25:7007:: with SMTP id l7mr31447870ybc.85.1596560806876; Tue, 04 Aug 2020 10:06:46 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 4 Aug 2020 10:06:46 -0700 From: Stefan Kangas In-Reply-To: <83v9lbolq6.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 04 May 2020 16:47:45 +0300") References: <87o9q2od3w.fsf@runbox.com> <875zdd3irh.fsf@stefankangas.se> <83y2q9oytk.fsf@gnu.org> <87sggg257x.fsf@stefankangas.se> <83v9lbolq6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Date: Tue, 4 Aug 2020 10:06:46 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Stefan Kangas >> Cc: 28557@debbugs.gnu.org, gazally@runbox.com, monnier@IRO.UMontreal.CA >> Date: Sun, 03 May 2020 21:22:58 +0200 >> >> > Why not? Tests are always good and can never break anything in Emacs. >> >> OK. However, we only got a .el file by Gemini Lasswell, not a patch. >> >> Is there any reason not to commit this in his name like in the >> attached patch? > > I don't see why not, provided that Gemini Lasswell agrees. No reply within 13 weeks so I committed the tests in my name with credit to Gemini Lasswell. The bugs here still needs to be fixed though. Best regards, Stefan Kangas From unknown Sat Aug 16 18:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Aug 2020 01:09:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: 28557@debbugs.gnu.org, Eli Zaretskii , monnier@iro.umontreal.ca Received: via spool by 28557-submit@debbugs.gnu.org id=B28557.159728088315550 (code B ref 28557); Thu, 13 Aug 2020 01:09:03 +0000 Received: (at 28557) by debbugs.gnu.org; 13 Aug 2020 01:08:03 +0000 Received: from localhost ([127.0.0.1]:46179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k61is-00042j-Mt for submit@debbugs.gnu.org; Wed, 12 Aug 2020 21:08:02 -0400 Received: from aibo.runbox.com ([91.220.196.211]:38132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k61iq-00042I-IU for 28557@debbugs.gnu.org; Wed, 12 Aug 2020 21:08:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector2; h=Content-Type:MIME-Version:Message-ID:Date:In-reply-to:Subject :Cc:To:From:References; bh=ppgfWlmXT6YEs+/UqGxwiONCH3hCPSkjo52R2yhm98E=; b=O/ 41uub63GE6hsPucEY0v00xjUDsogwTQv+4XnishGJJxQVaGX6oVWYEZEoXLhRm6bQzcBUQ89qHZI2 NMifs2BhlEFNBz8/vBJivOC++suzjUQQcp5OB1dt0w+Pd1fwG27sv4e0mOZCDzEG3G1CwJ9MagHS9 JLU0+nXz+SAXmGoFh3NCM5eF4+8YQYTvYhA/wSnsQVOy7ePJ7B80Wv1AMF5muVdOiJEinXjEjVt8j 5ae31ENtvujUOh+nt3/VvK+6IkLh6Y4yoW+1Z5DXmueJQGs3aFm+Ba4JVZ1oXPxzS++vrHwOyeOae 49XIO3Q9AsSTE6CqUt2C0YKyM/vi6Qyw==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1k61im-0007fF-Kl; Thu, 13 Aug 2020 03:07:56 +0200 Received: by submission01.runbox with esmtpsa [Authenticated alias (696087)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1k61iS-0001im-FE; Thu, 13 Aug 2020 03:07:36 +0200 References: <87o9q2od3w.fsf@runbox.com> <875zdd3irh.fsf@stefankangas.se> <83y2q9oytk.fsf@gnu.org> <87sggg257x.fsf@stefankangas.se> <83v9lbolq6.fsf@gnu.org> User-agent: mu4e 1.2.0; emacs 26.3.50 From: Gemini Lasswell In-reply-to: Date: Wed, 12 Aug 2020 18:07:34 -0700 Message-ID: <87sgcrfj55.fsf@runbox.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan Kangas writes: >> I don't see why not, provided that Gemini Lasswell agrees. > > No reply within 13 weeks so I committed the tests in my name with credit > to Gemini Lasswell. Sorry I missed this 13 weeks ago. Thanks for committing the tests. From unknown Sat Aug 16 18:45:36 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Gemini Lasswell Subject: bug#28557: closed (Re: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures) Message-ID: References: <87o9q2od3w.fsf@runbox.com> X-Gnu-PR-Message: they-closed 28557 X-Gnu-PR-Package: emacs Reply-To: 28557@debbugs.gnu.org Date: Tue, 21 Dec 2021 03:06:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1640055962-27998-1" This is a multi-part message in MIME format... ------------=_1640055962-27998-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #28557: 26.0.60; Bugs using (:documentation FORM) in closures which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 28557@debbugs.gnu.org. --=20 28557: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D28557 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1640055962-27998-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 28557-done) by debbugs.gnu.org; 21 Dec 2021 03:05:28 +0000 Received: from localhost ([127.0.0.1]:51901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mzVSy-0007Go-JW for submit@debbugs.gnu.org; Mon, 20 Dec 2021 22:05:28 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:35129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mzVSt-0007GV-8l for 28557-done@debbugs.gnu.org; Mon, 20 Dec 2021 22:05:26 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 57168100189; Mon, 20 Dec 2021 22:05:17 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 059EF100091; Mon, 20 Dec 2021 22:05:16 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1640055916; bh=IYY6nqB2ObH+oOe7ajePGQ+bq9uOfIbw1tV7TAEO6/k=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=KSkP/H8OM0A5gOFoVNVZZzclNHCbSgm9KwoMeAUmsfXH9tam1yFtJYs/oi2uFc4sw GqDrnQP9EDjB7eKChbmHY7iJs7auxZuvIBRG7zKMIrne7A8r5wJUKQcqRovs+6ZqwV bVoujCqGHJcbY1dm8wTY4PxcWgsVKYimbEzrS3VFbYytsDtPdA5kWMT1yBvjtL2jL3 hRVQLo4ewIb8CCnppgqjy+Q5K0ppCjvr/8M4Ip2HfzYc0Sr6LLfMxnk+RqvzNZ/8i8 jTkIaoJjDBZ8EeY/ltd0c+orc3SvLx95OVItB9uObYzFc0zuVa2bi3aWFSdp8gwNcF WI2G49Butn/vg== Received: from ceviche (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BF4A5120DD4; Mon, 20 Dec 2021 22:05:15 -0500 (EST) From: Stefan Monnier To: Gemini Lasswell Subject: Re: bug#28557: 26.0.60; Bugs using (:documentation FORM) in closures Message-ID: References: <87o9q2od3w.fsf@runbox.com> Date: Mon, 20 Dec 2021 22:05:14 -0500 In-Reply-To: <87o9q2od3w.fsf@runbox.com> (Gemini Lasswell's message of "Fri, 22 Sep 2017 10:30:11 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.089 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 28557-done Cc: 28557-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Stefan, here's a list of macros in which it appears to me that > (:documentation FORM) is supposed to work. Is this correct? > Am I missing any? I don't know. The cl-generic.el case is debatable (not sure how important it use for it to support computed docstrings), but in any case I think I fixed those cases now. Thanks. Note that I did not upgrade the Edebug specs accordingly :-( Stefan ------------=_1640055962-27998-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Sep 2017 17:31:20 +0000 Received: from localhost ([127.0.0.1]:53162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvRnM-0001Ti-Dc for submit@debbugs.gnu.org; Fri, 22 Sep 2017 13:31:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44665) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvRnK-0001TV-Du for submit@debbugs.gnu.org; Fri, 22 Sep 2017 13:31:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvRnD-0005Gy-HY for submit@debbugs.gnu.org; Fri, 22 Sep 2017 13:31:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46729) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dvRnD-0005Gr-DV for submit@debbugs.gnu.org; Fri, 22 Sep 2017 13:31:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvRnB-000419-Ak for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 13:31:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvRn8-0005D3-Lu for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 13:31:09 -0400 Received: from aibo.runbox.com ([91.220.196.211]:50768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dvRn8-0005BD-4p for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 13:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=nKk5PtkMFXZx2Tmy1q+nCN0V1JemuGJ2OZ9foyWXda4=; b=Au0dUfW93phM39VtTKYLxjr2g tbxM+wKk6pmqzXqqjIp2HB6XzjCEMg17EPZDcyOa76QdD4//rzXxxeubpYyOFnrBZm37AqErCZAg3 5qyna46+m93F0XHNoQZL6yCdWPDcuBVl2EGDh1v5kzOm97DzKJiVnl92I/k/Jyv5jpC3ZLZqawkiu tI1KIMS1NHboxFGbhJrCKOLWOm1qSYAfZ9Ht2ML5q+8FwlmQZsUji6VY75E++2yAIdeGgHDO6bMJC Ua1Z5dVVJqdg9MOhpmh++WZiOk+SRm7sdmlXFhSSxT3ZQ1mQiXKjTM0LiSPn0u1+JKBJaUa+mBKwY vFYNuXMgw==; Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1dvRn3-0005uI-KD for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 19:31:01 +0200 Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront10.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1dvRmO-0001Oo-Jr for bug-gnu-emacs@gnu.org; Fri, 22 Sep 2017 19:30:21 +0200 From: Gemini Lasswell To: bug-gnu-emacs@gnu.org Subject: 26.0.60; Bugs using (:documentation FORM) in closures X-Debbugs-CC: Stefan Monnier Date: Fri, 22 Sep 2017 10:30:11 -0700 Message-ID: <87o9q2od3w.fsf@runbox.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) --=-=-= Content-Type: text/plain Since Emacs 25, docstrings can be constructed using (:documentation FORM) in closures, when lexical-binding is on. This isn't documented except in NEWS. Bug #24773 is about Edebug specs which have not been updated to recognize :documentation. I'd like to fix it, so I started trying to figure out which macros accept :documentation forms so I would know which Edebug specs to update, and that effort turned into a collection of tests for the feature, see attached: --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=cconv-tests.el ;;; cconv-tests.el --- Tests for cconv.el functionality -*- lexical-binding: t; -*- ;; Copyright (C) 2017 Free Software Foundation, Inc. ;; Author: Gemini Lasswell ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;;; Code: (require 'ert) (require 'cl-lib) (ert-deftest cconv-tests-lambda-:documentation () "Docstring for lambda can be specified with :documentation." (let ((fun (lambda () (:documentation (concat "lambda" " documentation")) 'lambda-result))) (should (string= (documentation fun) "lambda documentation")) (should (eq (funcall fun) 'lambda-result)))) (ert-deftest cconv-tests-pcase-lambda-:documentation () "Docstring for pcase-lambda can be specified with :documentation." (let ((fun (pcase-lambda (`(,a ,b)) (:documentation (concat "pcase-lambda" " documentation")) (list b a)))) (should (string= (documentation fun) "pcase-lambda documentation")) (should (equal '(2 1) (funcall fun '(1 2)))))) (defun cconv-tests-defun () (:documentation (concat "defun" " documentation")) 'defun-result) (ert-deftest cconv-tests-defun-:documentation () "Docstring for defun can be specified with :documentation." (should (string= (documentation 'cconv-tests-defun) "defun documentation")) (should (eq (cconv-tests-defun) 'defun-result))) (cl-defun cconv-tests-cl-defun () (:documentation (concat "cl-defun" " documentation")) 'cl-defun-result) (ert-deftest cconv-tests-cl-defun-:documentation () "Docstring for cl-defun can be specified with :documentation." (should (string= (documentation 'cconv-tests-cl-defun) "cl-defun documentation")) (should (eq (cconv-tests-cl-defun) 'cl-defun-result))) (defmacro cconv-tests-defmacro () (:documentation (concat "defmacro" " documentation")) '(quote defmacro-result)) (ert-deftest cconv-tests-defmacro-:documentation () "Docstring for defmacro can be specified with :documentation." (should (string= (documentation 'cconv-tests-defmacro) "defmacro documentation")) (should (eq (cconv-tests-defmacro) 'defmacro-result))) (cl-defmacro cconv-tests-cl-defmacro () (:documentation (concat "cl-defmacro" " documentation")) '(quote cl-defmacro-result)) (ert-deftest cconv-tests-cl-defmacro-:documentation () "Docstring for cl-defmacro can be specified with :documentation." (should (string= (documentation 'cconv-tests-cl-defmacro) "cl-defmacro documentation")) (should (eq (cconv-tests-cl-defmacro) 'cl-defmacro-result))) (cl-iter-defun cconv-tests-cl-iter-defun () (:documentation (concat "cl-iter-defun" " documentation")) (iter-yield 'cl-iter-defun-result)) (ert-deftest cconv-tests-cl-iter-defun-:documentation () "Docstring for cl-iter-defun can be specified with :documentation." (should (string= (documentation 'cconv-tests-cl-iter-defun) "cl-iter-defun documentation")) (should (eq (iter-next (cconv-tests-cl-iter-defun)) 'cl-iter-defun-result))) (iter-defun cconv-tests-iter-defun () (:documentation (concat "iter-defun" " documentation")) (iter-yield 'iter-defun-result)) (ert-deftest cconv-tests-iter-defun-:documentation () "Docstring for iter-defun can be specified with :documentation." (should (string= (documentation 'cconv-tests-iter-defun) "iter-defun documentation")) (should (eq (iter-next (cconv-tests-iter-defun)) 'iter-defun-result))) (ert-deftest cconv-tests-iter-lambda-:documentation () "Docstring for iter-lambda can be specified with :documentation." (let ((iter-fun (iter-lambda () (:documentation (concat "iter-lambda" " documentation")) (iter-yield 'iter-lambda-result)))) (should (string= (documentation iter-fun) "iter-lambda documentation")) (should (eq (iter-next (funcall iter-fun)) 'iter-lambda-result)))) (ert-deftest cconv-tests-cl-function-:documentation () "Docstring for cl-function can be specified with :documentation." (let ((fun (cl-function (lambda (&key arg) (:documentation (concat "cl-function" " documentation")) (list arg 'cl-function-result))))) (should (string= (documentation fun) "cl-function documentation")) (should (equal (funcall fun :arg t) '(t cl-function-result))))) (ert-deftest cconv-tests-function-:documentation () "Docstring for lambda inside function can be specified with :documentation." (let ((fun #'(lambda (arg) (:documentation (concat "function" " documentation")) (list arg 'function-result)))) (should (string= (documentation fun) "function documentation")) (should (equal (funcall fun t) '(t function-result))))) (fmakunbound 'cconv-tests-cl-defgeneric) (setplist 'cconv-tests-cl-defgeneric nil) (cl-defgeneric cconv-tests-cl-defgeneric (n) (:documentation (concat "cl-defgeneric" " documentation"))) (cl-defmethod cconv-tests-cl-defgeneric ((n integer)) (:documentation (concat "cl-defmethod" " documentation")) (+ 1 n)) (ert-deftest cconv-tests-cl-defgeneric-:documentation () "Docstring for cl-defgeneric can be specified with :documentation." (let ((descr (describe-function 'cconv-tests-cl-defgeneric))) (set-text-properties 0 (length descr) nil descr) (should (string-match-p "cl-defgeneric documentation" descr)) (should (string-match-p "cl-defmethod documentation" descr))) (should (= 11 (cconv-tests-cl-defgeneric 10)))) (fmakunbound 'cconv-tests-cl-defgeneric-literal) (setplist 'cconv-tests-cl-defgeneric-literal nil) (cl-defgeneric cconv-tests-cl-defgeneric-literal (n) (:documentation "cl-defgeneric-literal documentation")) (cl-defmethod cconv-tests-cl-defgeneric-literal ((n integer)) (:documentation "cl-defmethod-literal documentation") (+ 1 n)) (ert-deftest cconv-tests-cl-defgeneric-literal-:documentation () "Docstring for cl-defgeneric can be specified with :documentation." (let ((descr (describe-function 'cconv-tests-cl-defgeneric-literal))) (set-text-properties 0 (length descr) nil descr) (should (string-match-p "cl-defgeneric-literal documentation" descr)) (should (string-match-p "cl-defmethod-literal documentation" descr))) (should (= 11 (cconv-tests-cl-defgeneric-literal 10)))) (defsubst cconv-tests-defsubst () (:documentation (concat "defsubst" " documentation")) 'defsubst-result) (ert-deftest cconv-tests-defsubst-:documentation () "Docstring for defsubst can be specified with :documentation." (should (string= (documentation 'cconv-tests-defsubst) "defsubst documentation")) (should (eq (cconv-tests-defsubst) 'defsubst-result))) (cl-defsubst cconv-tests-cl-defsubst () (:documentation (concat "cl-defsubst" " documentation")) 'cl-defsubst-result) (ert-deftest cconv-tests-cl-defsubst-:documentation () "Docstring for cl-defsubst can be specified with :documentation." (should (string= (documentation 'cconv-tests-cl-defsubst) "cl-defsubst documentation")) (should (eq (cconv-tests-cl-defsubst) 'cl-defsubst-result))) (provide 'cconv-tests) ;;; cconv-tests.el ends here --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable While doing this I found these bugs: 1. A lambda wrapped by cl-function with a :documentation form will not get a docstring and the :documentation form will be left in the body of the closure. 2. In code run interactively, a :documentation form in cl-defmacro or defmacro will work correctly. However if you byte-compile that code, the byte-compiler stops with the following error message: Symbol=E2=80=99s function definition is void: internal-make-closure 3. A :documentation form in cl-defgeneric only works if its argument is a string literal. In cl-defmethod, it works whether the argument is a string literal or an expression. 4. A :documentation form works in cl-iter-defun and iter-defun, but not in iter-lambda. Stefan, here's a list of macros in which it appears to me that (:documentation FORM) is supposed to work. Is this correct? Am I missing any? lambda pcase-lambda defun defmacro cl-defun cl-defmacro iter-defun cl-iter-defun iter-lambda function cl-function cl-defgeneric cl-defmethod defsubst cl-defsubst --=-=-=-- ------------=_1640055962-27998-1--