From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Scharff Subject: Re: [feature request] tangle on org-special-edit Date: Thu, 21 Jul 2011 20:55:09 +0200 Message-ID: References: <87sjpzzgm0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec5430a1a5b538404a898e3f9 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:48823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjyOw-00039k-7b for emacs-orgmode@gnu.org; Thu, 21 Jul 2011 14:55:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjyOt-0004wN-O6 for emacs-orgmode@gnu.org; Thu, 21 Jul 2011 14:55:14 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:62050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjyOt-0004w8-55 for emacs-orgmode@gnu.org; Thu, 21 Jul 2011 14:55:11 -0400 Received: by pvc12 with SMTP id 12so1664764pvc.0 for ; Thu, 21 Jul 2011 11:55:10 -0700 (PDT) In-Reply-To: <87sjpzzgm0.fsf@gmail.com> 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: Eric Schulte Cc: emacs-orgmode@gnu.org --bcaec5430a1a5b538404a898e3f9 Content-Type: text/plain; charset=UTF-8 On Thu, Jul 21, 2011 at 7:19 PM, Eric Schulte wrote: > Dirk Scharff writes: > > > Hello, > > > > Org-mode provides the function to edit code blocks in their languages > > native environment. If you want do literate programming you'll end up > > with web-syntax (<> ) in the > > environment org-special-edit started. > > > > I'd like to purpose, that before opening the special language > > environment, the code-block should be tangled to a temporary > > file. Then a buffer should be stated with that file loaded in its > > native language environment. If you'd do that the code would really be > > executable and therefore debuggable and analyzable with the tools the > > programming language provides. > > > > You'll have to keep track on the tangled code blocks then. I think > > some info in comments should do the trick. I uploaded a mockup of what > > I mean here: http://dl.getdropbox.com/u/3503145/org-feature-mockup.pdf > > > > Hi Dirk, > > If you would like to pop to a code block *with* the noweb references > expanded try the `org-babel-expand-src-block' command, which is bound to > "C-c C-v v". This view of code blocks is not editable however because > there would be no way to propagate edits back into the original code > blocks -- consider an edit taking placed on the boundary between two > code blocks, or multiple nested noweb references. > > There has been some interest in propagating changes back from tangled > code to Org-mode blocks (search these list archives for the term > "detangle") however such functionality is currently not implemented -- > an `org-babel-detangle' function does exist but is not fully functional. > > Best -- Eric Hi Eric, thanks for your answer. org-babel-expand-src-block doesn't seem to work for me (it does the same as C-c ' in my case). The noweb references are not expanded. Could be a local problem here, I don't know. Have you tried it recently? Tangeling the file works fine. I didn't search the List for detangleing for now. I'll look into it later. But I'll still drop my thoughts on it: I'm well aware of the "detangleing problems" you point out. But if you know you are not to edit between boundaries of two code blocks and still do it its your own fault right? Well not even that, its just not defined how org-mode should handle it right now. As for nested code blocks I don't see a problem at all. Consider the following (already tangled) file with block markers: !!mark_begin_outer_block_1 do something here !!mark_end_outer_block_1 << you shouldn't edit here! (but it could be a new block added to the org file if you do couldn't it?) >> !!mark_begin_outer_block_2 do something in the outer block edit something here !!mark_begin_inner_block do something in the inner block edit inner block !!mark_end_inner_block do something else !!mark_end_outer_block_2 >From the theoretical point of view I don't see an issue here besides the region I marked with "<< you shouldn't edit here! >>". I guess you could even tell emacs to protect the !!marks against modification if you wanted. If I had knowledge in Lisp programming and time I'd consider giving it a shot. But as I'm writing my thesis in the moment (and time is of the essence) my "hobby-programming-time" is very limited. I requested the feature because I think C-c ' isn't as useful as it could be right now. (And of cause I could realy make great use of this for my thesis writing ;)). Its still useful to me but I have to tangle the code to debug it and "detangle" the changes manualy, what pretty much defeats the purpose in my opinion. regards, Dirk. --bcaec5430a1a5b538404a898e3f9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Thu, Jul 21, 2011 at 7:19 PM, Eric Schulte <schulte.eric@= gmail.com> wrote:
Dirk Scharff <dirk.scharff@googlemail.com> writes:

