auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 3741b8ca053d3c8939784


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 3741b8ca053d3c893978487189458d1e3cf5cbea
Date: Mon, 14 May 2018 02:13:19 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  3741b8ca053d3c893978487189458d1e3cf5cbea (commit)
       via  e0caf592e022449a67a7c74ddb477f01fbb612f6 (commit)
      from  6a17a5249483065973f48d6b83e3edcceb94c850 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3741b8ca053d3c893978487189458d1e3cf5cbea
Author: Ikumi Keita <address@hidden>
Date:   Mon May 14 15:05:34 2018 +0900

    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.

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."

commit e0caf592e022449a67a7c74ddb477f01fbb612f6
Author: Ikumi Keita <address@hidden>
Date:   Mon May 14 15:03:58 2018 +0900

    Drop compatibility code for older emacsen in preview-latex
    
    We no longer need messy treatment with regard to coding system in
    preview-latex since xemacs isn't supported anymore.
    
    * preview.el.in (preview-coding-system): Remove.
    (preview-error-quote): Simplify.  Discard RUN-CODING-SYSTEM argument.
    (preview--decode-^^ab): Drop mule feature check.
    (preview--convert-^^ab): Drop compatibility code for older emacsen.
    (preview-parse-messages): Remove `run-coding-system' argument from
    calls to `preview-error-quote'.
    (TeX-inline-preview-internal): Drop codes related to coding system.
    * prv-emacs.el (preview-buffer-recode-system): Remove.
    * tests/japanese/preview-latex.el
    (japanese-preview-error-quote-shift-jis): Remove `shift_jis' argument
    from call to `preview-error-quote'.
    Remove unnecessary let bind on `TeX-japanese-process-output-coding-system'.
    (japanese-preview-process-coding-system): Remove.
    (japanese-preview-shift-jis):
    (japanese-preview-different-coding-system): Use `copy-sequence' on
    `process-environment' in order to guard it from temporal `setenv'.

diff --git a/preview.el.in b/preview.el.in
index 113d8f9..9f061c0 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -1,6 +1,7 @@
 ;;; preview.el --- embed preview LaTeX images in source buffer
 
-;; Copyright (C) 2001-2006, 2010-2015, 2017  Free Software Foundation, Inc.
+;; Copyright (C) 2001-2006, 2010-2015,
+;;               2017, 2018  Free Software Foundation, Inc.
 
 ;; Author: David Kastrup
 ;; Keywords: tex, wp, convenience
@@ -286,9 +287,6 @@ If `preview-fast-conversion' is set, this option is not
   :group 'preview-gs
   :type 'number)
 
-(defvar preview-coding-system nil
-  "Proper coding system to decode output from LaTeX process.")
-(make-variable-buffer-local 'preview-coding-system)
 (defvar preview-parsed-font-size nil
   "Font size as parsed from the log of LaTeX run.")
 (make-variable-buffer-local 'preview-parsed-font-size)
@@ -2599,14 +2597,11 @@ later while in use."
     ("Tightpage" preview-parsed-tightpage
      "\\` *\\(-?[0-9]+ *\\)\\{4\\}\\'" 0 preview-parse-tightpage)))
 
-(defun preview-error-quote (string run-coding-system)
+(defun preview-error-quote (string)
   "Turn STRING with potential ^^ sequences into a regexp.
 To preserve sanity, additional ^ prefixes are matched literally,
 so the character represented by ^^^ preceding extended characters
-will not get matched, usually.
-
-If decoding the process output was suppressed during receiving,
-decode first with RUN-CODING-SYSTEM."
+will not get matched, usually."
   (let (output case-fold-search)
     ;; Some coding systems (e.g. japanese-shift-jis) use regexp meta
     ;; characters on encoding.  Such meta characters would be
@@ -2614,19 +2609,12 @@ decode first with RUN-CODING-SYSTEM."
     ;; "encoding entire string beforehand and decoding it at the last
     ;; stage" does not work for such coding systems.
     ;; Rather, we work consistently with decoded text.
-    (if (and (featurep 'mule)
-            (not (eq run-coding-system
-                     (preview-buffer-recode-system run-coding-system))))
-       (setq string
-             (decode-coding-string string run-coding-system)))
-
-    ;; Next, bytes with value from 0x80 to 0xFF represented with ^^
-    ;; form are converted to byte sequence, and decoded by the file
-    ;; coding system.
+
+    ;; Bytes with value from 0x80 to 0xFF represented with ^^ form are
+    ;; converted to byte sequence, and decoded by the file coding
+    ;; system.
     (setq string
-         (preview--decode-^^ab string
-                               (if (featurep 'mule)
-                                   buffer-file-coding-system nil)))
+         (preview--decode-^^ab string buffer-file-coding-system))
 
     ;; Then, control characters are taken into account.
     (while (string-match "\\^\\{2,\\}\\(address@hidden)" string)
@@ -2665,9 +2653,7 @@ Return a new string."
                           (save-match-data
                             (preview--convert-^^ab
                              (match-string 0 string)))))
-                     (if (featurep 'mule)
-                         (decode-coding-string text coding-system)
-                       text)))
+                     (decode-coding-string text coding-system)))
            string (substring string (match-end 0))))
     (setq result (concat result string))
     result))
