flycheck / flycheck

On the fly syntax checking for GNU Emacs
https://www.flycheck.org
GNU General Public License v3.0
2.4k stars 449 forks source link

Proselint will lint src blocks in org-mode #1893

Open johnhamelink opened 3 years ago

johnhamelink commented 3 years ago

Thank you for taking the time to report an issue and improve Flycheck. This template is for actual bugs you observed. If you have trouble setting up Flycheck, or if you have a question, please use the relevant issue template instead.

Checklist

Bug description

When I open an org-mode file with a source block in it, proselint checks the content of the source block as if it was text.

Steps to reproduce

Run emacs with the init file below:

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(setq package-enable-at-startup nil)
(setq straight-use-package-by-default t)

;; Install use-package
(straight-use-package 'use-package)

;; flycheck
;; ========================================
(use-package flycheck
  :ensure t

  :init
  (global-flycheck-mode)

  :config
  (setq
   flycheck-idle-change-delay .3
   flycheck-display-errors-delay .3
   flycheck-idle-buffer-switch-delay .3
   flycheck-checker-error-threshold 500))

Then open the following org-mode file, and look at the flycheck errors list:

lorem ipsum dolor sit amet.

#+begin_src emacs-lisp
       (use-package mu4e
       :after (:all hydra general)
       :commands mu4e mu4e-compose-new)
#+end_src

Expected behavior

I would expect flycheck to understand that the contents of a source code block is not free-text, and so flycheck should handle the contents of it as it would a buffer.

Screenshots

29-07-2021 11:01:11

System configuration

Syntax checkers for buffer example.org in org-mode:

First checker to run:

  proselint
    - may enable: yes
    - executable: Found at /usr/bin/proselint

Checkers that are compatible with this mode, but will not run until properly configured:

  textlint (automatically disabled) reset
    - may enable:         no
    - executable:         Not found
    - configuration file: Not found
    - textlint plugin:    @textlint/text

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.

--------------------

Flycheck version: 32snapshot
Emacs version:    28.0.50
System:           x86_64-pc-linux-gnu
Window system:    pgtk

Emacs configuration:

cpitclaudel commented 3 years ago

Flycheck doesn't do anything smart: it just calls proselint on the whole buffer. If proselint doesn't understand ORG, then there's not much we can do to help it.

RlckAstley commented 1 year ago

@johnhamelink did you make any progress on this? Guessing it should be possible to just write some kind of skip condition for lines beginning with comment prefix #.

johnhamelink commented 1 year ago

@RlckAstley I ended up moving to flymake-vale. Since vale supports org syntax, it didn't take a lot for me to add support to it.

RlckAstley commented 12 months ago

@johnhamelink Ah nice, I might try to finish my pull then see if I like that more