[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/js2-mode ae9fea8 07/61: Make js2-minor-mode avoid chang
From: |
Dmitry Gutov |
Subject: |
[elpa] externals/js2-mode ae9fea8 07/61: Make js2-minor-mode avoid changing the syntax-table text property |
Date: |
Sun, 20 Dec 2020 12:19:58 -0500 (EST) |
branch: externals/js2-mode
commit ae9fea81cf9ed80f403c161fde4d8aff1ceb3769
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Make js2-minor-mode avoid changing the syntax-table text property
This offers better compatibility with js-mode (and its JSX support in Emacs
27).
Doing this was not appropriate for a minor mode anyway.
---
js2-mode.el | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index d9cea03..ab0d05a 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -1249,6 +1249,9 @@ First match-group is the leading whitespace.")
(defvar js2-mode-verbose-parse-p js2-mode-dev-mode-p
"Non-nil to emit status messages during parsing.")
+(defvar js2-mode-change-syntax-p t
+ "Non-nil to set the syntax-table text property on certain literals.")
+
(defvar js2-mode-functions-hidden nil "Private variable.")
(defvar js2-mode-comments-hidden nil "Private variable.")
@@ -6345,8 +6348,9 @@ its relevant fields and puts it into `js2-ti-tokens'."
flags
(continue t)
(token (js2-new-token 0)))
- (js2-record-text-property start-pos (1+ start-pos)
- 'syntax-table (string-to-syntax "\"/"))
+ (when js2-mode-change-syntax-p
+ (js2-record-text-property start-pos (1+ start-pos)
+ 'syntax-table (string-to-syntax "\"/")))
(setq js2-ts-string-buffer nil)
(if (eq start-tt js2-ASSIGN_DIV)
;; mis-scanned /=
@@ -6373,8 +6377,9 @@ its relevant fields and puts it into `js2-ti-tokens'."
(setq in-class nil)))
(js2-add-to-string c))))
(unless err
- (js2-record-text-property (1- js2-ts-cursor) js2-ts-cursor
- 'syntax-table (string-to-syntax "\"/"))
+ (when js2-mode-change-syntax-p
+ (js2-record-text-property (1- js2-ts-cursor) js2-ts-cursor
+ 'syntax-table (string-to-syntax "\"/")))
(while continue
(cond
((js2-match-char ?g)
@@ -11572,6 +11577,7 @@ highlighting features of `js2-mode'."
(setq js2-mode-buffer-dirty-p t
js2-mode-parsing nil)
(set (make-local-variable 'js2-highlight-level) 0) ; no syntax highlighting
+ (set (make-local-variable 'js2-mode-change-syntax-p) nil)
(add-hook 'after-change-functions #'js2-minor-mode-edit nil t)
(add-hook 'change-major-mode-hook #'js2-minor-mode-exit nil t)
(when js2-include-jslint-globals
@@ -11855,8 +11861,9 @@ buffer will only rebuild its `js2-mode-ast' if the
buffer is dirty."
(with-silent-modifications
;; if parsing is interrupted, comments and regex
;; literals stay ignored by `parse-partial-sexp'
- (remove-text-properties (point-min) (point-max)
- '(syntax-table))
+ (when js2-mode-change-syntax-p
+ (remove-text-properties (point-min) (point-max)
+ '(syntax-table)))
(js2-mode-apply-deferred-properties)
(js2-mode-remove-suppressed-warnings)
(js2-mode-show-warnings)
- [elpa] externals/js2-mode updated (474c396 -> 29979e5), Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode fc323ad 02/61: Fix issue #515 by improving the detection of destructured function params, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 392492e 03/61: Merge pull request #517 from lelit/issue515, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode f3c75fd 01/61: Add failing tests on issue #515, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode fec511d 04/61: Add failing test on issue #518, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode e8da0b4 05/61: Fix issue #518, considering class definition as initialization, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 7db4871 06/61: Merge pull request #519 from lelit/issue518, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 5434da3 10/61: [ci skip] Link to INSTALL.REPO, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 46aed6d 11/61: Extend explanation to disclaim key issue but provide an alternative, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode ae9fea8 07/61: Make js2-minor-mode avoid changing the syntax-table text property,
Dmitry Gutov <=
- [elpa] externals/js2-mode bf7191c 08/61: Recommend js-mode + js2-minor-mode and Emacs 27 for JSX, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 2ce4985 09/61: [ci skip] Stop mentioning Emacs 22 and 23, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 1662cb8 13/61: Document changes with relation to JSX support added in Emacs 27, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 41ca3ad 14/61: Reference latest revision of the commentary, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 037bcf7 16/61: Clarify what is likely to fail, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode e785721 17/61: Reference latest revision of the commentary, Dmitry Gutov, 2020/12/20
- [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