Hi Ichor.

I did you what you said. There are two scenarios
Scenario 1:

   1. Load auctex and set TeX-parse-self to t
   2. Create a scratch buffer and type in "\documentclass{article}"
   3. Load LaTeX-mode with M-x LaTeX-mode

Scenario 2:

   1. Load auctex and set TeX-parse-self to t
   2. Create a scratch buffer and type in "\documentclass{amsart}". Note
   that this is different from Scenario 1. The difference is that amsart uses
   the amstex package. Org export to latex also uses the amstex package.
   3. Load LaTeX-mode with M-x LaTeX-mode

With Scenario 1 I don't get an error but with Scenario 2 I
do. reftex-TeX-master-file: Wrong type argument: stringp, nil

As I said in a previous email, this may also be a bug with reftex. Looking
at the code of reftex-TeX-master-file, I can see that

(let ((master
        (cond
         ;; AUCTeX is loaded.  Use its mechanism.
         ((fboundp 'TeX-master-file)
          (condition-case nil
              (TeX-master-file t)
            (error (buffer-file-name)))))))

and then later it says
    (cond
     ((null master)
      (error "Need a filename for this buffer, please save it first"))

However, TeX-master-file returns "<none>" if the file is not saved instead
of nil, so it seems that reftex-TeX-master-file uses TeX-master-file
wrongly. However, even if reftex-TeX-master-file did use TeX-master-file
correctly, org-mode would still have a problem because it would hit
the (error "Need a filename for this buffer, please save it first").
Because of this I believe that both reftex and org have a bug.

On Mon, 30 Jun 2025 at 18:40, Ihor Radchenko <yanta...@posteo.net> wrote:

> Vangelis E <evange...@gmail.com> writes:
>
> > Does this mean that you will implement my suggestion in my previous
> email?
> >
> >> On 30 Jun 2025, at 17:42, Pedro Andres Aranda Gutierrez <
> paag...@gmail.com> wrote:
> >>
> >> Thanks for trying! I'm just trying to find a flexible solution for
> >> future requirements like this...
> >> /PA
> >> ...
>
> Before this discussion stray too far away, and before I look into the
> report seriously, I have a suspicion that you are simply running into
> Auctex bug. Try creating a new buffer, not associated with any file,
> add some basic text code inside, and activate auctex there. Will it err?
> If yes, that's a bug in auctex.
>
> --
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>

Reply via email to