I've got a heap of org-mode files which I publish into HTML for a knowledge base, sometimes the publishing crashes out due to a broken link or something and it's hard to find the problem.

I've been recently using org-lint to find the problems. Is there a way to run this automatically through flycheck?

  • 1
    why not run it via org-export-before-processing-hook? I think to use flycheck you need an external program for linting. It looks like it might be possible to write elisp functions in flycheck-define-generic-checker that would work with org-lint and do what you want in flycheck. Commented Dec 22, 2016 at 18:41
  • Maybe running it before you export would be good enough? If you check every time you save it would be too expensive.
    – xji
    Commented Jan 6, 2017 at 17:05
  • @JohnKitchin: External programs are common but not needed, though in this case the natural external program to run would be emacs itself :)
    – Clément
    Commented May 6, 2020 at 13:14

1 Answer 1


I tried to restrict the linting to one checker with (org-lint '(link-to-local-file)), however the parsing is still going to induce a noticable delay. Maybe limiting the linter to the current subtree or using the async library can improve the performance. Anyways, below is a rather simple flycheck setup for org-lint:

(flycheck-define-generic-checker 'org-lint
  "Syntax checker for org-lint."
  :start 'flycheck-org-lint-start
  :modes '(org-mode))

(defun flycheck-org-lint-start (checker callback)
     callback 'finished
        (lambda (err)
          (goto-char (car err))
           (org-current-line) (1+ (current-column))
           'warning (cadr err) :checker checker))
        (org-lint-link-to-local-file (org-element-parse-buffer))))))

(add-to-list 'flycheck-checkers 'org-lint)
  • 1
    I get this error when using this code; Error while checking syntax automatically: (void-function org-lint-link-to-local-file). I had to change that line to (org-lint '(link-to-local-file)) and it works. Thanks
    – map7
    Commented Jan 13, 2017 at 3:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.