> Hello,
>
> Org-mode provides the function to edit code blocks in their languages<= br> > native environment. If you want do literate programming you'll end= up
> with web-syntax (<<the-block-to-be-included-here>> ) in th= e
> environment org-special-edit started.
>
> I'd like to purpose, that before opening the special language
> environment, the code-block should be tangled to a temporary
> file. Then a buffer should be stated with that file loaded in its
> native language environment. If you'd do that the code would reall= y be
> executable and therefore debuggable and analyzable with the tools the<= br> > programming language provides.
>
> You'll have to keep track on the tangled code blocks then. I think=
> some info in comments should do the trick. I uploaded a mockup of what=
> I mean here: http://dl.getdropbox.com/u/3503145/org-featu= re-mockup.pdf
>

Hi Dirk,

If you would like to pop to a code block *with* the noweb references
expanded try the `org-babel-expand-src-block' command, which is bound t= o
"C-c C-v v". =C2=A0This view of code blocks is not editable howev= er because
there would be no way to propagate edits back into the original code
blocks -- consider an edit taking placed on the boundary between two
code blocks, or multiple nested noweb references.

There has been some interest in propagating changes back from tangled
code to Org-mode blocks (search these list archives for the term
"detangle") however such functionality is currently not implement= ed --
an `org-babel-detangle' function does exist but is not fully functional= .

Best -- Eric

Hi Eric,=C2=A0
thank= s for your answer.

org-babel-expand-src-block does= n't seem to work for me (it does the same as C-c ' in my case). The= noweb references are not expanded. Could be a local problem here, I don= 9;t know. Have you tried it recently? Tangeling the file works fine.=C2=A0<= /div>

I didn't search the List for detangleing for now. I= 'll look into it later. But I'll still drop my thoughts on it:

I'm well aware of the "detangleing problems&q= uot; you point out. But if you know you are not to edit between boundaries = of two code blocks and still do it its your own fault right? Well not even = that, its just not defined how org-mode should handle it right now. As for = nested code blocks I don't see a problem at all. Consider the following= (already tangled) file with block markers:

!!mark_begin_outer_block_1
do something here<= /div>
!!mark_end_outer_block_1

<< you sh= ouldn't edit here! (but it could be a new block added to the org file i= f you do couldn't it?) >>=C2=A0

!!mark_begin_outer_block_2
=C2=A0 do somethin= g in the outer block
=C2=A0 edit something here
=C2=A0 = !!mark_begin_inner_block
=C2=A0 =C2=A0 do something in the inner = block
=C2=A0 =C2=A0 edit inner block
=C2=A0 !!mark_end_inner_block
=C2=A0 do something else
=
!!mark_end_outer_block_2

From the theoretical= point of view I don't see an issue here besides the region I marked wi= th "<< you shouldn't edit here! >>". I guess you = could even tell emacs to protect the !!marks against modification if you wa= nted.=C2=A0

If I had knowledge in Lisp programming and time I'd= consider giving it a shot. But as I'm writing my thesis in the moment = (and time is of the essence) my "hobby-programming-time" is very = limited.=C2=A0

I requested the feature because I think C-c ' isn&#= 39;t as useful as it could be right now. (And of cause I could realy make g= reat use of this=C2=A0for my thesis writing ;)).=C2=A0

=
Its still useful to me but I have to tangle the code to debug it and &= quot;detangle" the changes manualy, what pretty much defeats the purpo= se in my opinion.

regards,=C2=A0
Dirk.
--bcaec5430a1a5b538404a898e3f9--