polymode / poly-org

Polymode for org-mode
57 stars 13 forks source link

Polymode is triggered in #+Latex_Header org document #35

Closed frederic-santos closed 2 years ago

frederic-santos commented 2 years ago

Hi,

It seems that a recent change introduced an issue relative to the headers of an org document. Consider the following header: bug_pm

As you can see, when opening the document, polymode triggers latex-mode starting from line 13, to the end of the document, which is not what we want. (In particular, this prevents the correct use of org mode for the whole document; see for instance line 18 which is still in latex-mode.)

Looks like certain expressions are treated differently since a recent update --- the exact same header did not raise any problem with versions of polymode around late December 2021.

vspinu commented 2 years ago

Hmm. I see that the \begin head matcher is anchored to the bol here So you case should not have been matched.

Could you please provide a txt version of your example, so that I won't have to re-type all of that?

frederic-santos commented 2 years ago

Thanks! Here is the text version:

#+TITLE: Title
#+AUTHOR: Author
#+DATE: \today
#+STARTUP: showall noindent
#+LATEX_HEADER: \usepackage{a4wide}
#+LATEX_HEADER: \usepackage[usenames,dvipsnames]{xcolor}
#+LATEX_HEADER: \usepackage{minted}
#+LATEX_HEADER: \usepackage{mdframed}
#+LATEX_HEADER: \usepackage{fancyvrb}
#+LATEX_HEADER: \usemintedstyle{friendly}
#+LATEX_HEADER: \mdfdefinestyle{mystyle}{linecolor=gray!30,backgroundcolor=gray!30}
#+LATEX_HEADER: \BeforeBeginEnvironment{minted}{%
#+LATEX_HEADER: \begin{mdframed}[style=mystyle]}
#+LATEX_HEADER: \AfterEndEnvironment{minted}{%
#+LATEX_HEADER: \end{mdframed}}
#+LANGUAGE: fr

* A first org header
vspinu commented 2 years ago

Should be fixed. I wasn't looking in the right place for the regexp.