Accepting request 625210 from editors

- Add patches/commits from upstream utf8-names-3b1ffcd8.patch and
  utf8-names-a8ea1273.patch to be able handle files names with
  UTF-8 characters as well

OBS-URL: https://build.opensuse.org/request/show/625210
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/emacs-auctex?expand=0&rev=36
This commit is contained in:
Dominique Leuenberger 2018-07-25 14:14:23 +00:00 committed by Git OBS Bridge
commit 8a8f6cb5e8
4 changed files with 315 additions and 1 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jul 25 08:47:45 UTC 2018 - werner@suse.de
- Add patches/commits from upstream utf8-names-3b1ffcd8.patch and
utf8-names-a8ea1273.patch to be able handle files names with
UTF-8 characters as well
-------------------------------------------------------------------
Wed Apr 18 07:56:53 UTC 2018 - werner@suse.de

View File

@ -45,7 +45,8 @@ Url: http://www.gnu.org/software/auctex
# Allows to select printer instance
# PATCH-FEATURE-UPSTREAM dvips.patch
Patch0: dvips.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch10: utf8-names-3b1ffcd8.patch
Patch11: utf8-names-a8ea1273.patch
BuildArch: noarch
%description
@ -68,6 +69,8 @@ you cannot use this package for XEmacs.
%prep
%setup -n auctex-%{version}
%patch0
%patch10
%patch11
%build
unset ${!LC_*}

81
utf8-names-3b1ffcd8.patch Normal file
View File

