From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: refine org-babel-tangle-jump-to-org? Date: Fri, 7 Jun 2013 17:38:50 +0200 Message-ID: References: <87r4goy0uo.fsf@krugs.de> <87ehcoktsl.fsf@gmail.com> <87fvx3bnzl.fsf@krugs.de> <87wqqfjnmi.fsf@gmail.com> <878v2rsfol.fsf@krugs.de> <8761xr8ei4.fsf@gmail.com> <87a9n2wclj.fsf@krugs.de> <8738suhzos.fsf@krugs.de> <87bo7iueo4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01176c7b3aa39604de923a41 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukykh-0001Td-Bg for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 11:38:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ukykd-00042q-8u for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 11:38:55 -0400 Received: from mail-ve0-x233.google.com ([2607:f8b0:400c:c01::233]:46073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukykc-00042a-Pb for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 11:38:51 -0400 Received: by mail-ve0-f179.google.com with SMTP id d10so3103454vea.24 for ; Fri, 07 Jun 2013 08:38:50 -0700 (PDT) In-Reply-To: <87bo7iueo4.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: Rainer M Krug , "emacs-orgmode@gnu.org" --089e01176c7b3aa39604de923a41 Content-Type: text/plain; charset=ISO-8859-1 . On Friday, June 7, 2013, Eric Schulte wrote: > Rainer M Krug > writes: > > > Rainer M Krug > writes: > > > >> Eric Schulte > writes: > >> > > [snip (46 lines)] > > > >>> For now I think both padlines and link comments are required for the > >>> jumping functionality to work. I've updated the documentation to > >>> reflect this. > >>> > >> > >> Thanks - I will change it accordingly. > > > > I just discovered, that I have a problem with the setting of > > org-src-preserve-indentation, as I am using org to write a package, and > > I have put DESCRIPTION into the org file (as fundamental). If I have > > org-src-preserve-indentation set to t, the lines start with two spaces > > (" ") which causes an error in reading the files. > > > > Couldn't you just not indent these code blocks. E.g., change > > #+begin_src R > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec > hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam > nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis > natoque penatibus et magnis dis parturient montes, nascetur ridiculus > mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non > turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum > accumsan nisl. > #+end_src > > Ah - makes sense. Haven't looked at that yet. Should be possible. If it doesn't work I'll come back to you on Monday. > to > > #+begin_src R > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec > hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam > nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis > natoque penatibus et magnis dis parturient montes, nascetur ridiculus > mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non > turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum > accumsan nisl. > #+end_src > > > > > I can disable padlines for these source blocks, which is no problem, but > > I think I can't change the setting for > > org-src-preserve-indentation for a single block. > > > > This is tricky because the indentation is separate from and predates > Babel, so there is no obvious straightforward way to coerce this into a > header argument. > > Ok - if it is just the case of not indenting in the source block, then it is not necessary to change it. > > > > Would it be possible to have this option as a header argument, so that I > > can change it for certain blocks? > > > > The same problem is for the local file arguments: they must not be in > > the DESCRIPTION and NAMESPACE file. > > > > Alright, I think you've convinced me that it could be worthwhile to add > header arguments to support file local variables and read modes in > tangled files. I don't have the time to implement and document these > new header arguments, but the code should not be too difficult if anyone > else wants to take a shot at it. > > Thanks - that's brilliant. > In the mean time I'd adjust your hook to wrap the addition of the file > local variable in something like > > ;; -*- emacs-lisp -*- > (unless (or (string= (buffer-file-name) "DESCRIPTION") > (string= (buffer-file-name) "NAMESPACE")) > ;; file local var code goes here > ) That is an option. I'll change it accordingly. > > > > > I could use sed or similar to adjust these files, but I would rather > > prefer to > > a) be able to have org-src-preserve-indentation for tangling as a header > > argument > > b) a variable in which I can specify in which tangled files should have > > the local variables included. > > > > By the way, the post-tangle-hook approach works, but it has the > > disadvantage, that each file needs to be written twice - in the mini > > buffer, each tangled file is shown twice. As one org file contains > > several (>10) tangles output files, this adds to the time needed for > > tangling. > > > > Agreed, for file modes and maybe local vars special header arguments > would be nice, maybe called tangle-mode and tangle-file-vars or > something. tangle-add-vars should be perfect. This could be a list of variables with their values and also modes (read-only, auto-revert comes to mind). One could split it though in two, I.e. an additional tangle-mode for modes, but one tangle-add-vars should be fine. Thanks a lot for all this, as it makes the integration of org, ESA and R much better. I'll see that I write up some how to for package development from org based on this. Cheers and have a nice weekend, Rainer > > Best, > > > > > Cheers, > > > > Rainer > > > > > >> > >> Rainer > >> > >> [snip (16 lines)] > >> > >> <#secure method=pgpmime mode=sign> > >> > > > > -- > Eric Schulte > http://cs.unm.edu/~eschulte > -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax (F): +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug --089e01176c7b3aa39604de923a41 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable .

On Friday, June 7, 2013, Eric Schulte wrote:
Rainer M Krug <Rainer@krugs.de> writ= es:

> Rainer M Krug <Rainer@krugs.de> writes:
>
>> Eric Schulte <schulte.eric@gmail.com&= gt; writes:
>>
> [snip (46 lines)]
>
>>> For now I think both padlines and link comments are required f= or the
>>> jumping functionality to work. =A0I've updated the documen= tation to
>>> reflect this.
>>>
>>
>> Thanks - I will change it accordingly.
>
> I just discovered, that I have a problem with the setting of
> org-src-preserve-indentation, as I am using org to write a package, an= d
> I have put DESCRIPTION into the org file (as fundamental). If I have > org-src-preserve-indentation set to t, the lines start with two spaces=
> (" =A0") which causes an error in reading the files.
>

Couldn't you just not indent these code blocks. =A0E.g., change

#+begin_src R
=A0 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
=A0 hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
=A0 nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
=A0 natoque penatibus et magnis dis parturient montes, nascetur ridiculus =A0 mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
=A0 turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
=A0 accumsan nisl.
#+end_src


Ah - makes sense. Haven't looked a= t that yet. Should be possible. If it doesn't work I'll come back t= o you on Monday.
=A0
to

#+begin_src R
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
accumsan nisl.
#+end_src

>
> I can disable padlines for these source blocks, which is no problem, b= ut
> I think I can't change the setting for
> org-src-preserve-indentation for a single block.
>

This is tricky because the indentation is separate from and predates
Babel, so there is no obvious straightforward way to coerce this into a
header argument.


Ok - if it is just the case of not ind= enting in the source block, then it is not necessary to change it.
=A0
>
> Would it be possible to have this option as a header argument, so that= I
> can change it for certain blocks?
>
> The same problem is for the local file arguments: they must not be in<= br> > the DESCRIPTION and NAMESPACE file.
>

Alright, I think you've convinced me that it could be worthwhile to add=
header arguments to support file local variables and read modes in
tangled files. =A0I don't have the time to implement and document these=
new header arguments, but the code should not be too difficult if anyone else wants to take a shot at it.


Thanks - that's brilliant.
=A0
In the mean time I'd adjust your hook to wrap the addition of the file<= br> local variable in something like

=A0 =A0 ;; -*- emacs-lisp -*-
=A0 =A0 (unless (or (string=3D (buffer-file-name) "DESCRIPTION")<= br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (string=3D (buffer-file-name) "NAMESPA= CE"))
=A0 =A0 =A0 ;; file local var code goes here
=A0 =A0 =A0 )

That is an option. I'll c= hange it accordingly.
=A0

>
> I could use sed or similar to adjust these files, but I would rather > prefer to
> a) be able to have org-src-preserve-indentation for tangling as a head= er
> argument
> b) a variable in which I can specify in which tangled files should hav= e
> the local variables included.
>
> By the way, the post-tangle-hook approach works, but it has the
> disadvantage, that each file needs to be written twice - in the mini > buffer, each tangled file is shown twice. As one org file contains
> several (>10) tangles output files, this adds to the time needed fo= r
> tangling.
>

