Skip to content

Commit 10c9a49

Browse files
committed
For [GH #180] - more workarounds
1 parent b987e74 commit 10c9a49

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

elisp/yatt-lint-any-mode.el

+25-19
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,21 @@
4545
To disable, set to nil.")
4646

4747
(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))
5857

5958
(defun yatt-lint-any-mode-unless-blacklisted ()
6059
(cond ((not (yatt-lint-any-mode-blacklistp))
6160
(yatt-lint-any-mode t))
6261
(yatt-lint-any-mode
63-
(yatt-lint-any-mode nil))))
62+
(yatt-lint-any-mode -1))))
6463

6564
(defvar yatt-lint-any-mode-map (make-sparse-keymap))
6665
(define-key yatt-lint-any-mode-map [f5] 'yatt-lint-any-after)
@@ -71,21 +70,28 @@ To disable, set to nil.")
7170
:lighter "<F5 lint>"
7271
:global nil
7372
(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"))))
7578
(cond ((or (yatt-lint-any-mode-blacklistp)
7679
(and (boundp 'mmm-temp-buffer-name)
7780
(equal (buffer-name) mmm-temp-buffer-name)))
7881
(message "skipping yatt-lint-any-mode for %s" buf)
7982
nil)
8083
(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))
8587
(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))))
8995
(t
9096
(message "disabling yatt-lint-any-mode for %s" buf)
9197
(remove-hook hook fn nil)))))

0 commit comments

Comments
 (0)