@ -0,0 +1,81 @@
Based on 3b1ffcd8c3387f67fd9be5e1da73d780dffbdd51 Mon Sep 17 00:00:00 2001
From: Ikumi Keita <ikumi@ikumi.que.jp>
Date: Mon, 28 May 2018 14:46:52 +0900
Subject: [PATCH] TL 2018 non-ascii file name fix for preview-latex
* preview.el.in (preview-LaTeX-command): Wrap file name after implicit
\input in \detokenize{}.
(preview-cache-preamble): Arrange the ini file code so that non-ascii
file name can be used with generated format file. Be careful not to
lose capability of handling file name with space.
(preview-undump-replacements): Use new TeX macro defined in the above
ini file code to accept even unusual file name with non-ascii
character or space.
Delegate quoting of format name to `TeX-inline-preview-internal' so
that non-ascii character will not be quoted twice.
(TeX-inline-preview-internal): Adjust to the above change.
---
preview.el.in | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
--- preview.el.in
+++ preview.el.in 2018-07-25 08:32:38.554859129 +0000
@@ -2227,7 +2227,14 @@ list of LaTeX commands is inserted just
(defcustom preview-LaTeX-command '("%`%l \"\\nonstopmode\\nofiles\
\\PassOptionsToPackage{" ("," . preview-required-option-list) "}{preview}\
\\AtBeginDocument{\\ifx\\ifPreview\\undefined"
-preview-default-preamble "\\fi}\"%' %t")
+preview-default-preamble "\\fi}\"%' \"{\\detokenize{\" %t \"}}\"")
+ ;; Since TeXLive 2018, the default encoding for LaTeX files has been
+ ;; changed to UTF-8 if used with classic TeX or pdfTeX. I.e.,
+ ;; \usepackage[utf8]{inputenc} is enabled by default in (pdf)latex.
+ ;; c.f. LaTeX News issue 28
+ ;; Due to this change, \detokenize is required to recognize
+ ;; non-ascii characters in the file name when \input is supplemented
+ ;; implicitly by %`-%' pair.
"*Command used for starting a preview.
See description of `TeX-command-list' for details."
:group 'preview-latex
@@ -3302,8 +3309,12 @@ This is passed through `preview-do-repla
(defcustom preview-undump-replacements
'(("\\`\\([^ ]+\\)\
- .*? \"\\\\input\" \\(.*\\)\\'"
- . ("\\1 -interaction=nonstopmode \"&" preview-format-name "\" \\2")))
+ .*? \"\\\\input\" \"{\\\\detokenize{\" \\(.*\\) \"}}\"\\'"
+ . ("\\1 -interaction=nonstopmode " preview-format-name
+ " \"/AUCTEXINPUT{\" \\2 \"}\"")))
+ ;; See the ini file code below in `preview-cache-preamble' for the
+ ;; wierd /AUCTEXINPUT construct. In short, it is crafted so that
+ ;; dumped format file can read file of non-ascii name.
"Use a dumped format for reading preamble."
:group 'preview-latex
:type '(repeat
@@ -3347,8 +3358,11 @@ If FORMAT-CONS is non-nil, a previous fo
;; in the tools bundle is an empty file.
(write-region "\\ifx\\pdfoutput\\undefined\\else\
\\let\\PREVIEWdump\\dump\\def\\dump{%
-\\edef\\next{{\\catcode`\\ 9 \\pdfoutput=\\the\\pdfoutput\\relax\
-\\the\\everyjob}}\\everyjob\\next\\catcode`\\ 10 \\let\\dump\\PREVIEWdump\\dump}\\fi\\input mylatex.ltx \\relax\n" nil dump-file)
+\\edef\\next{{\\pdfoutput=\\the\\pdfoutput\\relax\
+\\the\\everyjob}}\\everyjob\\next\\catcode`\\ 10 %
+\\catcode`/ 0 %
+\\def\\AUCTEXINPUT##1{\\catcode`/ 12\\relax\\catcode`\\ 9\\relax\\input{\\detokenize{##1}}}%
+\\let\\dump\\PREVIEWdump\\dump}\\fi\\input mylatex.ltx \\relax%\n" nil dump-file)
(TeX-save-document master)
(prog1
(preview-generate-preview
@@ -3535,9 +3549,10 @@ internal parameters, STR may be a log to
(set-buffer commandbuff)
(let*
((preview-format-name (shell-quote-argument
- (preview-dump-file-name
- (file-name-nondirectory master))))
- (process-environment process-environment)
+ (concat "&"
+ (preview-dump-file-name
+ (file-name-nondirectory master)))))
+ (process-environment (copy-sequence process-environment))
(process
(progn
;; Fix Bug#20773, Bug#27088.

223
utf8-names-a8ea1273.patch Normal file
View File

@ -0,0 +1,223 @@
Based on a8ea1273fd95da5702fe95ad3f41d151b621bc72 Mon Sep 17 00:00:00 2001
From: Ikumi Keita <ikumi@ikumi.que.jp>
Date: Mon, 28 May 2018 14:39:26 +0900
Subject: [PATCH] Accept non-ascii file name in accord with change in TL 2018
* tex.el (TeX-expand-list-builtin): Add new entry %T. Same as %t,
except to enclose with \detokenize{} for non UTF-8 LaTeX when \input
is supplmented.
Adjust the entries %` and %' so that \input is supplemented only when
any TeX code is present between them and leave the bind to
`TeX-command-text' for later examination.
The bind to `TeX-command-pos' is no longer retained.
(TeX-command-list): Use %T for "LaTeX".
Adjust "TeX" and "AmSTeX" as the same with "LaTeX" in the aspect that
user can supply one's own TeX code, as well as any command line
options, through `TeX-command-extra-options'.
* tex-buf.el (TeX--master-or-region-file-with-extra-quotes): New
function to act as a wrapper of `TeX-master-file' and
`TeX-region-file' inside `TeX-command-expand'.
(TeX-command-expand): Use the above function as the value of `file'
and get rid of tricky temporal overriding of `file' with lambda form.
(TeX-region-create): Make the first line parsing of %&FORMAT
construct, if any, to be valid even for region compilation.
Discard text properties when constructing the content of _region_.tex.
Drop bind check for `buffer-file-coding-system'.
* tests/tex/command-expansion.el (TeX-command-expansion): Reflect the
change that \input is not necessarily supplemented now by %`-%' pair
in `TeX-command-expand'.
---
tex-buf.el | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++----------
tex.el | 38 +++++++++++++++++------------
2 files changed, 88 insertions(+), 28 deletions(-)
--- tex-buf.el
+++ tex-buf.el 2018-07-25 08:47:13.599124117 +0000
@@ -554,12 +554,8 @@ without further expansion."
(let (pat
pos ;;FIXME: Should this be dynamically scoped?
entry TeX-command-text TeX-command-pos
- ;; FIXME: This variable appears to be unused!
- (file `(lambda (&rest args)
- (shell-quote-argument
- (concat (and (stringp TeX-command-pos) TeX-command-pos)
- (apply #',file args)
- (and (stringp TeX-command-pos) TeX-command-pos)))))
+ (orig-file file)
+ (file #'TeX--master-or-region-file-with-extra-quotes)
expansion-res case-fold-search string expansion arguments)
(setq list (cons
(list "%%" (lambda nil
@@ -597,6 +593,47 @@ without further expansion."
(replace-match string t t command)))))
command)
+(defun TeX--master-or-region-file-with-extra-quotes
+ (&optional extension nondirectory ask extra)
+ "Return file name with quote for shell.
+Wrapper for `TeX-master-file' or `TeX-region-file' to be used in
+`TeX-command-expand'.
+It is assumed that `orig-file' has dynamic binding of the value of
+`TeX-master-file' or `TeX-region-file'. Pass EXTENSION, NONDIRECTORY
+and ASK to that function as-is, and arrange the returned file name for
+use with command shell.
+Enclose the file name with space within quotes `\"' first when
+\" \\input\" is supplemented (indicated by dynamically binded
+variable `TeX-command-text' having string value.)
+Enclose the file name within \\detokenize{} when the following three
+conditions are met:
+1. compiling with standard (pdf)LaTeX or upLaTeX
+2. \" \\input\" is supplemented
+3. EXTRA is non-nil. (default when expanding \"%T\")"
+ (shell-quote-argument
+ (let* ((raw (funcall orig-file extension nondirectory ask))
+ ;; String `TeX-command-text' means that the file name is
+ ;; given through \input command.
+ (quote-for-space (if (and (stringp TeX-command-text)
+ (string-match " " raw))
+ "\"" "")))
+ (format
+ (if (and extra
+ (stringp TeX-command-text)
+ (memq major-mode '(latex-mode doctex-mode))
+ (memq TeX-engine '(default uptex)))
+ ;; Since TeXLive 2018, the default encoding for LaTeX
+ ;; files has been changed to UTF-8 if used with
+ ;; classic TeX or pdfTeX. I.e.,
+ ;; \usepackage[utf8]{inputenc} is enabled by default
+ ;; in (pdf)latex.
+ ;; c.f. LaTeX News issue 28
+ ;; Due to this change, \detokenize is required to
+ ;; recognize non-ascii characters in the file name
+ ;; when \input precedes.
+ "\\detokenize{ %s }" "%s")
+ (concat quote-for-space raw quote-for-space)))))
+
(defun TeX-check-files (derived originals extensions)
"Check if DERIVED is newer than any of the ORIGINALS.
Try each original with each member of EXTENSIONS, in all directories
@@ -2104,8 +2141,10 @@ original file."
(if (not (re-search-forward TeX-header-end nil t))
""
(re-search-forward "[\r\n]" nil t)
- (buffer-substring (point-min) (point)))))))))
+ (buffer-substring-no-properties
+ (point-min) (point)))))))))
(header-offset 0)
+ first-line
;; We search for the trailer from the master file, if it is
;; not present in the region.
(trailer-offset 0)
@@ -2125,21 +2164,36 @@ original file."
;;(beginning-of-line 1)
(re-search-backward "[\r\n]" nil t)
(setq trailer-offset (TeX-current-offset))
- (buffer-substring (point) (point-max))))))))))
+ (buffer-substring-no-properties
+ (point) (point-max))))))))))
;; file name should be relative to master
(setq original (TeX-quote-filename (file-relative-name
original (TeX-master-directory)))
master-name (TeX-quote-filename master-name))
+
+ ;; If the first line begins with "%&", put that line separately on
+ ;; the very first line of the region file so that the first line
+ ;; parsing will work.
+ (setq first-line (if (and (> (length header) 1)
+ (string= (substring header 0 2) "%&"))
+ ;; This would work even if header has no newline.
+ (substring header 0 (string-match "\n" header))
+ ""))
+ (unless (string= first-line "")
+ ;; Remove first-line from header.
+ (setq header (substring header (length first-line)))
+ (setq first-line (concat first-line "\n")))
+
(with-current-buffer file-buffer
(setq buffer-read-only t
buffer-undo-list t)
(setq original-content (buffer-string))
(let ((inhibit-read-only t))
(erase-buffer)
- (when (boundp 'buffer-file-coding-system)
- (setq buffer-file-coding-system
- (with-current-buffer master-buffer buffer-file-coding-system)))
- (insert "\\message{ !name(" master-name ")}"
+ (setq buffer-file-coding-system
+ (with-current-buffer master-buffer buffer-file-coding-system))
+ (insert first-line
+ "\\message{ !name(" master-name ")}"
header
TeX-region-extra
"\n\\message{ !name(" original ") !offset(")
--- tex.el
+++ tex.el 2018-07-25 08:47:13.599124117 +0000
@@ -121,10 +121,10 @@ If nil, none is specified."
;; `TeX-expand-list-builtin' for a description of the % escapes
(defcustom TeX-command-list
- '(("TeX" "%(PDF)%(tex) %(file-line-error) %(extraopts) %`%S%(PDFout)%(mode)%' %t"
+ '(("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %t"
TeX-run-TeX nil
(plain-tex-mode ams-tex-mode texinfo-mode) :help "Run plain TeX")
- ("LaTeX" "%`%l%(mode)%' %t"
+ ("LaTeX" "%`%l%(mode)%' %T"
TeX-run-TeX nil
(latex-mode doctex-mode) :help "Run LaTeX")
;; Not part of standard TeX.
@@ -132,7 +132,7 @@ If nil, none is specified."
(texinfo-mode) :help "Run Makeinfo with Info output")
("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil
(texinfo-mode) :help "Run Makeinfo with HTML output")
- ("AmSTeX" "amstex %(PDFout) %(extraopts) %`%S%(mode)%' %t"
+ ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %t"
TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
;; support for ConTeXt --pg
;; first version of ConTeXt to support nonstopmode: 2003.2.10
@@ -503,8 +503,19 @@ string."
;; `file' means to call `TeX-master-file' or `TeX-region-file'
("%s" file nil t)
("%t" file t t)
+ ;; If any TeX codes appear in the interval between %` and %', move
+ ;; all of them after the interval and supplement " \input". The
+ ;; appearance is marked by leaving the bind to `TeX-command-text'
+ ;; with the TeX codes.
+ ;; Rule:
+ ;; 1. %` and %' must appear in pair.
+ ;; 2. %` and %' must not appear more than once in one command
+ ;; line string (including the results of %-expansion).
+ ;; 3. Each TeX codes between %` and %' must be enclosed in
+ ;; double quotes and preceded by a space.
("%`" (lambda nil
- (setq TeX-command-pos t TeX-command-text "")))
+ (setq TeX-command-pos t TeX-command-text nil)
+ ""))
(" \"\\" (lambda nil
(if (eq TeX-command-pos t)
(setq TeX-command-pos pos
@@ -528,18 +539,13 @@ string."
TeX-command-pos t)
(setq pos (1+ pos)))))
("%'" (lambda nil
- (prog1
- (if (stringp TeX-command-text)
- (progn
- (setq pos (+ pos (length TeX-command-text) 9)
- TeX-command-pos
- (and (string-match " "
- (funcall file t t))
- "\""))
- (concat TeX-command-text " \"\\input\""))
- (setq TeX-command-pos nil)
- "")
- (setq TeX-command-text nil))))
+ (setq TeX-command-pos nil)
+ (if (stringp TeX-command-text)
+ (progn
+ (setq pos (+ pos (length TeX-command-text) 9))
+ (concat TeX-command-text " \"\\input\""))
+ "")))
+ ("%T" TeX--master-or-region-file-with-extra-quotes t t nil t)
("%n" TeX-current-line)
("%d" file "dvi" t)
("%f" file "ps" t)