Subject: Re: bug#63228: 13.2.0; TeX-auto-generate-global TeX-auto-parse-region: Wrong type argument: stringp, nil

From: Ikumi Keita <[email-masked]>
Date: Thu, 04 May 2023 19:56:40 +0900

Hi Sebastian,

>>>>> Sebastian Drude <[email-masked]> writes:
> But then, after parsing quite a number of files, the parser stops
> while parsing many files with the error message
> "TeX-auto-parse-region: Wrong type argument: stringp, nil"

> When I move the offending file from its directory in
> /usr/share/texlive/texmf-dist/tex/ temporarily to some other
> directory,
> the error repeats with some other file.  After moving about 30 files,
> I decided that something must be wrong.  I uninstalled the AUCTeX
> package which I installed via my package management system (Mint's
> Software Manager), which was an old version (11.91-2ubuntu2), and
> installed AUCTeX via ELPA.

> Still, the error persists.

> I cannot imagine that AUCText should have difficulties to parse so many
> files which are part of the regular LiveTeX distriution, but I am unable
> to figure out what causes the parsing error, and at what the AUCTeX
> parser is looking when it is looking at nil.

I can't tell the reason of your first failure, but I can guess the
second.

> current state:
> ==============
> (setq
>  AUCTeX-date "2023-04-24"
[...]
>  TeX-command-list '(("jTeX" "%(PDF)jtex %`%S%(PDFout)%(mode)%' %t"
[...]

The value of `TeX-command-list' is old and doesn't match the date
"2023-04-24". I think you installed ELPA AUCTeX by the very emacs
session you activated the old 11.91 AUCTeX.
Please don't do that. The old ingredients remaining in the emacs session
prevents you from successful AUCTeX operation. That would be the reason
of the error:
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   looking-at(nil)
[...]

In addition, I suppose the ELPA AUCTeX installation itself wasn't
successful. The old AUCTeX source loaded in the session didn't have
new/updated elisp macros, thus byte-compiling the new AUCTeX sources
must be broken. I recommend to re-install ELPA AUCTeX by the following
procedure:

1. Delete the current AUCTeX installation.
2. Quit the emacs session.
3. Launch a fresh emacs session and, before doing anything else, install
   ELPA AUCTeX.

> As I have not any fancy configurations not extra TeX packages
> installed, I wonder whether this is a known error which occurs with
> certain TeX style, class and further files, or whether something is
> not right with my AUCTeX installation or more generally my system.

My guess is the latter. As I described above, I think your AUCTeX
installation is broken.

By the way, it is known that `TeX-auto-generate-global' can introduce
unexpected side effects.[1] Thus I recommened you to follow Arash's
advice, writing custom style file for langscibook.cls instead of
`TeX-auto-generate-global'.

[1] https://lists.gnu.org/r/auctex/2021-01/msg00037.html

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine