From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Hyatt Newsgroups: gmane.emacs.bugs Subject: bug#5126: 23.1; checkdoc-comment-style-hooks stops at first error Date: Tue, 20 Aug 2019 13:21:46 -0400 Message-ID: References: <87ws12jr51.fsf@blah.blah> <87sgq0ly7z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009760d705908fb156" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="61873"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 5126@debbugs.gnu.org, Kevin Ryde To: Alex Branham Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 20 19:23:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i07qi-000Fvx-0d for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Aug 2019 19:23:12 +0200 Original-Received: from localhost ([::1]:39998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i07qg-0005Er-8B for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Aug 2019 13:23:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52284) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i07qa-0005Dp-Cm for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2019 13:23:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i07qZ-0002jZ-67 for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2019 13:23:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53288) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i07qZ-0002jJ-2E for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2019 13:23:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i07qY-0005WZ-76 for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2019 13:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Aug 2019 17:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5126 X-GNU-PR-Package: emacs Original-Received: via spool by 5126-submit@debbugs.gnu.org id=B5126.156632172621161 (code B ref 5126); Tue, 20 Aug 2019 17:23:02 +0000 Original-Received: (at 5126) by debbugs.gnu.org; 20 Aug 2019 17:22:06 +0000 Original-Received: from localhost ([127.0.0.1]:33876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i07pe-0005VF-G0 for submit@debbugs.gnu.org; Tue, 20 Aug 2019 13:22:06 -0400 Original-Received: from mail-qk1-f170.google.com ([209.85.222.170]:39174) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i07pb-0005Uk-F1 for 5126@debbugs.gnu.org; Tue, 20 Aug 2019 13:22:04 -0400 Original-Received: by mail-qk1-f170.google.com with SMTP id 125so5154688qkl.6 for <5126@debbugs.gnu.org>; Tue, 20 Aug 2019 10:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Qwm4ci/Foulcq5v8yEBj13m3mSgO+LftqScHAAyTcEE=; b=bM3EkHBNR2JTWSAIvuCQAZwYqBje5Dcjnl4rZmw5o4nGNMh/CM9TCCNl9zOR7zet1g pWXTkmt4v0bQLs+ON8LjYafn2XtZksHc81sNi/oaHvU/qK9/wJ+fIdaV7iE8E0vs5TD2 ixO2UcCkTXLBQiABbMOujFVdii9ijg2iO3kBpd+/Ijh7zRNjyVWgM5XVPoX60DiHCiZD utdFfRv7Liq7d+1PhUfohIE93PyJmisusk2KaFw1YO4j+SHF13Y2Oy1NMH0opWWcciuC udG85vgNbqb6+cP2rd59LBvnCzGvOCHQbzWrPRZqntzgeb8CLzsrV0uU4f4P1QJwkFCV cwTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Qwm4ci/Foulcq5v8yEBj13m3mSgO+LftqScHAAyTcEE=; b=LYcaiHs92fbrSRtoE4SmDpG9OO42BVWr45y+6w0kw2RgrhjGvvOBmQ+OtaXRDds0yT QnetKjyz6fQUJpBA+BO5b8/3J9JE4yczLIm81RAzsrhlOSFgptH3GA8+2X6/kw0IDWUN RM3BjgmARCeA4iqSNkxzfskzsH3qnPlUA2aC+lgHPiNZ2njD0euhjzsLZSGtFWOnhKb3 ElZp1v+HGHrqVpv0SENzetu5ofv5qJTlMCA0OGsZKFp7tE8rtPkul5MkzQjwzD8ECY6A O9wr9b7sjgXLx1S6P+pbDdnvNeL2NzMe9ImAW+tSpiiZs7l6Cm8KvbDN4dcHSDHBD5T4 TBqg== X-Gm-Message-State: APjAAAW3y66Qwg0G6qM3e5dSljB1DXgbR6CVdkbJcC/BFgVRXlxBdC1l 2iIICJG6zrag4TyYyoFhvOmXP2WNoYa+4MC56FY= X-Google-Smtp-Source: APXvYqxn8G5XAwoQRNfB7ULszCftl5k+QMDn1lXBXFqVRp1h6xNdeimpDp0TNV7LSKd0RtRZ0BKAZNySqaMT6cALz2o= X-Received: by 2002:a37:5fc6:: with SMTP id t189mr26745652qkb.483.1566321717762; Tue, 20 Aug 2019 10:21:57 -0700 (PDT) In-Reply-To: <87sgq0ly7z.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165429 Archived-At: --0000000000009760d705908fb156 Content-Type: text/plain; charset="UTF-8" The bug report is saying that not all checks are run. If you trace your functions you tested with and run checkdoc, you will find that foobaz is checked for but not foobar. So not all checks are run. The author of the bug wants both checked for. Maybe this bug should be a feature request instead. Or, maybe it's not a good idea to even do all the checks when only one error message will be printed. I'm not sure why the author of the bug thought this was a problem, to be honest. If someone understands what the benefit would be of running all checks, please share that info. Otherwise, I'm happy to close this bug in a few weeks if we don't hear anything. On Fri, Aug 16, 2019 at 3:14 PM Alex Branham wrote: > On Sat 09 Jul 2016 at 09:27, Andrew Hyatt wrote: > > > This still is the case in Emacs 25. I agree that this seems like a > > problem. > > > > Kevin Ryde writes: > > > >> checkdoc-comment-style-hooks is run by checkdoc-file-comments-engine > >> with run-hook-with-args-until-success, which means if one of the hook > >> functions returns an error string (as described in the hook's docstring) > >> then no further functions are run. > > Maybe I'm misunderstanding this bug report, but this works for me: > > ;; foobar > (defun my/checkdoc-comments-foobar () > "Check if foobar is in a comment." > (save-excursion > (goto-char (point-min)) > (unless (re-search-forward "^;; foobar" nil t) > (checkdoc-create-error > ";; foobar doesn't exist" > (1- (point-max)) (point-max))))) > > (defun my/checkdoc-comments-foobaz () > "Check if foobaz is in a comment." > (save-excursion > (goto-char (point-min)) > (unless (re-search-forward "^;; foobaz" nil t) > (checkdoc-create-error > ";; foobaz doesn't exist" > (1- (point-max)) (point-max))))) > > (add-hook 'checkdoc-comment-style-functions #'my/checkdoc-comments-foobar) > (add-hook 'checkdoc-comment-style-functions #'my/checkdoc-comments-foobaz) > > Now checkdoc warns that foobaz is missing. You can change foobar to > foobaz and it warns that foobar is missing. Can we close this bug report? > > Alex > --0000000000009760d705908fb156 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The bug report is saying that not all checks are run. If y= ou trace your
functions you tested with and run checkdoc, you will find = that foobaz is
checked for but not foobar. So not all checks are run. Th= e author of the
bug wants both checked for.

