[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master de3a3ed 1/2: allow nil init in flymake-allowed-file
From: |
Sam Steingold |
Subject: |
[Emacs-diffs] master de3a3ed 1/2: allow nil init in flymake-allowed-file-name-masks to disable flymake |
Date: |
Mon, 21 Aug 2017 09:50:45 -0400 (EDT) |
branch: master
commit de3a3ed034467ff2529c8262600e8a249969fd14
Author: Sam Steingold <address@hidden>
Commit: Sam Steingold <address@hidden>
allow nil init in flymake-allowed-file-name-masks to disable flymake
(flymake-allowed-file-name-masks): Update doc and :type.
(flymake-get-file-name-mode-and-masks): Handle nil init.
---
lisp/progmodes/flymake-proc.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 3055555..af16e52 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -85,16 +85,18 @@
)
"Files syntax checking is allowed for.
This is an alist with elements of the form:
- REGEXP INIT [CLEANUP [NAME]]
+ REGEXP [INIT [CLEANUP [NAME]]]
REGEXP is a regular expression that matches a file name.
-INIT is the init function to use.
+INIT is the init function to use, missing means disable `flymake-mode'.
CLEANUP is the cleanup function to use, default `flymake-simple-cleanup'.
NAME is the file name function to use, default `flymake-get-real-file-name'."
:group 'flymake
:type '(alist :key-type (regexp :tag "File regexp")
:value-type
(list :tag "Handler functions"
- (function :tag "Init function")
+ (choice :tag "Init function"
+ (const :tag "disable" nil)
+ function)
(choice :tag "Cleanup function"
(const :tag "flymake-simple-cleanup" nil)
function)
@@ -114,9 +116,10 @@ NAME is the file name function to use, default
`flymake-get-real-file-name'."
(let ((fnm flymake-allowed-file-name-masks)
(mode-and-masks nil))
(while (and (not mode-and-masks) fnm)
- (if (string-match (car (car fnm)) file-name)
- (setq mode-and-masks (cdr (car fnm))))
- (setq fnm (cdr fnm)))
+ (let ((item (pop fnm)))
+ (when (string-match (car item) file-name)
+ (setq mode-and-masks item)))) ; (cdr item) may be nil
+ (setq mode-and-masks (cdr mode-and-masks))
(flymake-log 3 "file %s, init=%s" file-name (car mode-and-masks))
mode-and-masks))