@@ -2686,12 +2672,7 @@ Return a new string."
                                 (substring string
                                            (+ (match-beginning 0) 2)
                                            (match-end 0)) 16)))
-                     ;; `char-to-string' is not appropriate in
-                     ;; Emacs >= 23 because it converts #xAB into
-                     ;; "\u00AB" (multibyte string), not "\xAB"
-                     ;; (raw 8bit unibyte string).
-                     (if (fboundp 'byte-to-string)
-                         (byte-to-string byte) (char-to-string byte))))
+                     (byte-to-string byte)))
            string (substring string (match-end 0))))
     (setq result (concat result string))
     result))
@@ -2712,7 +2693,6 @@ call, and in its CDR the final stuff for the placement 
hook."
          offset
          parsestate (case-fold-search nil)
          (run-buffer (current-buffer))
-         (run-coding-system preview-coding-system)
          (run-directory default-directory)
          tempdir
          close-data
@@ -2956,13 +2936,11 @@ name(\\([^)]+\\))\\)\\|\
                         (concat "\\("
                                 (setq string
                                       (preview-error-quote
-                                       string
-                                       run-coding-system))
+                                       string))
                                 "\\)"
                                 (setq after-string
                                       (preview-error-quote
-                                       after-string
-                                       run-coding-system)))
+                                       after-string)))
                         (line-end-position) t)
                        (goto-char (match-end 1)))
                       ((search-forward-regexp
@@ -3562,20 +3540,6 @@ internal parameters, STR may be a log to insert into the 
current log."
          (preview-set-geometry geometry)
          (setq preview-gs-file pr-file)
          (setq TeX-sentinel-function 'preview-TeX-inline-sentinel)
-         ;; Postpone decoding of process output for xemacs 21.4,
-         ;; which is rather bad at preserving incomplete multibyte
-         ;; characters.
-         (when (featurep 'mule)
-           ;; Get process coding system set in `TeX-run-command'.
-           (setq preview-coding-system (process-coding-system process))
-           ;; Substitute coding system for decode with `raw-text' if
-           ;; necessary and save the original coding system for
-           ;; decode for later use in `preview-error-quote'.
-           (set-process-coding-system process
-                                      (preview-buffer-recode-system
-                                       (car preview-coding-system))
-                                      (cdr preview-coding-system))
-           (setq preview-coding-system (car preview-coding-system)))
          (TeX-parse-reset)
          (setq TeX-parse-function 'TeX-parse-TeX)
          (if TeX-process-asynchronous
diff --git a/prv-emacs.el b/prv-emacs.el
index 9f40736..fe0f8f9 100644
--- a/prv-emacs.el
+++ b/prv-emacs.el
@@ -1,6 +1,6 @@
 ;;; prv-emacs.el --- GNU Emacs specific code for preview.el
 
-;; Copyright (C) 2001, 02, 03, 04, 05  Free Software Foundation, Inc.
+;; Copyright (C) 2001-2005, 2018  Free Software Foundation, Inc.
 
 ;; Author: David Kastrup
 ;; Keywords: convenience, tex, wp
@@ -369,12 +369,6 @@ purposes."
           event
         (posn-window (event-start event))))))
 