Maybe this bug should= be a feature request instead.

Or, maybe it's not a good idea to= even do all the checks when only one
error message will be printed.=C2= =A0 I'm not sure why the author of the bug
thought this was a proble= m, to be honest.

If someone understands what the ben= efit would be of running
all checks, please share that info.=C2= =A0 Otherwise, I'm happy to close this
bug in a few weeks if = we don't hear anything.

On Fri, Aug 16, 2019 at 3:14 PM Alex Branh= am <alex.branham@gmail.com= > wrote:
On S= at 09 Jul 2016 at 09:27, Andrew Hyatt <ahyatt@gmail.com> wrote:

> This still is the case in Emacs 25. I agree that this seems like a
> problem.
>
> Kevin Ryde <= user42@zip.com.au> writes:
>
>> checkdoc-comment-style-hooks is run by checkdoc-file-comments-engi= ne
>> with run-hook-with-args-until-success, which means if one of the h= ook
>> functions returns an error string (as described in the hook's = docstring)
>> then no further functions are run.

Maybe I'm misunderstanding this bug report, but this works for me:

;; foobar
(defun my/checkdoc-comments-foobar ()
=C2=A0 "Check if foobar is in a comment."
=C2=A0 (save-excursion
=C2=A0 =C2=A0 (goto-char (point-min))
=C2=A0 =C2=A0 (unless (re-search-forward "^;; foobar" nil t)
=C2=A0 =C2=A0 =C2=A0 (checkdoc-create-error
=C2=A0 =C2=A0 =C2=A0 =C2=A0";; foobar doesn't exist"
=C2=A0 =C2=A0 =C2=A0 =C2=A0(1- (point-max)) (point-max)))))

(defun my/checkdoc-comments-foobaz ()
=C2=A0 "Check if foobaz is in a comment."
=C2=A0 (save-excursion
=C2=A0 =C2=A0 (goto-char (point-min))
=C2=A0 =C2=A0 (unless (re-search-forward "^;; foobaz" nil t)
=C2=A0 =C2=A0 =C2=A0 (checkdoc-create-error
=C2=A0 =C2=A0 =C2=A0 =C2=A0";; foobaz doesn't exist"
=C2=A0 =C2=A0 =C2=A0 =C2=A0(1- (point-max)) (point-max)))))

(add-hook 'checkdoc-comment-style-functions #'my/checkdoc-comments-= foobar)
(add-hook 'checkdoc-comment-style-functions #'my/checkdoc-comments-= foobaz)

Now checkdoc warns that foobaz is missing. You can change foobar to
foobaz and it warns that foobar is missing. Can we close this bug report?
Alex
--0000000000009760d705908fb156--