11; ;; flymake-quicklintjs.el --- Flymake support for quick-lint-js -*- lexical-binding : t ; -*-
22
3+ ; ; Copyright (C) 2020 Matthew "strager" Glazar
4+
5+ ; ; Version: 0.0.1
6+ ; ; Author: Wagner Riffel <w@104d.net>
7+ ; ; URL: https://quick-lint-js.com
8+ ; ; Keywords: languages, tools
9+ ; ; Package-Requires: ((quicklintjs "0.0.1") (flymake "1.0.9") (emacs "26.1"))
10+
11+ ; ; This file is part of quick-lint-js.
12+ ; ;
13+ ; ; quick-lint-js is free software: you can redistribute it and/or modify
14+ ; ; it under the terms of the GNU General Public License as published by
15+ ; ; the Free Software Foundation, either version 3 of the License, or
16+ ; ; (at your option) any later version.
17+ ; ;
18+ ; ; quick-lint-js is distributed in the hope that it will be useful,
19+ ; ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20+ ; ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+ ; ; GNU General Public License for more details.
22+ ; ;
23+ ; ; You should have received a copy of the GNU General Public License
24+ ; ; along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.
25+
326; ;; Commentary:
427
528; ; Flymake support for quick-lint-js.
1437; ; ;; Enable Flymake
1538; ; (unless (bound-and-true-p flymake-mode)
1639; ; (flymake-mode))
17- ; ; (add-hook 'flymake-diagnostic-functions #'flymake-quicklintjs nil t)
1840; ;
1941; ; ;; Remove the time to wait after last change before automatically checking
2042; ; ;; buffer. The default is 0.5 (500ms)
@@ -43,8 +65,9 @@ Return a list of Flymake diagnostic objects in source buffer SRC-BUF."
4365(defun flymake-quicklintjs--report-with-crash (qljs-stdout-buf
4466 qljs-stderr-buf
4567 src-buf report-fn )
46- " Similar to `flymake-quicklintjs--report' but tries to recover errors from
47- quick-lint-js crashes and logs whatever is in QLJS-STDERR-BUF"
68+ " Similar to `flymake-quicklintjs--report' but try to recover errors in\
69+ SRC-BUF when quick-lint-js crashes by inspecting QLJS-STDOUT-BUF.
70+ Whatever is in QLJS-STDERR-BUF is also logged as warning using `flymake-log' ."
4871 (flymake-log :warning
4972 " quick-lint-js exited with a deadly signal.\n \
5073Please consider filing a bug at\
@@ -70,7 +93,7 @@ qjls-stderr-buf:\n\
7093 (funcall report-fn '())))
7194
7295(defun flymake-quicklintjs--report (qljs-stdout-buf src-buf report-fn )
73- " Call REPORT-FN to highlight reports in SRC_BUF reported in QLJS-STDOUT-BUF.
96+ " Call REPORT-FN to highlight reports in SRC-BUF reported in QLJS-STDOUT-BUF.
7497QLJS-STDOUT-BUF is entirely read and it's expected to be in
7598QUICKLINTJS-OUTPUT-ALIST format."
7699 (with-current-buffer qljs-stdout-buf
@@ -124,24 +147,10 @@ REPORT-FN is Flymake's callback."
124147 (process-send-region flymake-quicklintjs--proc (point-min ) (point-max ))
125148 (process-send-eof flymake-quicklintjs--proc))))
126149
127- (provide 'flymake-quicklintjs )
150+ ;;;### autoload
151+ (with-eval-after-load 'flymake
152+ (add-hook 'flymake-diagnostic-functions #'flymake-quicklintjs nil t ))
128153
129- ; ; quick-lint-js finds bugs in JavaScript programs.
130- ; ; Copyright (C) 2020 Matthew Glazar
131- ; ;
132- ; ; This file is part of quick-lint-js.
133- ; ;
134- ; ; quick-lint-js is free software: you can redistribute it and/or modify
135- ; ; it under the terms of the GNU General Public License as published by
136- ; ; the Free Software Foundation, either version 3 of the License, or
137- ; ; (at your option) any later version.
138- ; ;
139- ; ; quick-lint-js is distributed in the hope that it will be useful,
140- ; ; but WITHOUT ANY WARRANTY; without even the implied warranty of
141- ; ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142- ; ; GNU General Public License for more details.
143- ; ;
144- ; ; You should have received a copy of the GNU General Public License
145- ; ; along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.
154+ (provide 'flymake-quicklintjs )
146155
147156; ;; flymake-quicklintjs.el ends here
0 commit comments