From: Lars Ingebrigtsen Date: Sun, 6 Dec 2020 18:25:43 +0000 (+0100) Subject: Fix file name quoting problems in tex-mode X-Git-Tag: emacs-28.0.90~4882 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e74f60fde0bcaa1b6b0ac3bbd83f39421f13c6b3;p=emacs.git Fix file name quoting problems in tex-mode * lisp/textmodes/tex-mode.el (tex--quote-spec): New function (bug#14286). (tex-format-cmd): Use it. (tex-compile): Don't quote the file names, because we're using `file-exists-p' and friends on the results later, and that fails on systems where everything is quoted, and on file names that need quoting. --- diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 37ab11ad89f..59238452a4d 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2331,9 +2331,14 @@ FILE is typically the output DVI or PDF file." :version "23.1" :group 'tex-run) +(defun tex--quote-spec (fspec) + (cl-loop for (char . file) in fspec + collect (cons char (shell-quote-argument file)))) + (defun tex-format-cmd (format fspec) "Like `format-spec' but adds user-specified args to the command. Only applies the FSPEC to the args part of FORMAT." + (setq fspec (tex--quote-spec fspec)) (if (not (string-match "\\([^ /\\]+\\) " format)) (format-spec format fspec) (let* ((prefix (substring format 0 (match-beginning 0))) @@ -2430,8 +2435,8 @@ Only applies the FSPEC to the args part of FORMAT." (prog1 (file-name-directory (expand-file-name file)) (setq file (file-name-nondirectory file)))) (root (file-name-sans-extension file)) - (fspec (list (cons ?r (shell-quote-argument root)) - (cons ?f (shell-quote-argument file)))) + (fspec (list (cons ?r root) + (cons ?f file))) (default (tex-compile-default fspec))) (list default-directory (completing-read