[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d1cc5e0 04/39: Fix UTF-8 encoding for strings passed to su
From: |
Thierry Volpiatto |
Subject: |
[elpa] master d1cc5e0 04/39: Fix UTF-8 encoding for strings passed to subordinate Emacs |
Date: |
Wed, 18 May 2016 18:02:50 +0000 (UTC) |
branch: master
commit d1cc5e0911bb6ff5f2a49f4bc5366fd8290c5104
Author: John Wiegley <address@hidden>
Commit: John Wiegley <address@hidden>
Fix UTF-8 encoding for strings passed to subordinate Emacs
---
async.el | 40 +++++++++++++++++++++++++---------------
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/async.el b/async.el
index 20a2f17..24db2a1 100644
--- a/async.el
+++ b/async.el
@@ -121,7 +121,9 @@ as follows:
(defun async--receive-sexp (&optional stream)
(let ((sexp (decode-coding-string (base64-decode-string
- (read stream)) 'utf-8-unix)))
+ (read stream)) 'utf-8-unix))
+ ;; Parent expects UTF-8 encoded text.
+ (coding-system-for-write 'utf-8-unix))
(if async-debug
(message "Received sexp {{{%s}}}" (pp-to-string sexp)))
(setq sexp (read sexp))
@@ -130,7 +132,10 @@ as follows:
(eval sexp)))
(defun async--insert-sexp (sexp)
- (let (print-level print-length)
+ (let (print-level
+ print-length
+ (print-escape-nonascii t)
+ (print-circle t))
(prin1 sexp (current-buffer))
;; Just in case the string we're sending might contain EOF
(encode-coding-region (point-min) (point-max) 'utf-8-unix)
@@ -147,18 +152,21 @@ as follows:
(defun async-batch-invoke ()
"Called from the child Emacs process' command-line."
- (setq async-in-child-emacs t
- debug-on-error async-debug)
- (if debug-on-error
- (prin1 (funcall
- (async--receive-sexp (unless async-send-over-pipe
- command-line-args-left))))
- (condition-case err
- (prin1 (funcall
- (async--receive-sexp (unless async-send-over-pipe
- command-line-args-left))))
- (error
- (prin1 (list 'async-signal err))))))
+ ;; Make sure 'message' and 'prin1' encode stuff in UTF-8, as parent
+ ;; process expects.
+ (let ((coding-system-for-write 'utf-8-unix))
+ (setq async-in-child-emacs t
+ debug-on-error async-debug)
+ (if debug-on-error
+ (prin1 (funcall
+ (async--receive-sexp (unless async-send-over-pipe
+ command-line-args-left))))
+ (condition-case err
+ (prin1 (funcall
+ (async--receive-sexp (unless async-send-over-pipe
+ command-line-args-left))))
+ (error
+ (prin1 (list 'async-signal err)))))))
(defun async-ready (future)
"Query a FUTURE to see if the ready is ready -- i.e., if no blocking
@@ -263,7 +271,9 @@ returned except that it yields no value (since the value is
passed to FINISH-FUNC). Call `async-get' on such a future always
returns nil. It can still be useful, however, as an argument to
`async-ready' or `async-wait'."
- (let ((sexp start-func))
+ (let ((sexp start-func)
+ ;; Subordinate Emacs will send text encoded in UTF-8.
+ (coding-system-for-read 'utf-8-unix))
(setq async--procvar
(async-start-process
"emacs" (file-truename
- [elpa] master dd09794 33/39: Fix success message on callback., (continued)
- [elpa] master dd09794 33/39: Fix success message on callback., Thierry Volpiatto, 2016/05/18
- [elpa] master 14170a4 35/39: Add more info in mode-line on failures., Thierry Volpiatto, 2016/05/18
- [elpa] master 6e29e82 17/39: Switch to lexical-binding., Thierry Volpiatto, 2016/05/18
- [elpa] master 0e327f7 37/39: Update version number here too., Thierry Volpiatto, 2016/05/18
- [elpa] master 6521911 07/39: Merge pull request #59 from kolewu/kolewu-fix-typo-1, Thierry Volpiatto, 2016/05/18
- [elpa] master cd901e7 12/39: Improve backup-files by handling symlinks and time-stamp errors., Thierry Volpiatto, 2016/05/18
- [elpa] master e8db6cc 36/39: Update pkg file., Thierry Volpiatto, 2016/05/18
- [elpa] master 527c590 38/39: Merge commit '0e327f72bdffc5bc4a1fbc34a8da1b7066e819b3', Thierry Volpiatto, 2016/05/18
- [elpa] master 4c4eba9 19/39: Fix repetition in callback., Thierry Volpiatto, 2016/05/18
- [elpa] master 6552135 32/39: Improve how error buffer is displayed., Thierry Volpiatto, 2016/05/18
- [elpa] master d1cc5e0 04/39: Fix UTF-8 encoding for strings passed to subordinate Emacs,
Thierry Volpiatto <=