unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14286: Tex-mode always picks the first command in tex-compile-commands on Windows
@ 2013-04-27  9:07 Jérôme M. Berger
  2020-12-06 18:26 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Jérôme M. Berger @ 2013-04-27  9:07 UTC (permalink / raw)
  To: 14286

[-- Attachment #1: Type: text/plain, Size: 1527 bytes --]

	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.

	I have been able to work around the issue by adding the following
to my configuration:

====================8<--------------------
(defun jb-tex-unquote (str)
  (mapconcat
   (lambda (str) str)
   (split-string-and-unquote str)
   ""))

(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))))))))
-------------------->8====================

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#14286: Tex-mode always picks the first command in tex-compile-commands on Windows
  2013-04-27  9:07 bug#14286: Tex-mode always picks the first command in tex-compile-commands on Windows Jérôme M. Berger
@ 2020-12-06 18:26 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-06 18:26 UTC (permalink / raw)
  To: Jérôme M. Berger; +Cc: 14286

"Jérôme M. Berger" <jeberger@free.fr> 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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-06 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-27  9:07 bug#14286: Tex-mode always picks the first command in tex-compile-commands on Windows Jérôme M. Berger
2020-12-06 18:26 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).