Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
Switch from flycheck to flymake (but with flymake-flycheck)
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Mar 13, 2022
1 parent 86d99e3 commit 7c58616
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 23 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ in the approximate order of how much I use them, from most to least:

In particular, there's a nice config for *autocompletion* with
[company](https://company-mode.github.io/), and
[flycheck](http://www.flycheck.org) is used to immediately highlight
syntax errors in Ruby, Python, Javascript, Haskell and a number of
other languages.
`flymake` (re-using backends from [flycheck](http://www.flycheck.org))
is used to immediately highlight syntax errors in Ruby, Python,
Javascript, Haskell and a number of other languages.

## Supported Emacs versions

Expand Down
2 changes: 1 addition & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
(require 'init-grep)
(require 'init-uniquify)
(require 'init-ibuffer)
(require 'init-flycheck)
(require 'init-flymake)

(require 'init-recentf)
(require 'init-minibuffer)
Expand Down
14 changes: 0 additions & 14 deletions lisp/init-flycheck.el

This file was deleted.

41 changes: 41 additions & 0 deletions lisp/init-flymake.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
;;; init-flymake.el --- Configure Flymake global behaviour -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(with-eval-after-load 'flymake
(defun sanityinc/eldoc-flymake-first ()
"Gives flymake's eldoc function priority in the minibuffer."
(when flymake-mode
(setq-local eldoc-documentation-functions
(cons 'flymake-eldoc-function
(delq 'flymake-eldoc-function eldoc-documentation-functions)))))

(add-hook 'flymake-mode-hook 'sanityinc/eldoc-flymake-first))


;; Use flycheck checkers with flymake, to extend its coverage
(when (maybe-require-package 'flymake-flycheck)
;; Disable flycheck checkers for which we have flymake equivalents
(with-eval-after-load 'flycheck
(setq-default flycheck-disabled-checkers
(append (default-value 'flycheck-disabled-checkers)
'(emacs-lisp emacs-lisp-checkdoc emacs-lisp-package))))

(defun sanityinc/enable-flymake-flycheck ()
(setq-local flymake-diagnostic-functions
(append flymake-diagnostic-functions
(flymake-flycheck-all-chained-diagnostic-functions))))

(add-hook 'flymake-mode-hook 'sanityinc/enable-flymake-flycheck)
(add-hook 'prog-mode-hook 'flymake-mode)
(add-hook 'text-mode-hook 'flymake-mode))

(with-eval-after-load 'flymake
;; Provide some flycheck-like bindings in flymake mode to ease transition
(define-key flymake-mode-map (kbd "C-c ! n") 'flymake-goto-next-error)
(define-key flymake-mode-map (kbd "C-c ! p") 'flymake-goto-prev-error)
(define-key flymake-mode-map (kbd "C-c ! c") 'flymake-start))


(provide 'init-flymake)
;;; init-flymake.el ends here
7 changes: 2 additions & 5 deletions lisp/init-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,8 @@ there is no current file, eval the current buffer."
(add-hook 'emacs-lisp-mode-hook 'highlight-quoted-mode))


(when (maybe-require-package 'flycheck)
(require-package 'flycheck-package)
(with-eval-after-load 'flycheck
(with-eval-after-load 'elisp-mode
(flycheck-package-setup))))
(when (maybe-require-package 'package-lint-flymake)
(add-hook 'emacs-lisp-mode-hook #'package-lint-flymake-setup))



Expand Down

0 comments on commit 7c58616

Please sign in to comment.