Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Another idea: insert the environment in a temp buffer. Check for buffer
> emptiness. If there is something, insert it with appropriate
> indentation.

It's a very good idea!  On the top of my head there's two issues.

 1. cdlatex-environment doesn't work with buffers, only files...¹ I think
    it doesn't even work with (with-temp-file · ⋯) without saving the file
    first.  Try:

         (require 'cdlatex)
         (require 'reftex)
         (with-temp-buffer (cdlatex-environment "equation"))

2. if run from a temporary buffer, the refcounter would always be one.
    Perhaps there would be a way to update it afterwards.

—Rasmus

Footnotes: 
¹   https://github.com/cdominik/cdlatex/issues/3

-- 
Sådan en god dansk lagereddike kan man slet ikke bruge mere

Reply via email to