Subject: AW: bug#55511: 13.1.3; TeX-auto-store issues with complex paths

From: Cyril Arnould <[email-masked]>
Date: Mon, 23 May 2022 22:16:57 +0000

To Keita:

Thanks!

>I think that AUCTeX can introduce a new user option to decide whether
>to aggregate them in one auto directory or save into each auto
>subdirectory separately.

Is it important for the user to have control over this? The only reason
I can think of for keeping support for one auto folder in the master
location would be backwards compatibility with old auto folders.

To Arash:

>Hmm, can't tell what's going wrong.  I'm also using Msys2/Mingw64 on
>Win10 and don't see this issue.  I do:

I think I've narrowed it down a bit, I have mingw-w64-x86_64-sed
installed. If I remove the package, it uses the /usr/bin/sed and
finishes with no issues. So the problem seems to either be with the
mingw-w64-x86_64-sed or incorrect handling of that variant of sed by the
configure script.

>The reason I was asking it that active contributors don't use
>use-package and we currently have this in the manual:
>
>(use-package tex
>  :ensure auctex)
>
>If that's not right, we should change it (but it seems there is no
>definitive answer to this ;-)

As far as I know, the simplest use-package definition would be to just
load a preinstalled package. The following two lines would be
equivalent if I'm not mistaken:

(use-package vlf)
(require 'vlf)

Since vlf (very large file mode) is not part of Emacs itself, I also
need to use the :ensure keyword in my .emacs file. If vlf is not found
in the load-path, this will use package.el to install it automatically:

(use-package vlf
  :ensure t)

The problem with AUCTeX is that there's no (provide 'auctex) feature, so
(use-package auctex) will fail because it can't (require 'auctex). If
I'm not mistaken, the reason there's no (provide 'auctex) is because
AUCTeX redefines already existing modes, i.e. plain-tex-mode and
latex-mode. Now, with the following lines however, use-package will make
sure the auctex package is installed and then (require 'tex):

(use-package tex
  :ensure auctex)

Now, to the question whether to use (use-package tex) vs. (use-package
latex): I think it doesn't matter precisely because the features AUCTeX
implements already exist. Having the .emacs.d/elpa/auctex-13.1.3 folder
in the load-path (which package.el will do automatically upon
installation) will make sure AUCTeX is used instead of the Emacs
TeX-mode, so neither (require 'tex) nor (require 'latex) seem to be
necessary at all.

I guess Emacs already loads all of the packages at some point after the
user init file? Not quite sure. If that's not it, then I guess
(use-package latex) also works because latex.el has (require 'tex) at
the top.

I've also remembered why I specifically wanted to work with (use-package
latex) rather than (use-package tex): I wanted to redefine keybindings
of the LaTeX-mode-map, for which I need to (require 'latex)
resp. (use-package latex) in the init file already:

(use-package latex
  :ensure auctex
  :bind
  (:map LaTeX-mode-map
        ("C-c b" . TeX-command-buffer)
        ("C-c C-b" . align-current)
        ("C-c c" . TeX-command-master)
        ("C-c C-c" . comment-or-uncomment-region))
  :init
  (add-hook 'TeX-after-compilation-finished-functions
            #'TeX-revert-document-buffer))

On a side note, I've also just noticed that I don't have to :ensure the
auctex package is installed in the (use-package reftex) definition since
reftex is part of Emacs. I thought it was part of AUCTeX as well.

So, long story short, (use-package tex) is fine as long as you don't
need to modify any of another provided package's definitions. If I'm not
mistaken though, use-package should work with any other of the provided
packages.