45
45
To disable, set to nil." )
46
46
47
47
(defun yatt-lint-any-mode-blacklistp ()
48
- (let ((ok t ) (lst yatt-lint-any-mode-blacklist)
49
- i)
50
- (while (and ok lst)
51
- (setq i (car lst))
52
- (setq ok (and ok (not (cond ((and (symbolp i) (boundp i))
53
- (symbol-value i))
54
- ((listp i)
55
- (funcall i))
56
- (t nil )))))
57
- (setq lst (cdr lst)))))
48
+ (cl-some (lambda (i )
49
+ (cond ((and (symbolp i))
50
+ (and (boundp i)
51
+ (symbol-value i)))
52
+ ((listp i)
53
+ (funcall i))
54
+ (t
55
+ (error " Unknown type blacklist item: %s " i))))
56
+ yatt-lint-any-mode-blacklist))
58
57
59
58
(defun yatt-lint-any-mode-unless-blacklisted ()
60
59
(cond ((not (yatt-lint-any-mode-blacklistp))
61
60
(yatt-lint-any-mode t ))
62
61
(yatt-lint-any-mode
63
- (yatt-lint-any-mode nil ))))
62
+ (yatt-lint-any-mode -1 ))))
64
63
65
64
(defvar yatt-lint-any-mode-map (make-sparse-keymap ))
66
65
(define-key yatt-lint-any-mode-map [f5] 'yatt-lint-any-after )
@@ -71,21 +70,28 @@ To disable, set to nil.")
71
70
:lighter " <F5 lint>"
72
71
:global nil
73
72
(let ((hook 'after-save-hook ) (fn 'yatt-lint-any-after )
74
- (buf (current-buffer )))
73
+ (buf (current-buffer ))
74
+ (is-perl-minlint (and (boundp 'perl-minlint-mode ) perl-minlint-mode))
75
+ (has-app-psgi (and
76
+ (buffer-file-name (current-buffer ))
77
+ (yatt-lint-any-find-upward " app.psgi" ))))
75
78
(cond ((or (yatt-lint-any-mode-blacklistp)
76
79
(and (boundp 'mmm-temp-buffer-name )
77
80
(equal (buffer-name ) mmm-temp-buffer-name)))
78
81
(message " skipping yatt-lint-any-mode for %s " buf)
79
82
nil )
80
83
(yatt-lint-any-mode
81
- (cond ((and (boundp 'perl-minlint-mode )
82
- perl-minlint-mode)
83
- (message " Use yatt-lint-any-mode instead of perl-minlint-mode for %s " buf)
84
- (perl-minlint-mode -1 ))
84
+ (cond ((and is-perl-minlint (not has-app-psgi))
85
+ (message " Disable yatt-lint-any-mode since perl-minlint-mode is enabled and app.psgi is missing " )
86
+ (yatt-lint-any-mode -1 ))
85
87
(t
86
- (message " enabling yatt-lint-any-mode for %s " buf)))
87
- (add-hook hook fn nil nil )
88
- (make-variable-buffer-local 'yatt-lint-any-driver-path ))
88
+ (cond (is-perl-minlint
89
+ (message " Use yatt-lint-any-mode instead of perl-minlint-mode for %s " buf)
90
+ (perl-minlint-mode -1 ))
91
+ (t
92
+ (message " enabling yatt-lint-any-mode for %s " buf)))
93
+ (add-hook hook fn nil nil )
94
+ (make-variable-buffer-local 'yatt-lint-any-driver-path ))))
89
95
(t
90
96
(message " disabling yatt-lint-any-mode for %s " buf)
91
97
(remove-hook hook fn nil )))))
0 commit comments