-
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugin/emacs: Build and install Emacs plugins as ELPA packages
Signed-off-by: wagner riffel <[email protected]>
- Loading branch information
Showing
8 changed files
with
325 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Copyright (C) 2020 Matthew "strager" Glazar | ||
# See end of file for extended copyright information. | ||
|
||
if (QUICK_LINT_JS_EMACS) | ||
set(QUICK_LINT_JS_EMACS "${QUICK_LINT_JS_EMACS}") | ||
else () | ||
find_program(QUICK_LINT_JS_EMACS "emacs") | ||
endif () | ||
|
||
if (NOT QUICK_LINT_JS_EMACS) | ||
message(WARNING "Emacs not found. Skipping... ") | ||
return () | ||
endif () | ||
|
||
execute_process( | ||
COMMAND | ||
${QUICK_LINT_JS_EMACS} | ||
-Q -batch | ||
--eval "(princ (format \"%s.%s\" emacs-major-version emacs-minor-version))" | ||
RESULT_VARIABLE EMACS_EXIT_CODE | ||
OUTPUT_VARIABLE EMACS_VERSION) | ||
|
||
if (NOT EMACS_EXIT_CODE EQUAL 0) | ||
message(WARNING "Emacs (${QUICK_LINT_JS_EMACS}) found but can't get its version. Skipping...") | ||
return () | ||
endif() | ||
|
||
if (NOT EMACS_VERSION GREATER_EQUAL 24.5) | ||
message(WARNING "Emacs found (${QUICK_LINT_JS_EMACS}), but version ${EMACS_VERSION} is not supported. Skipping...") | ||
return () | ||
endif () | ||
|
||
set(QUICK_LINT_JS_EMACS_FOUND TRUE) | ||
message(STATUS "Found Emacs: (${QUICK_LINT_JS_EMACS}) suitable version ${EMACS_VERSION} minimum required is 24.5") | ||
|
||
macro(emacs_pkg_target NAME FILE) | ||
cmake_parse_arguments( | ||
"" | ||
"" | ||
"OUTPUT" | ||
"" | ||
${ARGN}) | ||
|
||
add_custom_command( | ||
OUTPUT ${_OUTPUT} | ||
COMMAND | ||
${QUICK_LINT_JS_EMACS} | ||
-Q -batch | ||
-l package --eval "(package-initialize)" | ||
--eval "(add-to-list 'package-directory-list \"${CMAKE_CACHEFILE_DIR}\")" | ||
-l ${CMAKE_CURRENT_LIST_DIR}/quicklintjs-pkg.el | ||
-f quicklintjs-batch-make-pkg | ||
${FILE} | ||
DEPENDS | ||
${QUICK_LINT_JS_EMACS} | ||
${CMAKE_CURRENT_LIST_DIR}/quicklintjs-pkg.el | ||
${FILE} | ||
VERBATIM) | ||
|
||
add_custom_target(${NAME} ALL DEPENDS ${_OUTPUT}) | ||
endmacro () | ||
|
||
mark_as_advanced(QUICK_LINT_JS_EMACS) | ||
|
||
# quick-lint-js finds bugs in JavaScript programs. | ||
# Copyright (C) 2020 Matthew "strager" Glazar | ||
# | ||
# This file is part of quick-lint-js. | ||
# | ||
# quick-lint-js is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# quick-lint-js is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
;;; eglot-quicklintjs.el --- Eglot support for quick-lint-js -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) 2020 Matthew "strager" Glazar | ||
|
||
;; Version: 0.0.1 | ||
;; Author: Wagner Riffel <[email protected]> | ||
;; URL: https://quick-lint-js.com | ||
;; Keywords: languages, tools | ||
;; Package-Requires: ((quicklintjs "0.0.1") (eglot "1.7") (emacs "26.1")) | ||
|
||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation, either version 3 of the License, or | ||
;; (at your option) any later version. | ||
;; | ||
;; quick-lint-js is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU General Public License | ||
;; along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; Commentary: | ||
|
||
;; Eglot support for quick-lint-js. | ||
|
@@ -21,26 +44,11 @@ | |
(require 'eglot) | ||
(require 'quicklintjs) | ||
|
||
(add-to-list 'eglot-server-programs `(js-mode . ,(quicklintjs-find-program | ||
"--lsp-server"))) | ||
(provide 'eglot-quicklintjs) | ||
;;;###autoload | ||
(with-eval-after-load 'eglot | ||
(add-to-list 'eglot-server-programs `(js-mode . ,(quicklintjs-find-program | ||
"--lsp-server")))) | ||
|
||
;; quick-lint-js finds bugs in JavaScript programs. | ||
;; Copyright (C) 2020 Matthew Glazar | ||
;; | ||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation, either version 3 of the License, or | ||
;; (at your option) any later version. | ||
;; | ||
;; quick-lint-js is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU General Public License | ||
;; along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
(provide 'eglot-quicklintjs) | ||
|
||
;;; eglot-quicklintjs.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
;;; flycheck-quicklintjs --- quick-lint-js Flycheck support -*- lexical-binding: t; -*- | ||
;;; flycheck-quicklintjs.el --- quick-lint-js Flycheck support -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) 2020 Matthew "strager" Glazar | ||
|
||
;; Version: 0.0.1 | ||
;; Author: Wagner Riffel <[email protected]> | ||
;; URL: https://quick-lint-js.com | ||
;; Keywords: languages, tools | ||
;; Package-Requires: ((quicklintjs "0.0.1") (flycheck "32-cvs") (emacs "24.5")) | ||
|
||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation, either version 3 of the License, or | ||
;; (at your option) any later version. | ||
;; | ||
;; quick-lint-js is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU General Public License | ||
;; along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; Commentary: | ||
|
||
|
@@ -38,7 +61,7 @@ | |
(require 'quicklintjs) | ||
|
||
(defun flycheck-quicklintjs-parse-errors (output checker buffer) | ||
"Parse quick-lint-js alist output format from OUTPUT" | ||
"Parse CHECKER quick-lint-js alist output format from OUTPUT." | ||
(mapcar (lambda (l) | ||
(let ((region (nth 0 l)) | ||
(sev (nth 1 l)) | ||
|
@@ -51,8 +74,10 @@ | |
:id code | ||
:buffer buffer | ||
:checker checker | ||
:end-pos (cdr region)))) (car (read-from-string output)))) | ||
:end-pos (cdr region)))) | ||
(car (read-from-string output)))) | ||
|
||
;;;###autoload | ||
(flycheck-define-command-checker 'javascript-quicklintjs | ||
"quick-lint-js finds bugs in JavaScript programs. | ||
|
@@ -70,26 +95,10 @@ https://quick-lint-js.com" | |
(and error-code `(url . ,(format url error-code))))) | ||
:modes 'js-mode) | ||
|
||
(add-to-list 'flycheck-checkers 'javascript-quicklintjs t) | ||
;;;###autoload | ||
(with-eval-after-load 'flycheck | ||
(add-to-list 'flycheck-checkers 'javascript-quicklintjs t)) | ||
|
||
(provide 'flycheck-quicklintjs) | ||
|
||
;; quick-lint-js finds bugs in JavaScript programs. | ||
;; Copyright (C) 2020 Matthew "strager" Glazar | ||
;; | ||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation, either version 3 of the License, or | ||
;; (at your option) any later version. | ||
;; | ||
;; quick-lint-js is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU General Public License | ||
;; along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; flycheck-quicklintjs.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
;;; flymake-quicklintjs.el --- Flymake support for quick-lint-js -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) 2020 Matthew "strager" Glazar | ||
|
||
;; Version: 0.0.1 | ||
;; Author: Wagner Riffel <[email protected]> | ||
;; URL: https://quick-lint-js.com | ||
;; Keywords: languages, tools | ||
;; Package-Requires: ((quicklintjs "0.0.1") (flymake "1.0.9") (emacs "26.1")) | ||
|
||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation, either version 3 of the License, or | ||
;; (at your option) any later version. | ||
;; | ||
;; quick-lint-js is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU General Public License | ||
;; along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; Commentary: | ||
|
||
;; Flymake support for quick-lint-js. | ||
|
@@ -14,7 +37,6 @@ | |
;; ;; Enable Flymake | ||
;; (unless (bound-and-true-p flymake-mode) | ||
;; (flymake-mode)) | ||
;; (add-hook 'flymake-diagnostic-functions #'flymake-quicklintjs nil t) | ||
;; | ||
;; ;; Remove the time to wait after last change before automatically checking | ||
;; ;; buffer. The default is 0.5 (500ms) | ||
|
@@ -43,8 +65,9 @@ Return a list of Flymake diagnostic objects in source buffer SRC-BUF." | |
(defun flymake-quicklintjs--report-with-crash (qljs-stdout-buf | ||
qljs-stderr-buf | ||
src-buf report-fn) | ||
"Similar to `flymake-quicklintjs--report' but tries to recover errors from | ||
quick-lint-js crashes and logs whatever is in QLJS-STDERR-BUF" | ||
"Similar to `flymake-quicklintjs--report' but try to recover errors in\ | ||
SRC-BUF when quick-lint-js crashes by inspecting QLJS-STDOUT-BUF. | ||
Whatever is in QLJS-STDERR-BUF is also logged as warning using `flymake-log'." | ||
(flymake-log :warning | ||
"quick-lint-js exited with a deadly signal.\n\ | ||
Please consider filing a bug at\ | ||
|
@@ -70,7 +93,7 @@ qjls-stderr-buf:\n\ | |
(funcall report-fn '()))) | ||
|
||
(defun flymake-quicklintjs--report (qljs-stdout-buf src-buf report-fn) | ||
"Call REPORT-FN to highlight reports in SRC_BUF reported in QLJS-STDOUT-BUF. | ||
"Call REPORT-FN to highlight reports in SRC-BUF reported in QLJS-STDOUT-BUF. | ||
QLJS-STDOUT-BUF is entirely read and it's expected to be in | ||
QUICKLINTJS-OUTPUT-ALIST format." | ||
(with-current-buffer qljs-stdout-buf | ||
|
@@ -124,24 +147,10 @@ REPORT-FN is Flymake's callback." | |
(process-send-region flymake-quicklintjs--proc (point-min) (point-max)) | ||
(process-send-eof flymake-quicklintjs--proc)))) | ||
|
||
(provide 'flymake-quicklintjs) | ||
;;;###autoload | ||
(with-eval-after-load 'flymake | ||
(add-hook 'flymake-diagnostic-functions #'flymake-quicklintjs nil t)) | ||
|
||
;; quick-lint-js finds bugs in JavaScript programs. | ||
;; Copyright (C) 2020 Matthew Glazar | ||
;; | ||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation, either version 3 of the License, or | ||
;; (at your option) any later version. | ||
;; | ||
;; quick-lint-js is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU General Public License | ||
;; along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
(provide 'flymake-quicklintjs) | ||
|
||
;;; flymake-quicklintjs.el ends here |
Oops, something went wrong.