From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-export-sweave Date: Tue, 23 Sep 2008 08:14:39 +0200 Message-ID: <0B9D9FD3-D2BA-485D-B59A-6D3AFD941256@uva.nl> References: <25FF1422-4BCE-4C55-B780-C8233ED9B4F7@uva.nl> Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ki1k9-0004qG-7S for emacs-orgmode@gnu.org; Tue, 23 Sep 2008 02:51:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ki1k7-0004q4-DM for emacs-orgmode@gnu.org; Tue, 23 Sep 2008 02:51:27 -0400 Received: from [199.232.76.173] (port=50385 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ki1k7-0004q1-6m for emacs-orgmode@gnu.org; Tue, 23 Sep 2008 02:51:27 -0400 Received: from mx20.gnu.org ([199.232.41.8]:21052) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ki1k6-0001hp-KE for emacs-orgmode@gnu.org; Tue, 23 Sep 2008 02:51:26 -0400 Received: from paard.ic.uva.nl ([145.18.40.182]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ki1k3-0002Uv-Bd for emacs-orgmode@gnu.org; Tue, 23 Sep 2008 02:51:23 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Austin Frank Cc: emacs-orgmode@gnu.org Hi Austin, try starting the second regular expression (the one denoting the end line) with \n. In this way, the \n remains outside the narrowed region. See for example how the +#begin_html line does it, just above you own code. Maybe you only looked at the #+begin_example, where I made the same mistake, sorry about hat. I am pushing a fix to the git repo where you can now add your own stuff cleanly using a variable: (setq org-edit-src-region-extra '(("^[ ]*\\\\begin{scode}\\({.*}\\)?\\s-+" "\n[ \\t]*\\\\end{scode}\\ ({.*}\\)?\\s-+" "r") ("^#\\+latex:[ ]*\\\\begin{scode}\\({.*}\\)?\\s-+" "\n#\\+latex: [ ]*\\\\end{scode}\\({.*}\\)?\\s-+" "r"))) HTH - Carsten On Sep 23, 2008, at 12:18 AM, Austin Frank wrote: > On Thu, Sep 18 2008, Carsten Dominik wrote: > >> These regular expressions are incorrect. \\s- is the way to denote >> whitespace. However, since that also includes newlines, I prefer to >> write "[ \t]" in such cases. > > Carsten-- > > Thanks for the tip. I now to get dumped into r-mode correctly when I > hit C-c ' inside the regions defined in the attached patch. There's > one > annoying quirk left, though. > > When coming out of r-mode by hitting C-c ' in the Org Edit Src Example > buffer, the line that ends the example (#+latex: \end{Scode}) is > concatenated to the last line of the source code, regardless of how > many > new lines are included at the end of the source code in the temporary > buffer. > > #+latex: \begin{Scode} > a <- 3 > #+latex: \end{Scode} > > goes to > > #+latex: \begin{Scode} > a <- 3#+latex: \end{Scode} > > Any suggestions on how to preserve the formatting of the end marker? > > Thanks, > /au > > diff --git a/lisp/org.el b/lisp/org.el > index 3143e13..75f25f8 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -5562,6 +5562,8 @@ the language, a switch telling of the content > should be in a single line." > ("^#\\+begin_example.*\n" "^#\\+end_example" "fundamental") > ("^#\\+html:" "\n" "html" single-line) > ("^#\\+begin_html.*\n" "\n#\\+end_html" "html") > + ("^[ \t]*\\\\begin{scode}\\({.*}\\)?\\s-+" "^[ \t]*\\\ > \end{scode}\\({.*}\\)?\\s-+" "r") > + ("^#\\+latex:[ \t]*\\\\begin{scode}\\({.*}\\)?\\s-+" "^#\\ > +latex:[ \t]*\\\\end{scode}\\({.*}\\)?\\s-+" "r") > ("^#\\+begin_latex.*\n" "\n#\\+end_latex" "latex") > ("^#\\+latex:" "\n" "latex" single-line) > ("^#\\+begin_ascii.*\n" "\n#\\+end_ascii" "fundamental") > > > -- > Austin Frank > http://aufrank.net > GPG Public Key (D7398C2F): http://aufrank.net/personal.asc