tecosaur / org-glossary

Mirror of https://git.tecosaur.net/tec/org-glossary
GNU General Public License v3.0
94 stars 4 forks source link

Bug: org-glossary loses track of acronym definitions from external sources after first export. #24

Open Cerebus opened 1 month ago

Cerebus commented 1 month ago

I have so far been unable to create a minimal example, so I'm mainly looking for pointers where to dig unless there's something obvious I'm missing. See below for minimal example.

I'm using a heavily customized LaTeX export with org-glossary and external term sources. org-glossary is effectively stock, except that I've removed backref linking for glossaries and acronyms:

(with-eval-after-load 'org-glossary
  (org-glossary-set-export-spec 'latex 'glossary
    :backref ""
    :backref-seperator "")
  (org-glossary-set-export-spec 'latex 'acronym 
    :backref ""
    :backref-seperator ""))

org-glossary seems to lose track of /acronyms definitions only/. The acronyms are found in the external source, but only the acronym is collected; the expansion is not. This shows up both on export and in org-glossary-mode. E.g., here's a glossary term tooltip, working correctly:

image

And here's an acronym, defined in the same source:

image

On export, the Glossary section is correct, but the Acronyms section lacks the term expansions.

\section{Acronyms}
\label{sec:orgebcdcac}
\textbf{C}

\textbf{\hypertarget{gls-3}{COP}}\hspace*{1em}\hspace*{.5em}

The really frustrating part is /sometimes it will work correctly/. But then it stops, and nothing seems to get it back except restarting emacs. So there's some state changing somewhere as a side effect of something, but I have no idea what it could be.

Cerebus commented 1 month ago

OK, minimal example, emacs 29.3 running under emacs -Q

minimal.org

#+glossary_sources: min-glos

lorem ipsum FOO and BAR.

min-glos.org

* Acronyms
- FOO :: A metasyntactic variable

At this point, everything is correct. "FOO" is fontified and linked to min-gloss.org, the tooltip shows the definition, and the rendered LaTeX has the first use expanded, and an Acronyms section with FOO defined.

\begin{document}

\tableofcontents

lorem ipsum A metasyntactic variable
 (\protect\hyperlink{gls-1}{\label{gls-1-use-1}FOO}) and BAR.

\section{Acronyms}
\label{sec:org5a50601}
\textbf{\hypertarget{gls-1}{FOO}}\hspace*{1em}A metasyntactic variable\hspace*{.5em}\pageref{gls-1-use-1}
\end{document}

Now it's broken. "FOO" is fontified and linked, but the tooltip lacks the definition, and the rendered LaTeX has the inline term but not the expansion, and the expansion is missing from the Acronyms section.

\begin{document}

\tableofcontents

lorem ipsum  (\protect\hyperlink{gls-1}{\label{gls-1-use-1}FOO}) and BAR.

\section{Acronyms}
\label{sec:orgcc1005a}
\textbf{\hypertarget{gls-1}{FOO}}\hspace*{1em}\hspace*{.5em}\pageref{gls-1-use-1}
\end{document}

Further, this appear to be a problem with external sources only. If I insert-file min-glos.org into minimal.org, then the tooltip expansion reappears and LaTeX export is correct.