Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
marvel
GitHub Repository: marvel/qnf
Path: blob/master/elisp/emacs-for-python/flymake/python-flymake.el
990 views
1
;; Flymake configuration with python
2
(require 'tramp)
3
4
(when (load "flymake-patch" t)
5
(defun flymake-pyflakes-init ()
6
;; Pyflakes stuff
7
; Make sure it's not a remote buffer or flymake would not work
8
(when (not (subsetp (list (current-buffer)) (tramp-list-remote-buffers)))
9
(let* ((temp-file (flymake-init-create-temp-buffer-copy
10
'flymake-create-temp-inplace))
11
(local-file (file-relative-name
12
temp-file
13
(file-name-directory buffer-file-name))))
14
(list "pyflakes" (list local-file)))))
15
16
17
(defun flymake-pep8-init ()
18
;; Pyflakes stuff
19
; Make sure it's not a remote buffer or flymake would not work
20
(when (not (subsetp (list (current-buffer)) (tramp-list-remote-buffers)))
21
(let* ((temp-file (flymake-init-create-temp-buffer-copy
22
'flymake-create-temp-inplace))
23
(local-file (file-relative-name
24
temp-file
25
(file-name-directory buffer-file-name))))
26
(list "pep8" (list local-file)))))
27
28
29
(add-to-list 'flymake-allowed-file-name-masks
30
'("\\.py\\'" flymake-pyflakes-init)))
31
32
;; Adding to the variable the regexps that matches warning messages
33
;;(setq flymake-log-level 3)
34
35
(setq flymake-info-line-regex
36
(append flymake-info-line-regex '("unused$" "^redefinition" "used$")))
37
38
39
40
;; Not on all modes, please
41
(add-hook 'python-mode-hook 'flymake-find-file-hook)
42
43
(provide 'python-flymake)
44
45