[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6531b86 11/16: Use more agnostic names.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 6531b86 11/16: Use more agnostic names. |
Date: |
Sun, 18 Oct 2015 11:21:49 +0000 |
branch: master
commit 6531b86bd03b34b1944e1fe8714dd26698277e02
Author: Jackson Hamilton <address@hidden>
Commit: Jackson Hamilton <address@hidden>
Use more agnostic names.
---
context-coloring.el | 16 +++++++++-------
test/context-coloring-test.el | 8 ++++----
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 1f617b9..ef908fd 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -414,8 +414,10 @@ this for ES6 code; disable it elsewhere."
"\\)")
"Match a comment body hinting at a Node.js program.")
-(defun context-coloring-node-program-p ()
- "Guess whether the current file is a Node.js program."
+;; TODO: Add ES6 module detection.
+(defun context-coloring-js2-top-level-local-p ()
+ "Guess whether top-level variables are local.
+For instance, the current file could be a Node.js program."
(or
;; A shebang is a pretty obvious giveaway.
(string-equal
@@ -472,17 +474,17 @@ this for ES6 code; disable it elsewhere."
;; Default to returning nil from the catch body.
nil))))
-(defcustom context-coloring-detect-node t
- "If non-nil, use file-level scope for variables in Node.js."
+(defcustom context-coloring-javascript-detect-top-level-scope t
+ "If non-nil, detect when to use file-level scope."
:type 'boolean
:group 'context-coloring)
(defun context-coloring-js2-colorize ()
"Color the buffer using the `js2-mode'."
(cond
- ;; Increase the initial level if we can detect Node.js.
- ((and context-coloring-detect-node
- (context-coloring-node-program-p))
+ ;; Increase the initial level if we should.
+ ((and context-coloring-javascript-detect-top-level-scope
+ (context-coloring-js2-top-level-local-p))
(let ((context-coloring-initial-level 1))
(context-coloring-js2-colorize-ast)))
(t
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 6cf78e4..f643e91 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -623,7 +623,7 @@ ssssssssssss0"))
:after (lambda ()
(setq context-coloring-initial-level 0)))
-(defun context-coloring-test-setup-detect-node (string)
+(defun context-coloring-test-setup-top-level-scope (string)
"Make STRING the first line and colorize again."
(goto-char (point-min))
(kill-whole-line 0)
@@ -631,7 +631,7 @@ ssssssssssss0"))
;; Reparsing triggers recoloring.
(js2-reparse))
-(context-coloring-test-deftest-javascript detect-node
+(context-coloring-test-deftest-javascript top-level-scope
(lambda ()
(let ((positive-indicators
(list "#!/usr/bin/env node"
@@ -648,10 +648,10 @@ ssssssssssss0"))
"exports"
"var require; require('a')")))
(dolist (indicator positive-indicators)
- (context-coloring-test-setup-detect-node indicator)
+ (context-coloring-test-setup-top-level-scope indicator)
(context-coloring-test-assert-javascript-elevated-level))
(dolist (indicator negative-indicators)
- (context-coloring-test-setup-detect-node indicator)
+ (context-coloring-test-setup-top-level-scope indicator)
(context-coloring-test-assert-javascript-global-level))))
:fixture "initial-level.js")
- [elpa] master updated (9319a95 -> 6934762), Jackson Ray Hamilton, 2015/10/18
- [elpa] master 53279b1 01/16: Fix tests on Windows., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 85397da 02/16: Add more sophisticated block scope test., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 683a522 04/16: Suggest eval-expression-minibuffer-setup-hook., Jackson Ray Hamilton, 2015/10/18
- [elpa] master df914b8 03/16: Bump minimum js2-mode version., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 7c16f46 05/16: Add initial level setting., Jackson Ray Hamilton, 2015/10/18
- [elpa] master fa99117 06/16: Add defcustom types., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 614de4c 07/16: Don't make the initial level buffer-local., Jackson Ray Hamilton, 2015/10/18
- [elpa] master a193f4e 08/16: Refactor position level assertion., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 6fe9e58 09/16: Add Node.js detection., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 6531b86 11/16: Use more agnostic names.,
Jackson Ray Hamilton <=
- [elpa] master 2c62db1 10/16: Ensure Node.js variable is global., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 6ac3b43 12/16: Merge branch 'detect-node', Jackson Ray Hamilton, 2015/10/18
- [elpa] master ff9643c 14/16: Update Zenburn paragraph., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 765d4c4 13/16: Document new scope detection., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 0c3a48f 15/16: Version 7.1.0., Jackson Ray Hamilton, 2015/10/18
- [elpa] master 6934762 16/16: Merge commit '0c3a48f05d17f486a0c522f0f9ec316dce24d86d' from context-coloring, Jackson Ray Hamilton, 2015/10/18