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

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

[elpa] master 85ff3ef 13/28: Trailing whitespace, empty arrays, empty st


From: Jackson Ray Hamilton
Subject: [elpa] master 85ff3ef 13/28: Trailing whitespace, empty arrays, empty strings.
Date: Tue, 05 May 2015 11:10:20 +0000

branch: master
commit 85ff3ef8a80b11810ba4382fd386209d8ec5a714
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Trailing whitespace, empty arrays, empty strings.
    
    Fix bug in the JSON parser.  Arrays only parsed before because
    `string-to-number' ignored the trailing "]".
---
 context-coloring.el |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 2b65666..691a475 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -54,6 +54,7 @@
 ;;; Code:
 
 (require 'js2-mode)
+(require 'subr-x)
 
 
 ;;; Local variables
@@ -300,8 +301,13 @@ element."
 
 (defun context-coloring-parse-array (array)
   "Parse ARRAY as a flat JSON array of numbers."
-  (vconcat
-   (mapcar 'string-to-number (split-string (substring array 1 -1) ","))))
+  (let ((braceless (substring (string-trim array) 1 -1)))
+    (cond
+     ((> (length braceless) 0)
+      (vconcat
+       (mapcar 'string-to-number (split-string braceless ","))))
+     (t
+      (vector)))))
 
 (defvar-local context-coloring-scopifier-process nil
   "The single scopifier process that can be running.")



reply via email to

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