branch: master commit 202ca741433b902f8d723f5789d33c78f93fc115 Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Drop `subr-x' dependency. --- context-coloring.el | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/context-coloring.el b/context-coloring.el index 691a475..010e0af 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -54,7 +54,6 @@ ;;; Code: (require 'js2-mode) -(require 'subr-x) ;;; Local variables @@ -69,6 +68,16 @@ "Join a list of STRINGS with the string DELIMITER." (mapconcat 'identity strings delimiter)) +(defun context-coloring-trim (string) + "Remove leading and trailing whitespace from STRING." + ;; Trim right. + (when (string-match "[ \t\n\r]+\\'" string) + (setq string (replace-match "" t t string))) + ;; Trim left. + (if (string-match "\\`[ \t\n\r]+" string) + (replace-match "" t t string) + string)) + ;;; Faces @@ -301,7 +310,7 @@ element." (defun context-coloring-parse-array (array) "Parse ARRAY as a flat JSON array of numbers." - (let ((braceless (substring (string-trim array) 1 -1))) + (let ((braceless (substring (context-coloring-trim array) 1 -1))) (cond ((> (length braceless) 0) (vconcat