Carsten-- Thanks for the response! On Tue, Sep 16 2008, Carsten Dominik wrote: > since you want to include tis code literally into LaTeX, the best is > probably to encapsulate it into > > #+BEGIN_LATEX .... #+END_LATEX > > and to try to solve only the local editing issue. Yes, this makes sense. Though, since really all I need to do is wrap source code written in R in a \LaTeX environment, I might also like to use #v+ #+LATEX: \begin{Scode} a <- 3 a #+LATEX: \end{Scode} #v- > Take a look at the function org-edit-src-find-region-and-lang. There > is a list of regular expressions that can be used to identify regions > that should be edited in special modes - maybe I can make this list > extensible - first, give it a try and see if you can get it working by > editing the list. While I think opening up this list to customization is probably a good idea, I could not get my new entries to behave the way I wanted. The problem, I suspect, may have to do with the ordering of the different language environments. Suppose I had #v+ #+BEGIN_LATEX \begin{Scode} a <- 3 a \end{Scode} #+END_LATEX #v- in an org file. I guess that I want the code within the Scode environment to me in r-mode, and the code outside of that but still within the LATEX block to be in LaTeX-mode. In what order should these two definitions appear within the re-list? FWIW, attached is a patch of the setup I tried to use. When I hit C-c ' inside either of the above examples, I get a temporary buffer that's in latex-mode. I was hoping to get a temporary buffer in r-mode. I also tried a version of the code that used the same entries in the re-list, but put them at the bottom, under the entries for ascii. Same results. Thanks for any further advice, /au