[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 3741b8c 26/48: Prepare for UTF-8 with BOM
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 3741b8c 26/48: Prepare for UTF-8 with BOM |
Date: |
Sun, 16 Sep 2018 01:47:24 -0400 (EDT) |
branch: externals/auctex
commit 3741b8ca053d3c893978487189458d1e3cf5cbea
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>
Prepare for UTF-8 with BOM
* tex-buf.el (TeX-adjust-process-coding-system): Don't use
`utf-8-with-signature' to encode keyboard input for TeX process.
Drop mule feature check.
---
tex-buf.el | 89 +++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 47 insertions(+), 42 deletions(-)
diff --git a/tex-buf.el b/tex-buf.el
index 39b9a0a..ad6dad6 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -984,48 +984,53 @@ Called with one argument PROCESS.")
Usually coding system is the same as the TeX file with eol format
adjusted to OS default value. Take care of Japanese TeX, which
requires special treatment."
- (when (featurep 'mule)
- (if (and (boundp 'japanese-TeX-mode)
- (fboundp 'japanese-TeX-set-process-coding-system)
- (with-current-buffer TeX-command-buffer
- japanese-TeX-mode))
- (japanese-TeX-set-process-coding-system process)
- (let ((cs (with-current-buffer TeX-command-buffer
- buffer-file-coding-system)))
- ;; The value of `buffer-file-coding-system' is sometimes
- ;; undecided-{unix,dos,mac}. That happens when the file
- ;; contains no multibyte chars and only end of line format is
- ;; determined. Emacs lisp reference recommends not to use
- ;; undecided-* for process coding system, so it might seem
- ;; reasonable to change undecided-* to some fixed coding
- ;; system like this:
- ;; (if (eq 'undecided (coding-sytem-type cs))
- ;; (setq cs 'utf-8))
- ;; However, that can lose when the following conditions are
- ;; met:
- ;; (1) The document is divided into multiple files.
- ;; (2) The command buffer contains no multibyte chars.
- ;; (3) The other files contain mutlibyte chars and saved in
- ;; a coding system other than the coding system chosen
- ;; above.
- ;; So we leave undecided-* unchanged here. Although
- ;; undecided-* is not quite safe for the coding system for
- ;; encoding, i.e., keyboard input to the TeX process, we
- ;; expect that this does not raise serious problems because it
- ;; is pretty rare that TeX process needs keyboard input of
- ;; multibyte chars.
-
- ;; Eol format of TeX files can differ from OS default. TeX
- ;; binaries accept all type of eol format in the given files
- ;; and output messages according to OS default. So we set eol
- ;; format to OS default value.
- (setq cs (coding-system-change-eol-conversion
- cs
- ;; The eol of macosX is LF, not CR. So we choose
- ;; other than `unix' only for w32 system.
- ;; FIXME: what should we do for cygwin?
- (if (eq system-type 'windows-nt) 'dos 'unix)))
- (set-process-coding-system process cs cs)))))
+ (if (and (boundp 'japanese-TeX-mode)
+ (fboundp 'japanese-TeX-set-process-coding-system)
+ (with-current-buffer TeX-command-buffer
+ japanese-TeX-mode))
+ (japanese-TeX-set-process-coding-system process)
+ (let ((cs (coding-system-base (with-current-buffer TeX-command-buffer
+ buffer-file-coding-system))))
+ ;; The value of `buffer-file-coding-system' is sometimes
+ ;; undecided-{unix,dos,mac}. That happens when the file
+ ;; contains no multibyte chars and only end of line format is
+ ;; determined. Emacs lisp reference recommends not to use
+ ;; undecided-* for process coding system, so it might seem
+ ;; reasonable to change `undecided' into some fixed coding
+ ;; system like this:
+ ;; (if (eq 'undecided cs)
+ ;; (setq cs 'utf-8))
+ ;; However, that can lose when the following conditions are met:
+ ;; (1) The document is divided into multiple files.
+ ;; (2) The command buffer contains no multibyte chars.
+ ;; (3) The other files contain mutlibyte chars and saved in a
+ ;; coding system other than the one chosen above.
+ ;; So we leave `undecided' unchanged here. Although `undecided'
+ ;; is not quite safe for the coding system for encoding, i.e.,
+ ;; keyboard input to the TeX process, we expect that this does
+ ;; not raise serious problems because it is pretty rare that TeX
+ ;; process needs keyboard input of multibyte chars.
+
+ ;; `utf-8-with-signature' (UTF-8 with BOM) doesn't suit at all
+ ;; for the coding system for encoding because it always injects
+ ;; 3-byte BOM in front of its return value (even when the string
+ ;; to be sent has only ascii characters!) Thus we change it
+ ;; into `utf-8'. On decoding, `utf-8' can decode UTF-8 with
+ ;; BOM. So it is safe for both decoding and encoding.
+ (if (eq cs 'utf-8-with-signature)
+ (setq cs 'utf-8))
+
+ ;; Eol format of TeX files can differ from OS default. TeX
+ ;; binaries accept all type of eol format in the given files
+ ;; and output messages according to OS default. So we set eol
+ ;; format to OS default value.
+ (setq cs (coding-system-change-eol-conversion
+ cs
+ ;; The eol of macosX is LF, not CR. So we choose
+ ;; other than `unix' only for w32 system.
+ ;; FIXME: what should we do for cygwin?
+ (if (eq system-type 'windows-nt) 'dos 'unix)))
+ (set-process-coding-system process cs cs))))
(defcustom TeX-show-compilation nil
"*If non-nil, show output of TeX compilation in other window."
- [elpa] externals/auctex d5f98ae 32/48: ; Fix typos, (continued)
- [elpa] externals/auctex d5f98ae 32/48: ; Fix typos, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 3b1ffcd 30/48: TL 2018 non-ascii file name fix for preview-latex, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 0d8f8a2 14/48: Prevent spurious newlines to be added, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 527bcb2 16/48: ; * doc/auctex.texi (Processor Options): Add note of case in an option., Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 7371b46 07/48: Add support for dvipdfmx to \includegraphics, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 4afd633 11/48: Update key=val options to geometry package v5.8, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 6a17a52 24/48: ; * doc/changes.texi (News in 12.2): Add news about removed option., Tassilo Horn, 2018/09/16
- [elpa] externals/auctex ff08d38 28/48: Fix region compilation with \usepackage[utf8]{inputenc}, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex cad042f 31/48: Add note and test about the change involving non-ascii file name, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 5ce08ab 33/48: Raise robustness of call of dvipng command, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 3741b8c 26/48: Prepare for UTF-8 with BOM,
Tassilo Horn <=
- [elpa] externals/auctex 4816092 36/48: Fix possible endless loop, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 74c4843 40/48: Add new style/thmtools.el and style/thm-restate.el, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex ff8f183 39/48: ; * style/floatrow.el (LaTeX-floatrow-update-key-val-options): Use `setq' inside the loop., Tassilo Horn, 2018/09/16
- [elpa] externals/auctex e0caf59 25/48: Drop compatibility code for older emacsen in preview-latex, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 1fef01c 45/48: Update style/lettrine.el to package version 2.01, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex cff843b 17/48: Remove obsolete option related to Japanese TeX, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex a59c754 35/48: Adjust test for known emacs bug, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 0d5c1c0 41/48: ; Fix last commit and push missing Makefile.in., Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 45747b9 42/48: Add \eqref to RefTeX's reference styles, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex a8ea127 29/48: Accept non-ascii file name in accord with change in TL 2018, Tassilo Horn, 2018/09/16