When editing Emacs Lisp source blocks in org-mode via org-src-edit, if flycheck is enabled (which I'd like to keep that way) checkdoc rather annoyingly remarks that I'm missing headers and footers and commentaries and whatnot. In checkdoc itself, it seems that if the buffer has a name, it's going to get checked for commentary:

    (or (and buffer-file-name ;; only check comments in a file

So checkdoc-comments does a couple of useful things, and I'd be sad to see it go entirely, but it's gotta go. I thought some advice could help:

(define-advice checkdoc-comments (:around (original))
  (unless (org-src-edit-buffer-p)
    (funcall original)))

(A better version might filter out the offending errors instead of not checking anything, but I wanted to keep it simple.)

This works great when calling checkdoc manually via M-x checkdoc. Comments are excluded. But somehow, flycheck seems to ignore my advice. I don't understand why, as flycheck's source code doesn't seem to have a special version of checkdoc. Am I not understanding how advice is supposed to work?

Is there another way to do what I want to do?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.