aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Steingold2017-11-01 09:36:41 -0400
committerSam Steingold2017-11-01 09:36:54 -0400
commit934a72c7e4a506a36697fdb98f837cea989e70e1 (patch)
treeb5827a305b64ca66758c79755faf8e5d7be0410f
parent33f08a38478150fef3fcfb13ad31da2d00327a01 (diff)
downloademacs-934a72c7e4a506a36697fdb98f837cea989e70e1.tar.gz
emacs-934a72c7e4a506a36697fdb98f837cea989e70e1.zip
User can specify files never subject to flymake.
* lisp/progmodes/flymake-proc.el (flymake-proc-ignored-file-name-regexps): Add user customization option. (flymake-proc--get-file-name-mode-and-masks): Check it before `flymake-proc-allowed-file-name-masks'.
-rw-r--r--lisp/progmodes/flymake-proc.el33
1 files changed, 24 insertions, 9 deletions
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index a9caef4fc8e..359cffd797e 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -41,6 +41,8 @@
41 41
42;;; Code: 42;;; Code:
43 43
44(require 'cl-lib)
45
44(require 'flymake) 46(require 'flymake)
45 47
46(defcustom flymake-proc-compilation-prevents-syntax-check t 48(defcustom flymake-proc-compilation-prevents-syntax-check t
@@ -65,6 +67,13 @@
65 :group 'flymake 67 :group 'flymake
66 :type 'integer) 68 :type 'integer)
67 69
70(defcustom flymake-proc-ignored-file-name-regexps '()
71 "Files syntax checking is forbidden for.
72Overrides `flymake-proc-allowed-file-name-masks'."
73 :group 'flymake
74 :type '(repeat (regexp))
75 :version "27.1")
76
68(defcustom flymake-proc-allowed-file-name-masks 77(defcustom flymake-proc-allowed-file-name-masks
69 '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" 78 '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'"
70 flymake-proc-simple-make-init 79 flymake-proc-simple-make-init
@@ -91,6 +100,7 @@
91 ;; ("\\.tex\\'" 1) 100 ;; ("\\.tex\\'" 1)
92 ) 101 )
93 "Files syntax checking is allowed for. 102 "Files syntax checking is allowed for.
103Variable `flymake-proc-ignored-file-name-regexps' overrides this variable.
94This is an alist with elements of the form: 104This is an alist with elements of the form:
95 REGEXP INIT [CLEANUP [NAME]] 105 REGEXP INIT [CLEANUP [NAME]]
96REGEXP is a regular expression that matches a file name. 106REGEXP is a regular expression that matches a file name.
@@ -188,17 +198,22 @@ expression. A match indicates `:warning' type, otherwise
188 :error))) 198 :error)))
189 199
190(defun flymake-proc--get-file-name-mode-and-masks (file-name) 200(defun flymake-proc--get-file-name-mode-and-masks (file-name)
191 "Return the corresponding entry from `flymake-proc-allowed-file-name-masks'." 201 "Return the corresponding entry from `flymake-proc-allowed-file-name-masks'.
202If the FILE-NAME matches a regexp from `flymake-proc-ignored-file-name-regexps',
203`flymake-proc-allowed-file-name-masks' is not searched."
192 (unless (stringp file-name) 204 (unless (stringp file-name)
193 (error "Invalid file-name")) 205 (error "Invalid file-name"))
194 (let ((fnm flymake-proc-allowed-file-name-masks) 206 (if (cl-find file-name flymake-proc-ignored-file-name-regexps
195 (mode-and-masks nil)) 207 :test (lambda (fn rex) (string-match rex fn)))
196 (while (and (not mode-and-masks) fnm) 208 (flymake-log 3 "file %s ignored")
197 (if (string-match (car (car fnm)) file-name) 209 (let ((fnm flymake-proc-allowed-file-name-masks)
198 (setq mode-and-masks (cdr (car fnm)))) 210 (mode-and-masks nil))
199 (setq fnm (cdr fnm))) 211 (while (and (not mode-and-masks) fnm)
200 (flymake-log 3 "file %s, init=%s" file-name (car mode-and-masks)) 212 (if (string-match (car (car fnm)) file-name)
201 mode-and-masks)) 213 (setq mode-and-masks (cdr (car fnm))))
214 (setq fnm (cdr fnm)))
215 (flymake-log 3 "file %s, init=%s" file-name (car mode-and-masks))
216 mode-and-masks)))
202 217
203(defun flymake-proc--get-init-function (file-name) 218(defun flymake-proc--get-init-function (file-name)
204 "Return init function to be used for the file." 219 "Return init function to be used for the file."