Agreed, for file modes and maybe local vars special header arguments
would be nice, maybe called tangle-mode and tangle-file-vars or
something.

tangle-add-vars should be perfec= t. This could be a list of variables with their values and also modes (read= -only, auto-revert comes to mind). One could split it though in two, I.e. a= n additional tangle-mode for modes, but one tangle-add-vars should be fine.=

Thanks a lot for all this, as it makes the integration = of org, ESA and R much better. I'll see that I write up some how to for= package development from org based on this.

Cheer= s and have a nice weekend,

Rainer
=A0

Best,

>
> Cheers,
>
> Rainer
>
>
>>
>> Rainer
>>
>> [snip (16 lines)]
>>
>> <#secure method=3Dpgpmime mode=3Dsign>
>>
>

--
Eric Schulte
http://cs.unm.edu= /~eschulte


--
Rainer M. Krug, PhD (Conservation Ecology, SUN)= , MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of E= xcellence for Invasion Biology
Stellenbosch University
South Africa
Tel : =A0 =A0 =A0 +33 - (0)9 53 10 27 44
Cell: =A0 =A0 =A0 +33 - (0)= 6 85 62 59 98
Fax (F): =A0 =A0 =A0 +33 - (0)9 58 10 27 44

Fax (D)= : =A0 =A0+49 - (0)3 21 21 25 22 44

email: =A0 =A0 =A0Rainer@krugs.de

Skype: =A0 =A0 =A0RMkrug

--089e01176c7b3aa39604de923a41--