From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.devel Subject: Re: master fd92023: Make checkdoc work with qualified methods Date: Fri, 05 Mar 2021 17:55:28 -0300 Message-ID: <60429ac4.1c69fb81.f0bc8.1a01@mx.google.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37722"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 05 21:56:42 2021 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 1lIHV4-0009jF-KI for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Mar 2021 21:56:42 +0100 Original-Received: from localhost ([::1]:56020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIHV3-0004WQ-La for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Mar 2021 15:56:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIHU3-0003u6-VV for emacs-devel@gnu.org; Fri, 05 Mar 2021 15:55:41 -0500 Original-Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]:43469) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIHTy-0003m7-N6 for emacs-devel@gnu.org; Fri, 05 Mar 2021 15:55:37 -0500 Original-Received: by mail-qk1-x736.google.com with SMTP id b130so3372172qkc.10 for ; Fri, 05 Mar 2021 12:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:from:to:cc:subject:in-reply-to:date:mime-version; bh=2vzO/Pv9b50zT1mfJbc4l7TuqvK+8jRVV7PMZJA8LNI=; b=rCZW0R9cUcCTJfcWfGgkK3fWRsHXMHCbBGwH+ysDqs6WhtL7EJNJ9d1tP08Yy1Ym98 GFFLBjdkW49TDwWSrIvQZuzULlvemBMsLsZXWE3Ux34bDRXs8EFnogXiwGXheuWbuEvP LrQzcq/z7rfr6yoRZH8bHy3SRlEGRfZ/UF6u/1N4sTVOZt4NvtcgO6TsQxCQQgKRBGbO VtssmTtZcmi/NlIaB74sFFwRt14Vc7RoHUX5ZChKcfhEcBwh3AD9wE0J+vDmXWqz5hHG wDlvrMYxfgNBOFfgD+QnY16yzUoEDmq6RIr55mEFkwIMCOdHG2tW3Dt4RMgjfKjzqf7N On6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:from:to:cc:subject:in-reply-to:date :mime-version; bh=2vzO/Pv9b50zT1mfJbc4l7TuqvK+8jRVV7PMZJA8LNI=; b=rxRPy2qFxpDBacrcH6R2QLrCeIascpD7+myCNpPl4HJGsQDz01ah4mFFgIM82wtY+0 aqytsxTF1I6uDWoFh8FbNhCxX0E8LSIl8qer4CFrCFX42BeLZ5ZO+rIsBUXnlT66MRwl KJz+Ze86owoiKvfluE0SVN8lt05ero+OYZAu/2LNZ1YCKnLLqta80xQT5KKhDZvotPin 8KOAcKZxjq9/mvP+AlB8t4PK4Sek/t9K68wqi1Huj6dbsbSxqgxO7OfiGW2D+IvkE/UP csU/7kl3DVTaQUu5C2YDygdgsniSVKxEPN/oCfiN0xNJhN+dNGXQ54+dLILY3SgOK8vT uJbA== X-Gm-Message-State: AOAM531dIWg2vzveFm+1L8a21y1XiJCikRn2b4q3GMz/YBGQtsInMMba wvKlpGQ7suJ0CXrK4o4Vzj/E3MejmD6Ij9ng X-Google-Smtp-Source: ABdhPJy9LQZ4h8w932kxcSzUvE4FEE2o7NL1RNT4r+1MpZkxosnrbjDs926KQMY8UUMv/FydOGleyQ== X-Received: by 2002:a05:620a:2046:: with SMTP id d6mr11425033qka.116.1614977732754; Fri, 05 Mar 2021 12:55:32 -0800 (PST) Original-Received: from tbb-desktop ([201.213.132.172]) by smtp.gmail.com with ESMTPSA id s24sm2582883qks.127.2021.03.05.12.55.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Mar 2021 12:55:32 -0800 (PST) X-Google-Original-Message-ID: <87h7lp1fsv.fsf@maurooaranda@gmail.com> In-Reply-To: (message from Stefan Monnier on Fri, 05 Mar 2021 10:21:42 -0500) Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=maurooaranda@gmail.com; helo=mail-qk1-x736.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:266046 Archived-At: Stefan Monnier writes: >> (`(,(and >> (or 'defun 'defvar 'defcustom 'defmacro 'defconst 'defsubst >> 'defadvice 'cl-defun 'cl-defgeneric 'cl-defmacro 'cl-defmethod) >> def) >> ,(pred symbolp) >> ;; Require an initializer, i.e. ignore single-argument `defvar' >> ;; forms, which never have a doc string. >> ,_ . ,_) > > I think you can reduce that to > > (pred symbolp) > > and then check that (function-get def 'doc-string-elt) is non-nil. I thought about that: it would "add support" to other definitions, and I wasn't sure if it would be desired to check the docstring for all of them. An el-search reports the following (without counting what checkdoc already supports): define-abbrev-table (*) defface defgroup deftheme (*) define-ibuffer-sorter define-ibuffer-op define-ibuffer-filter defimage (*) define-skeleton defvar-local lambda (**) define-widget defmath define-overloadable-function define-mode-local-override define-obsolete-function-alias define-obsolete-variable-alias cl-iter-defun cl-defstruct cl-deftype define-derived-mode define-minor-mode define-globalized-minor-mode easy-menu-define ert-deftest iter-defun define-generic-mode define-inline define-advice pcase-lambda (**) pcase-defmacro define-erc-module define-ccl-program defun-mh defmacro-mh defgroup-mh defcustom-mh defface-mh ediff-defvar-local defun-cvs-mode (*) * the pattern would need tweaking to detect the form ** wouldn't match, because of the second (pred symbolp) Also, for some definitions (e.g., define-erc-module), the report might be different because the file was/wasn't loaded. To sum it up, I feared that just checking for a non-nil doc-string-elt could make checkdoc somewhat annoying, but I'd like to know what other people think. >> Note that I need to do (forward-sexp 1) so the requirements of >> cl--defmethod-doc-pos are fulfilled. It may get messy if other defining >> forms declare a doc-string-elt function that assumes a different point >> position. > > The starting position of `doc-string-elt` is currently defined de-facto > by the code in `lisp-string-in-doc-position-p`, so > `cl--defmethod-doc-pos` had no choice in the matter ;-) I didn't know that. No worries then. >> BTW, I've noticed that I forgot to add the Bug tag to my commit, I'm >> sorry. This commit was part of Bug#46918. > > I think this deserves a harsh punishment. :-(