[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a72314c 008/271: Write temp files.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master a72314c 008/271: Write temp files. |
Date: |
Thu, 05 Feb 2015 18:29:23 +0000 |
branch: master
commit a72314c42e153945de2508363f47338e6d3916b2
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Write temp files.
---
context-coloring.el | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 7674faa..d498bbd 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -80,6 +80,15 @@ For example: 'context-coloring-depth-1-face'."
(move-to-column column)
(point)))
+(defun context-coloring-save-buffer-to-temp ()
+ "Save buffer to temp file.
+Return the name of the temporary file."
+ (let ((file-name (make-temp-file "context-coloring")))
+ ;; Do not flush short-lived temporary files onto disk.
+ (let ((write-region-inhibit-fsync t))
+ (write-region nil nil file-name nil 0))
+ file-name))
+
;;; The coloring.
(defconst context-coloring-path
@@ -87,12 +96,11 @@ For example: 'context-coloring-depth-1-face'."
(defun context-coloring-propertize-region (start end)
(interactive)
- (let* ((json (shell-command-to-string
- (format "echo '%s' | %s"
- (buffer-substring-no-properties
- (point-min)
- (point-max))
- (expand-file-name "./tokenizer/tokenizer"
context-coloring-path))))
+ (let* ((temp-file (context-coloring-save-buffer-to-temp))
+ (json (shell-command-to-string
+ (format "%s < %s"
+ (expand-file-name "./tokenizer/tokenizer"
context-coloring-path)
+ temp-file)))
(tokens (let ((json-array-type 'list))
(json-read-from-string json))))
(with-silent-modifications
- [elpa] master 615ce2c 004/271: Wow, actually works., (continued)
- [elpa] master 615ce2c 004/271: Wow, actually works., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6d79b91 024/271: Idly colorizing after changes working. Cancelling seemingly not working., Jackson Ray Hamilton, 2015/02/05
- [elpa] master fd4b629 007/271: Add mode., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6e991c4 014/271: Fix off-by-one error., Jackson Ray Hamilton, 2015/02/05
- [elpa] master b35380b 019/271: Vastly improve idle timer strategy., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 7ac8db6 012/271: Fix a bug where strings were matched., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 806398e 016/271: Use asynchronous command execution strategy., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d0f5470 022/271: Successfully lexically bind buffer., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 397ef04 005/271: Detect globals., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 409a05b 017/271: Enable font lock again., Jackson Ray Hamilton, 2015/02/05
- [elpa] master a72314c 008/271: Write temp files.,
Jackson Ray Hamilton <=
- [elpa] master 6a2a7df 018/271: Use idle timers instead of font lock., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 0a4248b 009/271: Update chunk size., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ffd69f5 026/271: Minutia., Jackson Ray Hamilton, 2015/02/05
- [elpa] master f349ecb 027/271: Minutia., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 35453e0 015/271: Only color changed regions., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 222276b 001/271: Init., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 09166f9 021/271: Some progress, probably have to switch back to lexical., Jackson Ray Hamilton, 2015/02/05
- [elpa] master e448e2f 025/271: Cancelling working., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 97194c7 023/271: Apply tokens with lexically-bound buffer as current., Jackson Ray Hamilton, 2015/02/05
- [elpa] master b4b86ac 033/271: Fix after-change-functions with add-hook. Fix nulls., Jackson Ray Hamilton, 2015/02/05