Subject: bug#14286: Tex-mode always picks the first command in tex-compile-commands on Windows

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 06 Dec 2020 19:26:31 +0100

"Jérôme M. Berger" <[email-masked]> writes:

> 	Tex-mode is supposed to pick the most appropriate command in
> tex-compile-commands depending on the situation. However, on Windows
> it always picks the first command (and probably on Linux if TeX is
> installed in some non-standard locations).
>
> 	This is due to the fact that the executables are shell-quoted which
> prevents the detection logic in tex-command-active-p from working.
> It works on Linux because most of the time shell-quoting leaves the
> string intact, whereas on Windows shell-quoting always adds double
> quotes around the string.

[...]

> (defun tex-command-active-p (cmd fspec)
>   "Return non-nil if the CMD spec might need to be run."
>   (let ((in (nth 1 cmd))
>         (out (nth 2 cmd)))
>     (if (stringp in)
>         (let ((file (jb-tex-unquote (format-spec in fspec))))
>           (when (file-exists-p file)
>             (or (not out)
>                 (file-newer-than-file-p
>                  file (jb-tex-unquote
>                        (format-spec out fspec))))))
>       (when (and (eq in t) (stringp out))
>         (not (tex-uptodate-p (jb-tex-unquote
>                               (format-spec out fspec))))))))

(This bug report unfortunately got no response at the time.)

Thanks -- I think it would be better to just avoid quoting the file
names altogether -- until we need to when actually issuing commands on
the files.  I've done this in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no