-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathepc-flycheck.el
More file actions
47 lines (40 loc) · 1.4 KB
/
epc-flycheck.el
File metadata and controls
47 lines (40 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
;;; -*- coding: utf-8; lexical-binding: t -*-
;;; Author: ywatanabe
;;; Timestamp: <2025-04-24 14:01:06>
;;; File: /home/ywatanabe/.emacs.d/lisp/emacs-python-config/epc-flycheck.el
;;; Copyright (C) 2025 Yusuke Watanabe (ywatanabe@alumni.u-tokyo.ac.jp)
(require 'flycheck)
(defun epc-flycheck-in-region (region-start region-end)
"Check for Flycheck errors in the specified region."
(let* ((only-errors
(seq-filter
(lambda (err)
(eq (flycheck-error-level err) 'error))
flycheck-current-errors))
(errors-in-region
(seq-filter
(lambda (err)
(let ((err-start (flycheck-error-pos err)))
(and (>= err-start region-start)
(<= err-start region-end))))
only-errors)))
errors-in-region))
(defun epc-flycheck-move-next-error-cyclic ()
"Move to next Flycheck error cyclically in buffer."
(interactive)
(condition-case nil
(flycheck-next-error)
(error
(goto-char (point-min))
(flycheck-next-error))))
(defun epc-flycheck-setup ()
"Configure flycheck for Python."
(setq-default flycheck-disabled-checkers
epc-disabled-checkers)
(add-to-list 'flycheck-checkers 'python-flake8))
(provide 'epc-flycheck)
(when
(not load-file-name)
(message "epc-flycheck.el loaded."
(file-name-nondirectory
(or load-file-name buffer-file-name))))