Eric Schulte <schulte.e...@gmail.com> writes: >>>> >>>> While we are at editing code blocks inline (I also do this quite often). >>>> >>>> This might have been asked before, but in code blocks we have >>>> >>>> - syntax highlighting >>>> - indenting using the code block language settings >>>> >>>> but would it be possible to have, when the cursor is in a code block, >>>> the menus and shortcuts for the language mode enabled, i.e. complete >>>> support for editing the code block language, as in the special buffer, >>>> but inline in org? Evaluationg single lines of code directly from the >>>> code block in org would be *brilliant*. >>> >>> This is very complicated, because such functionality needs >>> the entire environment of a mode. I think there are some solutions >>> which allow multiple major modes - but I don't think we will go >>> there with Org. >> >> This is definitely not an easy task, but which I think would be an very >> useful feature, making the work-flow of using embedded code much faster. >> > > I don't think this is an attainable goal. Major modes assume that they > are the sole owners of the current buffer and of the related state. > Breaking this assumption would open a deep can of major-mode-specific > problems which would each require major-mode-specific solutions.
I agree that sounds quite difficult, especially as it would involve quite a number of different modes when different languages are used. > > The only solution I see would be to somehow give each code block it's > own buffer, and then trick Emacs into treating multiple buffers as a > single buffer for purposes of display and cursor movement. If someone > wanted to develop such functionality I think it would best be done > independent of Org-mode. Keep in mind my very limited emacs knowledge - but wouldn't it be possible to switch between modes depending where the cursor is? This would mean the buffer is in R-mode, when the cursor is in a R code block, and in org-mode, when the cursor is outside. One could even enable minor-org-mode to keep some functionality n the code blocks? I know this would not be ideal, but wouldn't that be possible? Thanks a lot, Rainer > > Best, <#secure method=pgpmime mode=sign> -- Rainer M. Krug email: RMKrug<at>gmail<dot>com