-(defsubst preview-buffer-recode-system (base)
-  "This is supposed to translate unrepresentable base encodings
-into something that can be used safely for byte streams in the
-run buffer.  A noop for Emacs."
-  base)
-
 (defun preview-mode-setup ()
   "Setup proper buffer hooks and behavior for previews."
   (set (make-local-variable 'desktop-save-buffer)
diff --git a/tests/japanese/preview-latex.el b/tests/japanese/preview-latex.el
index 44697d6..4831942 100644
--- a/tests/japanese/preview-latex.el
+++ b/tests/japanese/preview-latex.el
@@ -1,6 +1,6 @@
 ;;; preview-latex.el --- tests for preview-latex compatibility
 
-;; Copyright (C) 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2018 Free Software Foundation, Inc.
 
 ;; This file is part of AUCTeX.
 
@@ -37,7 +37,7 @@
 
 ;; Make sure coding system output from tex process to be expected
 ;; value.
-(setq japanese-TeX-use-kanji-opt-flag t) ; assume unix or darwin.
+(setq japanese-TeX-use-kanji-opt-flag t)
 
 (setq TeX-process-asynchronous t)
 (setq TeX-after-start-process-function #'TeX-adjust-process-coding-system)
@@ -51,7 +51,7 @@ character used to cause trouble.  Such patterns are tested."
   (skip-unless (not noninteractive))
   (let ((TeX-clean-confirm nil)
        (preview-auto-cache-preamble nil)
-       (process-environment process-environment)
+       (process-environment (copy-sequence process-environment))
        (locale-coding-system 'shift_jis)
        (TeX-japanese-process-output-coding-system nil)
        (TeX-japanese-process-input-coding-system nil))
@@ -101,7 +101,7 @@ the process differ."
   (skip-unless (not noninteractive))
   (let ((TeX-clean-confirm nil)
        (preview-auto-cache-preamble nil)
-       (process-environment process-environment)
+       (process-environment (copy-sequence process-environment))
        (locale-coding-system 'shift_jis)
        (TeX-japanese-process-output-coding-system nil)
        (TeX-japanese-process-input-coding-system nil))
@@ -190,10 +190,9 @@ Did the image come out at the correct position? ")))
   "`preview-error-quote' is robust against `shift_jis' or not.
 String encoded in `shift_jis' can have regexp meta characters in it."
   (let (case-fold-search
-       (buffer-file-coding-system 'shift_jis)
-       (TeX-japanese-process-output-coding-system nil))
+       (buffer-file-coding-system 'shift_jis))
     (dolist (str '("$BI=(B(1)" "$BM=(B{a}" "$BG=(B\|" "{$B$"(B} 
%$BG=(B" "$B%"!<%9(B" "$B7?(B"))
-      (should (string-match (preview-error-quote str 'shift_jis) str)))))
+      (should (string-match (preview-error-quote str) str)))))
 
 (ert-deftest japanese-preview-decode-^^ab ()
   "`preview--decode-^^ab' doesn't leave regexp meta characters in results."
@@ -215,45 +214,6 @@ String encoded in `shift_jis' can have regexp meta 
characters in it."
     (should (string= (preview--convert-^^ab "^^^a0") "^\xa0"))
     (should (string= (preview--convert-^^ab "^^c0^^Ab") "\xc0^^Ab"))))
 
-(ert-deftest japanese-preview-process-coding-system ()
-  "`TeX-inline-preview-internal' records process coding system or not.
-It used to discard the coding system for decode without recording
-previously set by `japanese-TeX-set-process-coding-system'."
-  (let ((dummyfile (make-temp-file "japanese-TeX-ert"))
-       (file-cs 'japanese-shift-jis-unix)
-       (locale-cs 'japanese-iso-8bit-unix)
-       ;; Make `preview-call-hook' inactive.
-       (preview-image-creators nil)
-       process)
-    (find-file dummyfile)
-    ;; Make `japanese-TeX-set-process-coding-system' to be called in
-    ;; `TeX-adjust-process-coding-system'.
-    (setq japanese-TeX-mode t)
-    (setq buffer-file-coding-system file-cs)
-    (unwind-protect
-       (progn
-         (setq process (TeX-inline-preview-internal
-                        "echo foo" dummyfile '(nil . nil) (current-buffer)
-                        '(nil . nil) dummyfile '(nil nil nil)))
-         ;; coding system assigned by `TeX-run-command' should be saved in
-         ;; `preview-coding-system'.
-         (should (coding-system-equal locale-cs preview-coding-system))
-         ;; actual process coding system should be the one derived from the
-         ;; original coding system via `preview-buffer-recode-system'.
-         (should (coding-system-equal
-                  (car (process-coding-system process))
-                  (preview-buffer-recode-system locale-cs)))))
-    ;; Cleanup.
-    ;; Let process to exit before finishing test.
-    (accept-process-output process)
-    (set-buffer (get-file-buffer dummyfile))
-    (let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
-          (process (get-buffer-process buffer)))
-      (if process (delete-process process))
-      (kill-buffer buffer))
-    (kill-buffer)
-    (delete-file dummyfile)))
-
 (ert-deftest japanese-preview-preserve-kanji-option2 ()
   "`TeX-inline-preview-internal' preserve kanji option or not."
   (let ((TeX-clean-confirm nil)

-----------------------------------------------------------------------

Summary of changes:
 preview.el.in                   | 62 ++++++----------------------
 prv-emacs.el                    |  8 +---
 tests/japanese/preview-latex.el | 52 +++---------------------
 tex-buf.el                      | 89 ++++++++++++++++++++++-------------------
 4 files changed, 67 insertions(+), 144 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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