emacs-diffs
[Top][All Lists]
Advanced

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

master e74f60f 3/4: Fix file name quoting problems in tex-mode


From: Lars Ingebrigtsen
Subject: master e74f60f 3/4: Fix file name quoting problems in tex-mode
Date: Mon, 7 Dec 2020 07:37:50 -0500 (EST)

branch: master
commit e74f60fde0bcaa1b6b0ac3bbd83f39421f13c6b3
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/textmodes/tex-mode.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 37ab11a..5923845 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



reply via email to

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