Rasmus <ras...@gmx.us> writes:

> 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.

I see. Another idea:

  (let ((beg (point-marker))
        (end (copy-marker (point) t)))
    (cdlatex-environment "equation")
    (prog1 (delete-and-extract-region beg end)
      (set-marker beg nil)
      (set-marker end nil)))

If it is not the empty string, indent it and insert it again...


Regards,

Reply via email to