[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/js2-mode 999c0e7 22/61: Merge pull request #531 from ja
From: |
Dmitry Gutov |
Subject: |
[elpa] externals/js2-mode 999c0e7 22/61: Merge pull request #531 from jacksonrayhamilton/jsx-documentation |
Date: |
Sun, 20 Dec 2020 12:20:02 -0500 (EST) |
branch: externals/js2-mode
commit 999c0e7d96f4d5be0950b6506d732dc3d7c53635
Merge: 5434da3 2d2fb4b
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: GitHub <noreply@github.com>
Merge pull request #531 from jacksonrayhamilton/jsx-documentation
JSX Documentation
---
NEWS.md | 8 ++++++++
README.md | 2 +-
js2-mode.el | 22 +++++++++++++++++-----
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index c120be7..b3163a4 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,13 @@
# History of user-visible changes
+## Next
+
+* Emacs 27 now provides improved JSX indentation support, along with
+ new JSX highlighting and detection support. Install Emacs 27 and use
+ `js-mode` with `js2-minor-mode` (see README), rather than
+ `js2-jsx-mode`.
+* Using `js2-jsx-mode` will now trigger a warning in Emacs 27.
+
## 2019-02-19
* Changed the default of `js2-strict-trailing-comma-warning` to nil.
diff --git a/README.md b/README.md
index b9a3dc6..ed3f68f 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ or e.g. install a snapshot from a
use `js-mode` as the major mode. To make use of the JS2 AST and the
packages that integrate with it, we recommend `js2-minor-mode`. See
the corresponding [instructions in the
-Commentary](https://github.com/mooz/js2-mode/blob/ae9fea81cf9ed80f403c161fde4d8aff1ceb3769/js2-mode.el#L57).
+Commentary](https://github.com/mooz/js2-mode/blob/bb73461c2c7048d811b38e6b533a30fb5fdcea93/js2-mode.el#L57).
`js-mode` in Emacs 27 includes full support for syntax highlighting
and indenting of JSX syntax.
diff --git a/js2-mode.el b/js2-mode.el
index ab0d05a..4686be8 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -60,12 +60,14 @@
;; (add-to-list 'interpreter-mode-alist '("node" . js2-mode))
-;; Support for JSX is available via the derived mode `js2-jsx-mode'. If you
-;; also want JSX support, use that mode instead:
+;; Use Emacs 27 and want to write JSX? Then use `js2-minor-mode' as described
+;; above. Use Emacs 26 or earlier? Then use `js2-jsx-mode':
;; (add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js2-jsx-mode))
;; (add-to-list 'interpreter-mode-alist '("node" . js2-jsx-mode))
+;; Note that linting of JSX code may fail in both modes.
+
;; To customize how it works:
;; M-x customize-group RET js2-mode RET
@@ -11762,11 +11764,12 @@ Selecting an error will jump it to the corresponding
source-buffer error.
;; Schedule parsing for after when the mode hooks run.
(js2-mode-reset-timer)))
-;; We may eventually want js2-jsx-mode to derive from js-jsx-mode, but that'd
be
-;; a bit more complicated and it doesn't net us much yet.
;;;###autoload
(define-derived-mode js2-jsx-mode js2-mode "JSX-IDE"
- "Major mode for editing JSX code.
+ "Major mode for editing JSX code in Emacs 26 and earlier.
+
+To edit JSX code in Emacs 27, use `js-mode' as your major mode
+with `js2-minor-mode' enabled.
To customize the indentation for this mode, set the SGML offset
variables (`sgml-basic-offset' et al) locally, like so:
@@ -11774,6 +11777,15 @@ variables (`sgml-basic-offset' et al) locally, like so:
(defun set-jsx-indentation ()
(setq-local sgml-basic-offset js2-basic-offset))
(add-hook \\='js2-jsx-mode-hook #\\='set-jsx-indentation)"
+ (unless (version< emacs-version "27.0")
+ ;; Emacs 27 causes a regression in this mode since JSX indentation
+ ;; begins to rely on js-mode’s `syntax-propertize-function', which
+ ;; JS2 is not currently using.
+ ;; https://github.com/mooz/js2-mode/issues/529 should address
+ ;; this. https://github.com/mooz/js2-mode/issues/530 also has a
+ ;; piece related to the design of `js2-jsx-mode'. Until these
+ ;; issues are addressed, ward Emacs 27 users away from this mode.
+ (display-warning 'js2-mode "For JSX support, use js-mode with
js2-minor-mode"))
(set (make-local-variable 'indent-line-function) #'js2-jsx-indent-line))
(defun js2-mode-exit ()
- [elpa] externals/js2-mode d9bba5b 12/61: Update recommendations for using JSX with respect to Emacs 27, (continued)
- [elpa] externals/js2-mode d9bba5b 12/61: Update recommendations for using JSX with respect to Emacs 27, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 6cc0a8a 15/61: Merge paragraphs so the information reads better, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 14113fe 18/61: Remove date, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 8e2cdd4 19/61: Revert extra added information, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode bb73461 20/61: Revert doc changes and explain JSX options for all emacsen later, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 3a80b00 25/61: use type face for class, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 9837d78 28/61: Fix ‘huge-hex’ test for newer Emacsen., Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 515d876 27/61: Fix parsing static props without semicolons, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 61a8c91 29/61: Merge pull request #550 from phst/huge-hex, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 997d6bd 30/61: Avoid undefined behavior in indentation tests., Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 999c0e7 22/61: Merge pull request #531 from jacksonrayhamilton/jsx-documentation,
Dmitry Gutov <=
- [elpa] externals/js2-mode 2d2fb4b 21/61: Reference latest revision of the commentary, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 146c1f6 32/61: Migrate off deprecated ‘cl’ library., Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode d642b7b 34/61: Remove an unused variable, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 8841175 23/61: support optional-chaining operator, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode b3841a7 24/61: Merge pull request #533 from redguardtoo/master, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 1a5dee9 38/61: Merge pull request #552 from phst/cl, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode a6e1305 41/61: Merge pull request #555 from phst/unused-arg, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 5049e54 43/61: Merge pull request #556 from ArneBab/browser-symbols, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 6b84319 44/61: Remove a few unused variables., Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 56991f7 45/61: Merge pull request #557 from phst/unused, Dmitry Gutov, 2020/12/20