bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5126: 23.1; checkdoc-comment-style-hooks stops at first error


From: Alex Branham
Subject: bug#5126: 23.1; checkdoc-comment-style-hooks stops at first error
Date: Fri, 16 Aug 2019 14:14:08 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Sat 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-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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]