fix(emacs/lean-flycheck.el): use flycheck-increment-error-columns instead of advice
Comment from @lunaryorn (flycheck author): "Please don't use an advice to increment error columns. Flycheck has :error-filters and there is even a built-in one exactly for your use case: :error-filter flycheck-increment-error-columsn. Generally never use advises at all in libraries or modes. They are for user configuration, or as a very last resort only."
This commit is contained in:
parent
ac04b996ab
commit
ce10d5ca08
1 changed files with 4 additions and 10 deletions
|
@ -45,6 +45,10 @@
|
|||
(minimal-match
|
||||
(message (one-or-more (zero-or-more not-newline) (? "\r") "\n")))
|
||||
"FLYCHECK_END" (? "\r") line-end))
|
||||
:error-filter
|
||||
'(lambda (errors)
|
||||
(flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
|
||||
:modes '(lean-mode))
|
||||
(add-to-list 'flycheck-checkers 'lean-checker))
|
||||
|
||||
(defun lean-flycheck-turn-on ()
|
||||
|
@ -69,15 +73,6 @@
|
|||
(lean-flycheck-turn-off)
|
||||
(lean-flycheck-turn-on)))
|
||||
|
||||
(eval-after-load "flycheck"
|
||||
'(defadvice flycheck-try-parse-error-with-pattern
|
||||
(after lean-flycheck-try-parse-error-with-pattern activate)
|
||||
"Add 1 to error-column."
|
||||
(let* ((err ad-return-value)
|
||||
(col (and err (flycheck-error-column err))))
|
||||
(when (and (string= major-mode "lean-mode") col)
|
||||
(setf (flycheck-error-column ad-return-value) (1+ col))))))
|
||||
|
||||
(defun lean-flycheck-delete-temporaries ()
|
||||
"Delete temporaries files generated by flycheck."
|
||||
(when (eq major-mode 'lean-mode)
|
||||
|
@ -92,7 +87,6 @@
|
|||
(tempfiles (--map (concat tempfile it) exts)))
|
||||
(mapc #'flycheck-safe-delete tempfiles))))
|
||||
|
||||
|
||||
(defun lean-flycheck-error-list-buffer-width ()
|
||||
"Return the width of flycheck-error list buffer"
|
||||
(interactive)
|
||||
|
|
Loading…
Reference in a new issue