emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/js2-mode d9bba5b 12/61: Update recommendations for usin


From: Dmitry Gutov
Subject: [elpa] externals/js2-mode d9bba5b 12/61: Update recommendations for using JSX with respect to Emacs 27
Date: Sun, 20 Dec 2020 12:19:59 -0500 (EST)

branch: externals/js2-mode
commit d9bba5b51097e4915a36f652742588128aca3211
Author: Jackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Commit: Jackson Ray Hamilton <jackson@jacksonrayhamilton.com>

    Update recommendations for using JSX with respect to Emacs 27
---
 js2-mode.el | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index ab0d05a..6e2c30e 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -56,16 +56,13 @@
 
 ;;   (add-hook 'js-mode-hook 'js2-minor-mode)
 
+;; If you use Emacs 27 and desire JSX support added in that release,
+;; use `js-mode' as your major mode with `js2-minor-mode' enabled.
+
 ;; You may also want to hook it in for shell scripts running via node.js:
 
 ;;   (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:
-
-;;   (add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js2-jsx-mode))
-;;   (add-to-list 'interpreter-mode-alist '("node" . js2-jsx-mode))
-
 ;; To customize how it works:
 ;;   M-x customize-group RET js2-mode RET
 
@@ -11762,11 +11759,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 +11772,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 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]