[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 6f53576 05/28: Use js-jsx- prefix for functions and
From: |
Jackson Ray Hamilton |
Subject: |
[Emacs-diffs] master 6f53576 05/28: Use js-jsx- prefix for functions and variables |
Date: |
Tue, 9 Apr 2019 02:00:12 -0400 (EDT) |
branch: master
commit 6f535762df1f8f55faa36878d4a2a0a8b112f666
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Use js-jsx- prefix for functions and variables
* lisp/progmodes/js.el (js--disambiguate-beginning-of-jsx-tag): Rename
to js-jsx--disambiguate-beginning-of-tag.
(js--disambiguate-end-of-jsx-tag): Rename to
js-jsx--disambiguate-end-of-tag.
(js--disambiguate-js-from-jsx): Rename to js-jsx--disambiguate-syntax.
(js--jsx-start-tag-re): Rename to js-jsx--start-tag-re.
(js--looking-at-jsx-start-tag-p): Rename to
js-jsx--looking-at-start-tag-p.
(js--jsx-end-tag-re): Rename to js-jsx--end-tag-re.
(js--looking-back-at-jsx-end-tag-p): Rename to
js-jsx--looking-back-at-end-tag-p.
(js--as-sgml): Rename to js-jsx--as-sgml.
(js--outermost-enclosing-jsx-tag-pos): Rename to
js-jsx--outermost-enclosing-tag-pos.
(js--jsx-indentation): Rename to js-jsx--indentation-type.
(js--indent-line-in-jsx-expression): Rename to
js-jsx--indent-line-in-expression.
(js--indent-n+1th-jsx-line): Rename to js-jsx--indent-n+1th-line.
---
lisp/progmodes/js.el | 52 ++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index d0556f3..4404ea0 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1743,7 +1743,7 @@ This performs fontification according to
`js--class-styles'."
"Check if STRING is a unary operator keyword in JavaScript."
(string-match-p js--unary-keyword-re string))
-(defun js--disambiguate-beginning-of-jsx-tag ()
+(defun js-jsx--disambiguate-beginning-of-tag ()
"Parse enough to determine if a JSX tag starts here.
Disambiguate JSX from equality operators by testing for syntax
only valid as JSX."
@@ -1766,7 +1766,7 @@ only valid as JSX."
;; Check if a JSXAttribute follows.
(looking-at js--name-start-re)))))))
-(defun js--disambiguate-end-of-jsx-tag ()
+(defun js-jsx--disambiguate-end-of-tag ()
"Parse enough to determine if a JSX tag ends here.
Disambiguate JSX from equality operators by testing for syntax
only valid as JSX, or extremely unlikely except as JSX."
@@ -1812,7 +1812,7 @@ only valid as JSX, or extremely unlikely except as JSX."
;; Nothing else to look for; give up parsing.
(throw 'match nil)))))))))
-(defun js--disambiguate-js-from-jsx (start end)
+(defun js-jsx--disambiguate-syntax (start end)
"Figure out which ‘<’ and ‘>’ chars (from START to END) aren’t JSX.
Later, this info prevents ‘sgml-’ functions from treating some
@@ -1821,8 +1821,8 @@ since they are serving their usual function as some JS
equality
operator or arrow function, instead."
(goto-char start)
(while (re-search-forward "[<>]" end t)
- (unless (if (eq (char-before) ?<) (js--disambiguate-beginning-of-jsx-tag)
- (js--disambiguate-end-of-jsx-tag))
+ (unless (if (eq (char-before) ?<) (js-jsx--disambiguate-beginning-of-tag)
+ (js-jsx--disambiguate-end-of-tag))
;; Inform sgml- functions that this >, >=, >>>, <, <=, <<<, or
;; => token is punctuation (and not an open or close parenthesis
;; as per usual in sgml-mode).
@@ -1856,7 +1856,7 @@ operator or arrow function, instead."
(js-syntax-propertize-regexp end)))))
("\\`\\(#\\)!" (1 "< b")))
(point) end)
- (if js-jsx-syntax (js--disambiguate-js-from-jsx start end)))
+ (if js-jsx-syntax (js-jsx--disambiguate-syntax start end)))
(defconst js--prettify-symbols-alist
'(("=>" . ?⇒)
@@ -1881,13 +1881,13 @@ operator or arrow function, instead."
(js--regexp-opt-symbol '("in" "instanceof")))
"Regexp matching operators that affect indentation of continued
expressions.")
-(defconst js--jsx-start-tag-re
+(defconst js-jsx--start-tag-re
(concat "<" sgml-name-re)
"Regexp matching code that looks like a JSXOpeningElement.")
-(defun js--looking-at-jsx-start-tag-p ()
+(defun js-jsx--looking-at-start-tag-p ()
"Non-nil if a JSXOpeningElement immediately follows point."
- (looking-at js--jsx-start-tag-re))
+ (looking-at js-jsx--start-tag-re))
(defun js--looking-at-operator-p ()
"Return non-nil if point is on a JavaScript operator, other than a comma."
@@ -1913,7 +1913,7 @@ operator or arrow function, instead."
;; return NaN anyway. Shouldn't be a problem.
(memq (char-before) '(?, ?} ?{)))))
;; “<” isn’t necessarily an operator in JSX.
- (not (and js-jsx-syntax (js--looking-at-jsx-start-tag-p))))))
+ (not (and js-jsx-syntax (js-jsx--looking-at-start-tag-p))))))
(defun js--find-newline-backward ()
"Move backward to the nearest newline that is not in a block comment."
@@ -1933,13 +1933,13 @@ operator or arrow function, instead."
(setq result nil)))
result))
-(defconst js--jsx-end-tag-re
+(defconst js-jsx--end-tag-re
(concat "</" sgml-name-re ">\\|/>")
"Regexp matching a JSXClosingElement.")
-(defun js--looking-back-at-jsx-end-tag-p ()
+(defun js-jsx--looking-back-at-end-tag-p ()
"Non-nil if a JSXClosingElement immediately precedes point."
- (looking-back js--jsx-end-tag-re (point-at-bol)))
+ (looking-back js-jsx--end-tag-re (point-at-bol)))
(defun js--continued-expression-p ()
"Return non-nil if the current line continues an expression."
@@ -1961,7 +1961,7 @@ operator or arrow function, instead."
(and
;; The “>” at the end of any JSXBoundaryElement isn’t
;; part of a continued expression.
- (not (and js-jsx-syntax (js--looking-back-at-jsx-end-tag-p)))
+ (not (and js-jsx-syntax (js-jsx--looking-back-at-end-tag-p)))
(progn
(or (bobp) (backward-char))
(and (> (point) (point-min))
@@ -2285,14 +2285,14 @@ current line is the \"=>\" token."
;;; JSX Indentation
-(defmacro js--as-sgml (&rest body)
+(defmacro js-jsx--as-sgml (&rest body)
"Execute BODY as if in sgml-mode."
`(with-syntax-table sgml-mode-syntax-table
,@body))
-(defun js--outermost-enclosing-jsx-tag-pos ()
+(defun js-jsx--outermost-enclosing-tag-pos ()
(let (context tag-pos last-tag-pos parse-status parens paren-pos curly-pos)
- (js--as-sgml
+ (js-jsx--as-sgml
;; Search until we reach the top or encounter the start of a
;; JSXExpressionContainer (implying nested JSX).
(while (and (setq context (sgml-get-context))
@@ -2322,7 +2322,7 @@ current line is the \"=>\" token."
(goto-char tag-pos))))
last-tag-pos))
-(defun js--jsx-indentation ()
+(defun js-jsx--indentation-type ()
"Determine if/how the current line should be indented as JSX.
Return nil for first JSXElement line (indent like JS).
@@ -2336,7 +2336,7 @@ Return nil for non-JSX lines."
(save-excursion
;; Determine if inside a JSXElement.
(beginning-of-line) ; For exclusivity
- (when (setq tag-start-pos (js--outermost-enclosing-jsx-tag-pos))
+ (when (setq tag-start-pos (js-jsx--outermost-enclosing-tag-pos))
;; Check if inside an embedded multi-line JS expression.
(goto-char current-pos)
(end-of-line) ; For exclusivity
@@ -2369,14 +2369,14 @@ Return nil for non-JSX lines."
(setq parens (cdr parens)))))
(or type 'n+1th)))))
-(defun js--indent-line-in-jsx-expression ()
+(defun js-jsx--indent-line-in-expression ()
"Indent the current line as JavaScript within JSX."
(let ((parse-status (save-excursion (syntax-ppss (point-at-bol))))
offset indent-col)
(unless (nth 3 parse-status)
(save-excursion
(setq offset (- (point) (progn (back-to-indentation) (point)))
- indent-col (js--as-sgml (sgml-calculate-indent))))
+ indent-col (js-jsx--as-sgml (sgml-calculate-indent))))
(if (null indent-col) 'noindent ; Like in sgml-mode
;; Use whichever indentation column is greater, such that the
;; SGML column is effectively a minimum.
@@ -2384,9 +2384,9 @@ Return nil for non-JSX lines."
(+ indent-col js-indent-level)))
(when (> offset 0) (forward-char offset))))))
-(defun js--indent-n+1th-jsx-line ()
+(defun js-jsx--indent-n+1th-line ()
"Indent the current line as JSX within JavaScript."
- (js--as-sgml (sgml-indent-line)))
+ (js-jsx--as-sgml (sgml-indent-line)))
(defun js-indent-line ()
"Indent the current line as JavaScript."
@@ -2403,10 +2403,10 @@ Return nil for non-JSX lines."
i.e., customize JSX element indentation with `sgml-basic-offset',
`sgml-attribute-offset' et al."
(interactive)
- (let ((type (js--jsx-indentation)))
+ (let ((type (js-jsx--indentation-type)))
(if type
- (if (eq type 'n+1th) (js--indent-n+1th-jsx-line)
- (js--indent-line-in-jsx-expression))
+ (if (eq type 'n+1th) (js-jsx--indent-n+1th-line)
+ (js-jsx--indent-line-in-expression))
(js-indent-line))))
;;; Filling
- [Emacs-diffs] master 339be7c 11/28: Finish replacing SGML-based JSX detection with js-mode’s parsing, (continued)
- [Emacs-diffs] master 339be7c 11/28: Finish replacing SGML-based JSX detection with js-mode’s parsing, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 8dae742 08/28: Propertize and font-lock JSXText and JSXExpressionContainers, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 3eadf1e 24/28: Identify JSX strings (for js2-mode), Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 4b305bb 02/28: Refactor JSX indentation code to improve enclosing JSX discovery, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 58c77f1 01/28: Add failing tests for JSX indentation bugs, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 4d2b5bb 07/28: Font-lock JSX while editing it by extending regions, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 462baab 19/28: Add tests for miscellaneous JSX parsing feats, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master be86ece 04/28: js-syntax-propertize: Disambiguate JS from JSX, fixing some indents, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master d9d1bb2 14/28: Rename tests to use the “.jsx” file extension, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 84b1cfb 15/28: Indent broken arrow function bodies as an N+1th arg, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 6f53576 05/28: Use js-jsx- prefix for functions and variables,
Jackson Ray Hamilton <=
- [Emacs-diffs] master bf37078 12/28: Automatically detect JSX in JavaScript files, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master cf416d9 28/28: Explain reasonings for JSX syntax support design decisions, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 9545519 26/28: Add open/close parenthesis syntax to “<” and “>” in JSX, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 7c3ffda 27/28: Move curly functions closer to where they’re used, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 1a1ef28 10/28: Indent JSX as parsed in a JS context, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 55c80d4 17/28: Indent expressions in JSXAttributes relative to the attribute’s name, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 18bbfc4 25/28: Permit non-ASCII identifiers in JS, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 98e36a3 21/28: Optimize js-jsx--enclosing-tag-pos, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 7a9dac5 22/28: Improve whitespace and unary keyword parsing, Jackson Ray Hamilton, 2019/04/09
- [Emacs-diffs] master 8b92719 13/28: Improve JSX syntax propertization, Jackson Ray Hamilton, 2019/04/09