From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] better(?) indention for cdlatex-environment Date: Wed, 18 Feb 2015 01:39:17 +0100 Message-ID: <87mw4cm4sq.fsf@nicolasgoaziou.fr> References: <87386e0zuy.fsf@gmx.us> <87wq3pwg29.fsf@nicolasgoaziou.fr> <87lhk48z9x.fsf@gmx.us> <87fvacw2jv.fsf@nicolasgoaziou.fr> <87mw4kyq2e.fsf@gmx.us> <87fva9tqdj.fsf@nicolasgoaziou.fr> <873869h0cd.fsf@gmx.us> <87twypgwt5.fsf@gmx.us> <87pp9cnq9w.fsf@nicolasgoaziou.fr> <874mqoc9zf.fsf@gmx.us> <87lhjzo611.fsf@nicolasgoaziou.fr> <87wq3hgyie.fsf@gmx.us> <87egpox6o3.fsf@nicolasgoaziou.fr> <877fvg44nw.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNsea-0002H2-Oq for emacs-orgmode@gnu.org; Tue, 17 Feb 2015 19:38:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNseW-0008Qh-PB for emacs-orgmode@gnu.org; Tue, 17 Feb 2015 19:38:12 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:34012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNseW-0008Qc-Jl for emacs-orgmode@gnu.org; Tue, 17 Feb 2015 19:38:08 -0500 In-Reply-To: <877fvg44nw.fsf@gmx.us> (rasmus@gmx.us's message of "Tue, 17 Feb 2015 22:19:31 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org Rasmus 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? >> Also you shouldn't apply `org-indent-to-column' when line is empty. > > I don't see why not, but OK... Because it introduces trailing white spaces, which can irritate some users. > 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. BTW, You didn't update the patch. Regards,