flycheck / flycheck-inline

Display Flycheck errors inline
GNU General Public License v3.0
139 stars 10 forks source link

Should flycheck-inline-mode be buffer-local rather than global? #8

Closed holtzermann17 closed 5 years ago

holtzermann17 commented 6 years ago

Use case: Suppose someone wants to use flycheck-inline with Lean mode, but not with Haskell. However, they want to use flycheck in both modes.

In order to configure flycheck-inline for use with Lean, they should run

(with-eval-after-load 'flycheck
  (flycheck-inline-mode))

and define flycheck-inline-display-function. But the call to flycheck-inline-mode indicated above turns it on even for Haskell mode buffers.

While it's possible to turn off flycheck on a per-mode basis, no similar facility exists for flycheck-inline-mode.

fmdkdd commented 6 years ago

Good point. According to the manual, using define-global-minor-mode would be a good way to do it. It would let us activate flycheck-inline globally, and still be able to disable it locally.

fmdkdd commented 6 years ago

Ah, we probably want to make flycheck-display-errors-function buffer-local as well.

fmdkdd commented 6 years ago

@holtzermann17 You can try the patch at #9 and see if that works for you. You should be able to use global-flycheck-inline-mode to turn on the mode globally and disable it for some major modes by adding (flycheck-inline-mode -1) to that major mode hook.

holtzermann17 commented 6 years ago

Thanks I'll try it and report back!