Hi, Nicolas Goaziou writes: >> Perhaps there are clever ways to figure it out. I say there are too many >> dynamics and "fixes" in the code to get cdlatex-environment to work >> already. Just consider this example where | is cursor >> >> - foo | bar >> >> Midway through, when ENV is reinserted, but before indentation the >> end-marker will be *after* bar which is a line after \end{ENV}... > > This is exactly what we want: indent (non empty) lines starting in > [BEG ; END[. Or am I missing something? OK, the missing key is org-indent-line-to. It works better in this case and I can use end. >> Anyway it reminded me that I missed "re-implementing" one feature of >> cdlatex, namely moving the cursor to the right place. I refind this >> place do it by inserting a funny string and replacing it. A poor man's >> marker, I guess... > > Another option: when ENV is inserted the first time, store (e.g., in N) > how many (forward-line -1) are needed to go back to BEG. At the end of > the process, move to BEG then (forward-line n). I assume point is always > left on an empty lines. If it is not the case, you also need to store > current column, relatively to end of line. OK it now does this. —Rasmus -- Dung makes an excellent fertilizer