emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* refine org-babel-tangle-jump-to-org?
@ 2013-05-30 14:54 Rainer M. Krug
  2013-05-30 22:05 ` Eric Schulte
  0 siblings, 1 reply; 16+ messages in thread
From: Rainer M. Krug @ 2013-05-30 14:54 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

Hi

I am using  org-babel-tangle-jump-to-org when debugging code written in
org and tangled. I have some longisch code blocks and it is always
irritating, as it only jumps to the codde block. Would it be possible to
extend the function, that it jumps to the line of the code?
That would make this funktion much more user friendly.

Thanks,

Rainer

-- 
Rainer M. Krug

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-05-30 14:54 refine org-babel-tangle-jump-to-org? Rainer M. Krug
@ 2013-05-30 22:05 ` Eric Schulte
  2013-05-31  7:35   ` Rainer M. Krug
  0 siblings, 1 reply; 16+ messages in thread
From: Eric Schulte @ 2013-05-30 22:05 UTC (permalink / raw)
  To: Rainer M. Krug; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

Rainer@krugs.de (Rainer M. Krug) writes:

> Hi
>
> I am using  org-babel-tangle-jump-to-org when debugging code written in
> org and tangled. I have some longisch code blocks and it is always
> irritating, as it only jumps to the codde block. Would it be possible to
> extend the function, that it jumps to the line of the code?
> That would make this funktion much more user friendly.
>

I've just pushed up a change which should make this change.  I tested
this against the example.C file tangled from the attached Org-mode file.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: example.org --]
[-- Type: text/x-org, Size: 435 bytes --]

* example
  :PROPERTIES:
  :tangle:   yes
  :comments: link
  :END:

The required headers.
#+name: header
#+begin_src C
  #include <stdio.h>
#+end_src

Here is the auxiliary function.
#+name: auxiliary
#+begin_src C
  void aux(char* arg){
    printf("first argument: %s\n", arg);
  }
#+end_src

Here is the main function.
#+name: main
#+begin_src C
  int main(int argc, char *argv[])
  {
    aux(argv[1]);
    return 0;
  }
#+end_src


[-- Attachment #3: Type: text/plain, Size: 233 bytes --]


While implementing this change I did notice that this jumping
functionality only appears to work with linked code blocks, which should
I believe is a bug.

Best,

>
> Thanks,
>
> Rainer

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-05-30 22:05 ` Eric Schulte
@ 2013-05-31  7:35   ` Rainer M. Krug
  2013-05-31 13:16     ` Eric Schulte
  0 siblings, 1 reply; 16+ messages in thread
From: Rainer M. Krug @ 2013-05-31  7:35 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2116 bytes --]



Eric Schulte <schulte.eric@gmail.com> writes:

> Rainer@krugs.de (Rainer M. Krug) writes:
>
>> Hi
>>
>> I am using  org-babel-tangle-jump-to-org when debugging code written in
>> org and tangled. I have some longisch code blocks and it is always
>> irritating, as it only jumps to the codde block. Would it be possible to
>> extend the function, that it jumps to the line of the code?
>> That would make this funktion much more user friendly.
>>
>
> I've just pushed up a change which should make this change.  I tested
> this against the example.C file tangled from the attached Org-mode file.

Thanks - works much better now.
Very nice - it jumps even to the location in an indirect buffer -
perfect.

Without trying to be a perfectionist, it is in most cases between one
and three lines off.

Is this only in y case? If yes, please let me know and I can send you an
org file privately.

It would be really nice, if it would be possible to put the cursor on
the same line, preferably same character? But it is definitely usable
like this for debugging.

>
> * example
>   :PROPERTIES:
>   :tangle:   yes
>   :comments: link
>   :END:
>
> The required headers.
> #+name: header
> #+begin_src C
>   #include <stdio.h>
> #+end_src
>
> Here is the auxiliary function.
> #+name: auxiliary
> #+begin_src C
>   void aux(char* arg){
>     printf("first argument: %s\n", arg);
>   }
> #+end_src
>
> Here is the main function.
> #+name: main
> #+begin_src C
>   int main(int argc, char *argv[])
>   {
>     aux(argv[1]);
>     return 0;
>   }
> #+end_src
>
>
> While implementing this change I did notice that this jumping
> functionality only appears to work with linked code blocks, 

linked code blocks? Do you mean the header argument :comments link or,
as I use :comments yes? If I remember correctly, when you announced this
function, you explicitly mentioned that :comments yes is required for it
to work?


Thanks a lot,

Rainer

>which should
> I believe is a bug.
>
> Best,
>
>>
>> Thanks,
>>
>> Rainer

-- 
Rainer M. Krug

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-05-31  7:35   ` Rainer M. Krug
@ 2013-05-31 13:16     ` Eric Schulte
  2013-06-03  9:32       ` Rainer M Krug
  0 siblings, 1 reply; 16+ messages in thread
From: Eric Schulte @ 2013-05-31 13:16 UTC (permalink / raw)
  To: Rainer M. Krug; +Cc: emacs-orgmode

Rainer@krugs.de (Rainer M. Krug) writes:

> Eric Schulte <schulte.eric@gmail.com> writes:
>
>> Rainer@krugs.de (Rainer M. Krug) writes:
>>
>>> Hi
>>>
>>> I am using  org-babel-tangle-jump-to-org when debugging code written in
>>> org and tangled. I have some longisch code blocks and it is always
>>> irritating, as it only jumps to the codde block. Would it be possible to
>>> extend the function, that it jumps to the line of the code?
>>> That would make this funktion much more user friendly.
>>>
>>
>> I've just pushed up a change which should make this change.  I tested
>> this against the example.C file tangled from the attached Org-mode file.
>
> Thanks - works much better now.
> Very nice - it jumps even to the location in an indirect buffer -
> perfect.
>
> Without trying to be a perfectionist, it is in most cases between one
> and three lines off.
>
> Is this only in y case? If yes, please let me know and I can send you an
> org file privately.
>

Please do send me a minimal example.  In my simple tests it was landing
on the same character as in the source code file.

>
> It would be really nice, if it would be possible to put the cursor on
> the same line, preferably same character? But it is definitely usable
> like this for debugging.
>
>>
>> * example
>>   :PROPERTIES:
>>   :tangle:   yes
>>   :comments: link
>>   :END:
>>
>> The required headers.
>> #+name: header
>> #+begin_src C
>>   #include <stdio.h>
>> #+end_src
>>
>> Here is the auxiliary function.
>> #+name: auxiliary
>> #+begin_src C
>>   void aux(char* arg){
>>     printf("first argument: %s\n", arg);
>>   }
>> #+end_src
>>
>> Here is the main function.
>> #+name: main
>> #+begin_src C
>>   int main(int argc, char *argv[])
>>   {
>>     aux(argv[1]);
>>     return 0;
>>   }
>> #+end_src
>>
>>
>> While implementing this change I did notice that this jumping
>> functionality only appears to work with linked code blocks, 
>
> linked code blocks? Do you mean the header argument :comments link or,
> as I use :comments yes? If I remember correctly, when you announced this
> function, you explicitly mentioned that :comments yes is required for it
> to work?
>

I meant to type "named code blocks", but yes you want to use ":comments
link", as I use in that example.  See the manual page for the comments
header argument for more details.

Cheers,

>
>
> Thanks a lot,
>
> Rainer
>
>>which should
>> I believe is a bug.
>>
>> Best,
>>
>>>
>>> Thanks,
>>>
>>> Rainer

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-05-31 13:16     ` Eric Schulte
@ 2013-06-03  9:32       ` Rainer M Krug
  2013-06-03 13:34         ` Other question concerning org-babel-tangle-jump-to-org Rainer M Krug
  2013-06-06 15:06         ` refine org-babel-tangle-jump-to-org? Eric Schulte
  0 siblings, 2 replies; 16+ messages in thread
From: Rainer M Krug @ 2013-06-03  9:32 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 6401 bytes --]


Eric Schulte <schulte.eric@gmail.com> writes:

> Rainer@krugs.de (Rainer M. Krug) writes:
>
>> Eric Schulte <schulte.eric@gmail.com> writes:
>>
>>> Rainer@krugs.de (Rainer M. Krug) writes:
>>>
>>>> Hi
>>>>
>>>> I am using  org-babel-tangle-jump-to-org when debugging code written in
>>>> org and tangled. I have some longisch code blocks and it is always
>>>> irritating, as it only jumps to the codde block. Would it be possible to
>>>> extend the function, that it jumps to the line of the code?
>>>> That would make this funktion much more user friendly.
>>>>
>>>
>>> I've just pushed up a change which should make this change.  I tested
>>> this against the example.C file tangled from the attached Org-mode file.
>>
>> Thanks - works much better now.
>> Very nice - it jumps even to the location in an indirect buffer -
>> perfect.
>>
>> Without trying to be a perfectionist, it is in most cases between one
>> and three lines off.
>>
>> Is this only in y case? If yes, please let me know and I can send you an
>> org file privately.
>>
>
> Please do send me a minimal example.  In my simple tests it was landing
> on the same character as in the source code file.
>
OK - here it is:

,----
| :BABEL:
| #+PROPERTY: exports code
| #+PROPERTY: comments yes
| #+PROPERTY: padline yes
| :END:
| * newASM (./newASM.R)
| :PROPERTIES:
| :tangle:   ./newASM.R
| :END:
| #+begin_src R
|     logList("##########################################################################")
|     logList("##########################################################################")
|     logList("####")
|     logList("#### Simulation object ASM created.")
|     logList("####")
|     logList("#### It has been undergone basic initialisation and will")
|     logList("#### be initialised for usage when simulated by running")
|     logList("####")
|     logList("#### > sim(ASM)")
|     logList("####")
|     logList("#### or manually, without simulating, by running")
|     logList("#### > ASM <- initialize(ASM)")
|     logList("####")
|     logList("##########################################################################")
|     logList("####")
|     logList( paste("#### GISDBASE : ", parms(ASM)$baseDir) )
|     logList( paste("#### LOCATION : ", parms(ASM)$grassLocation) )
|     logList( paste("#### MAPSET   : ", parms(ASM)$grassMapset) )
|     logList("####")
|     logList("##########################################################################")
|     logList("##########################################################################")
|     logEnd()
|     return(ASM)
|   }
| #+end_src
`----

where the tangled file looks as follow, including the empty lines at
beginning and end:

,----
| 
| ## [[file:~/tmp/jumpBack.org::*newASM%20(./newASM.R)][newASM\ \(\./newASM\.R\):1]]
| 
| logList("##########################################################################")
|   logList("##########################################################################")
|   logList("####")
|   logList("#### Simulation object ASM created.")
|   logList("####")
|   logList("#### It has been undergone basic initialisation and will")
|   logList("#### be initialised for usage when simulated by running")
|   logList("####")
|   logList("#### > sim(ASM)")
|   logList("####")
|   logList("#### or manually, without simulating, by running")
|   logList("#### > ASM <- initialize(ASM)")
|   logList("####")
|   logList("##########################################################################")
|   logList("####")
|   logList( paste("#### GISDBASE : ", parms(ASM)$baseDir) )
|   logList( paste("#### LOCATION : ", parms(ASM)$grassLocation) )
|   logList( paste("#### MAPSET   : ", parms(ASM)$grassMapset) )
|   logList("####")
|   logList("##########################################################################")
|   logList("##########################################################################")
|   logEnd()
|   return(ASM)
| }
| 
| ## newASM\ \(\./newASM\.R\):1 ends here
| 
`----

This one works, although the cursor is consistently two characters to the left then
where it should be.

If I change

,----
| #+PROPERTY: padline yes
`----

to

,----
| #+PROPERTY: padline no
`----

the padlines are gone, ant the jumping back is completely off (from
first r in return() it jumps to the third # in the last logList()).

Hope this helps,

Rainer



>>
>> It would be really nice, if it would be possible to put the cursor on
>> the same line, preferably same character? But it is definitely usable
>> like this for debugging.
>>
>>>
>>> * example
>>>   :PROPERTIES:
>>>   :tangle:   yes
>>>   :comments: link
>>>   :END:
>>>
>>> The required headers.
>>> #+name: header
>>> #+begin_src C
>>>   #include <stdio.h>
>>> #+end_src
>>>
>>> Here is the auxiliary function.
>>> #+name: auxiliary
>>> #+begin_src C
>>>   void aux(char* arg){
>>>     printf("first argument: %s\n", arg);
>>>   }
>>> #+end_src
>>>
>>> Here is the main function.
>>> #+name: main
>>> #+begin_src C
>>>   int main(int argc, char *argv[])
>>>   {
>>>     aux(argv[1]);
>>>     return 0;
>>>   }
>>> #+end_src
>>>
>>>
>>> While implementing this change I did notice that this jumping
>>> functionality only appears to work with linked code blocks, 
>>
>> linked code blocks? Do you mean the header argument :comments link or,
>> as I use :comments yes? If I remember correctly, when you announced this
>> function, you explicitly mentioned that :comments yes is required for it
>> to work?
>>
>
> I meant to type "named code blocks", but yes you want to use ":comments
> link", as I use in that example.  See the manual page for the comments
> header argument for more details.
>
> Cheers,
>
>>
>>
>> Thanks a lot,
>>
>> Rainer
>>
>>>which should
>>> I believe is a bug.
>>>
>>> Best,
>>>
>>>>
>>>> Thanks,
>>>>
>>>> Rainer


-- 
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 :       +33 - (0)9 58 10 27 44

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

email:      Rainer@krugs.de

Skype:      RMkrug

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Other question concerning org-babel-tangle-jump-to-org
  2013-06-03  9:32       ` Rainer M Krug
@ 2013-06-03 13:34         ` Rainer M Krug
  2013-06-04  8:33           ` Julian M. Burgos
  2013-06-06 15:13           ` Eric Schulte
  2013-06-06 15:06         ` refine org-babel-tangle-jump-to-org? Eric Schulte
  1 sibling, 2 replies; 16+ messages in thread
From: Rainer M Krug @ 2013-06-03 13:34 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]


Would it be possible, that the function does not open a new window when
executed, but uses the same window the tangled file is in? I am using
org for literate programming in R (ESS): 
- R console left window 
- when there is an error, I jump to the R file in the right window and
call there org-babel-tangle-jump-to-org and the org file is opened in
the left window. It would be easier for debugging, if it would open in
the right window, where the R file is already open.

Would that be possible?

Thanks,

Rainer


-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Other question concerning org-babel-tangle-jump-to-org
  2013-06-03 13:34         ` Other question concerning org-babel-tangle-jump-to-org Rainer M Krug
@ 2013-06-04  8:33           ` Julian M. Burgos
  2013-06-04  8:39             ` Rainer M Krug
  2013-06-06 15:13           ` Eric Schulte
  1 sibling, 1 reply; 16+ messages in thread
From: Julian M. Burgos @ 2013-06-04  8:33 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

Hi Rainier,
If I understood correctly, you need to add the following to your
.emacs file:

(setq org-src-window-setup 'current-window)

With this when you use C-' to switch between editing your org mode file
and being in ESS mode you will say in the same windows.

All the best,

Julian

-- 
Julian Mariano Burgos, PhD
Hafrannsóknastofnun/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: julian@hafro.is



Rainer M Krug writes:

> Would it be possible, that the function does not open a new window when
> executed, but uses the same window the tangled file is in? I am using
> org for literate programming in R (ESS): 
> - R console left window 
> - when there is an error, I jump to the R file in the right window and
> call there org-babel-tangle-jump-to-org and the org file is opened in
> the left window. It would be easier for debugging, if it would open in
> the right window, where the R file is already open.
>
> Would that be possible?
>
> Thanks,
>
> Rainer

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Other question concerning org-babel-tangle-jump-to-org
  2013-06-04  8:33           ` Julian M. Burgos
@ 2013-06-04  8:39             ` Rainer M Krug
  2013-06-05 16:10               ` Julian M. Burgos
  0 siblings, 1 reply; 16+ messages in thread
From: Rainer M Krug @ 2013-06-04  8:39 UTC (permalink / raw)
  To: emacs-orgmode


<#secure method=pgpmime mode=sign>

"Julian M. Burgos" <julian@hafro.is> writes:

> Hi Rainier,

Hi Julian,

> If I understood correctly, you need to add the following to your
> .emacs file:
>
> (setq org-src-window-setup 'current-window)
>
> With this when you use C-' to switch between editing your org mode file
> and being in ESS mode you will say in the same windows.

This is definitely true, but this is my setting, but this only effects
C-' to start an indirect buffer - the org file is opened in a normal
buffer, and not in an indirect buffer.

Cheers,

Rainer

>
> All the best,
>
> Julian

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Other question concerning org-babel-tangle-jump-to-org
  2013-06-04  8:39             ` Rainer M Krug
@ 2013-06-05 16:10               ` Julian M. Burgos
  0 siblings, 0 replies; 16+ messages in thread
From: Julian M. Burgos @ 2013-06-05 16:10 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

Hi Rainer,

Then sorry... this goes beyond my meager knowledge of emacs and org
mode. :)

Rainer M Krug writes:

> <#secure method=pgpmime mode=sign>
>
> "Julian M. Burgos" <julian@hafro.is> writes:
>
>> Hi Rainier,
>
> Hi Julian,
>
>> If I understood correctly, you need to add the following to your
>> .emacs file:
>>
>> (setq org-src-window-setup 'current-window)
>>
>> With this when you use C-' to switch between editing your org mode file
>> and being in ESS mode you will say in the same windows.
>
> This is definitely true, but this is my setting, but this only effects
> C-' to start an indirect buffer - the org file is opened in a normal
> buffer, and not in an indirect buffer.
>
> Cheers,
>
> Rainer
>
>>
>> All the best,
>>
>> Julian


-- 
Julian Mariano Burgos, PhD
Hafrannsóknastofnun/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: julian@hafro.is

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-06-03  9:32       ` Rainer M Krug
  2013-06-03 13:34         ` Other question concerning org-babel-tangle-jump-to-org Rainer M Krug
@ 2013-06-06 15:06         ` Eric Schulte
  2013-06-07  8:26           ` Rainer M Krug
  1 sibling, 1 reply; 16+ messages in thread
From: Eric Schulte @ 2013-06-06 15:06 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

> the tangled file looks as follow, including the empty lines at
> beginning and end:
>
> ,----
> | 
> | ## [[file:~/tmp/jumpBack.org::*newASM%20(./newASM.R)][newASM\ \(\./newASM\.R\):1]]
> | 
> | logList("##########################################################################")
> |   logList("##########################################################################")
> |   logList("####")
> |   logList("#### Simulation object ASM created.")
> |   logList("####")
> |   logList("#### It has been undergone basic initialisation and will")
> |   logList("#### be initialised for usage when simulated by running")
> |   logList("####")
> |   logList("#### > sim(ASM)")
> |   logList("####")
> |   logList("#### or manually, without simulating, by running")
> |   logList("#### > ASM <- initialize(ASM)")
> |   logList("####")
> |   logList("##########################################################################")
> |   logList("####")
> |   logList( paste("#### GISDBASE : ", parms(ASM)$baseDir) )
> |   logList( paste("#### LOCATION : ", parms(ASM)$grassLocation) )
> |   logList( paste("#### MAPSET   : ", parms(ASM)$grassMapset) )
> |   logList("####")
> |   logList("##########################################################################")
> |   logList("##########################################################################")
> |   logEnd()
> |   return(ASM)
> | }
> | 
> | ## newASM\ \(\./newASM\.R\):1 ends here
> | 
> `----
>
> This one works, although the cursor is consistently two characters to the left then
> where it should be.
>

This is off because the first line of your example is not indented
correctly when tangled.  Specifically, it is indented by two spaces in
the source file and by four spaces in the code block.  Setting the
`org-src-preserve-indentation' variable to t should fix this.

>
> If I change
>
> ,----
> | #+PROPERTY: padline yes
> `----
>
> to
>
> ,----
> | #+PROPERTY: padline no
> `----
>
> the padlines are gone, ant the jumping back is completely off (from
> first r in return() it jumps to the third # in the last logList()).
>

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.

,----
| @subheading Jumping between code and Org
| 
| When tangling code from an Org-mode buffer to a source code file, you'll
| frequently find yourself viewing the file of tangled source code (e.g., many
| debuggers point to lines of the source code file).  It is useful to be able
| to navigate from the tangled source to the Org-mode buffer from which the
| code originated.
| 
| The @code{org-babel-tangle-jump-to-org} function provides this jumping from
| code to Org-mode functionality.  Two header arguments are required for
| jumping to work, first the @xref{padline} option must be set to true (the
| default setting), second the @xref{comments} header argument must be set to
| @code{links}, which will insert comments into the source code buffer which
| point back to the original Org-mode file.
`----

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Other question concerning org-babel-tangle-jump-to-org
  2013-06-03 13:34         ` Other question concerning org-babel-tangle-jump-to-org Rainer M Krug
  2013-06-04  8:33           ` Julian M. Burgos
@ 2013-06-06 15:13           ` Eric Schulte
  2013-06-07  7:27             ` Rainer M Krug
  1 sibling, 1 reply; 16+ messages in thread
From: Eric Schulte @ 2013-06-06 15:13 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

Rainer M Krug <Rainer@krugs.de> writes:

> Would it be possible, that the function does not open a new window when
> executed, but uses the same window the tangled file is in? I am using
> org for literate programming in R (ESS): 
> - R console left window 
> - when there is an error, I jump to the R file in the right window and
> call there org-babel-tangle-jump-to-org and the org file is opened in
> the left window. It would be easier for debugging, if it would open in
> the right window, where the R file is already open.
>
> Would that be possible?
>

I just updated the `org-babel-tangle-jump-to-org' function so that it
now uses the same jumping mechanism used to edit source code blocks, so
your source code settings (e.g., same window or different window) should
now apply to source->org jumping.

Cheers,

>
> Thanks,
>
> Rainer

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Other question concerning org-babel-tangle-jump-to-org
  2013-06-06 15:13           ` Eric Schulte
@ 2013-06-07  7:27             ` Rainer M Krug
  0 siblings, 0 replies; 16+ messages in thread
From: Rainer M Krug @ 2013-06-07  7:27 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <schulte.eric@gmail.com> writes:

> Rainer M Krug <Rainer@krugs.de> writes:
>
>> Would it be possible, that the function does not open a new window when
>> executed, but uses the same window the tangled file is in? I am using
>> org for literate programming in R (ESS): 
>> - R console left window 
>> - when there is an error, I jump to the R file in the right window and
>> call there org-babel-tangle-jump-to-org and the org file is opened in
>> the left window. It would be easier for debugging, if it would open in
>> the right window, where the R file is already open.
>>
>> Would that be possible?
>>
>
> I just updated the `org-babel-tangle-jump-to-org' function so that it
> now uses the same jumping mechanism used to edit source code blocks, so
> your source code settings (e.g., same window or different window) should
> now apply to source->org jumping.

Thanks a lot - works perfectly now.

Cheers,

Rainer


>
> Cheers,
>
>>
>> Thanks,
>>
>> Rainer
<#secure method=pgpmime mode=sign>

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-06-06 15:06         ` refine org-babel-tangle-jump-to-org? Eric Schulte
@ 2013-06-07  8:26           ` Rainer M Krug
  2013-06-07 12:29             ` Rainer M Krug
  0 siblings, 1 reply; 16+ messages in thread
From: Rainer M Krug @ 2013-06-07  8:26 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <schulte.eric@gmail.com> writes:

>> the tangled file looks as follow, including the empty lines at
>> beginning and end:
>>
>> ,----
>> | 
>> | ## [[file:~/tmp/jumpBack.org::*newASM%20(./newASM.R)][newASM\ \(\./newASM\.R\):1]]
>> | 
>> | logList("##########################################################################")
>> |   logList("##########################################################################")

[snip (19 lines)]

>> |   logEnd()
>> |   return(ASM)
>> | }
>> | 
>> | ## newASM\ \(\./newASM\.R\):1 ends here
>> | 
>> `----
>>
>> This one works, although the cursor is consistently two characters to the left then
>> where it should be.
>>
>
> This is off because the first line of your example is not indented
> correctly when tangled.  Specifically, it is indented by two spaces in
> the source file and by four spaces in the code block.  Setting the
> `org-src-preserve-indentation' variable to t should fix this.
>
>>
>> If I change
>>
>> ,----
>> | #+PROPERTY: padline yes
>> `----
>>
>> to
>>
>> ,----
>> | #+PROPERTY: padline no
>> `----
>>
>> the padlines are gone, ant the jumping back is completely off (from
>> first r in return() it jumps to the third # in the last logList()).
>>
>
> 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.

Rainer

[snip (16 lines)]

<#secure method=pgpmime mode=sign>

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-06-07  8:26           ` Rainer M Krug
@ 2013-06-07 12:29             ` Rainer M Krug
  2013-06-07 15:24               ` Eric Schulte
  0 siblings, 1 reply; 16+ messages in thread
From: Rainer M Krug @ 2013-06-07 12:29 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <Rainer@krugs.de> writes:

> Eric Schulte <schulte.eric@gmail.com> 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.

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.

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. 

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.

Cheers,

Rainer
 

>
> Rainer
>
> [snip (16 lines)]
>
> <#secure method=pgpmime mode=sign>
>


-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-06-07 12:29             ` Rainer M Krug
@ 2013-06-07 15:24               ` Eric Schulte
  2013-06-07 15:38                 ` Rainer M Krug
  0 siblings, 1 reply; 16+ messages in thread
From: Eric Schulte @ 2013-06-07 15:24 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

Rainer M Krug <Rainer@krugs.de> writes:

> Rainer M Krug <Rainer@krugs.de> writes:
>
>> Eric Schulte <schulte.eric@gmail.com> 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

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.

>
> 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.

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
      )

>
> 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.

Best,

>
> Cheers,
>
> Rainer
>  
>
>>
>> Rainer
>>
>> [snip (16 lines)]
>>
>> <#secure method=pgpmime mode=sign>
>>
>

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: refine org-babel-tangle-jump-to-org?
  2013-06-07 15:24               ` Eric Schulte
@ 2013-06-07 15:38                 ` Rainer M Krug
  0 siblings, 0 replies; 16+ messages in thread
From: Rainer M Krug @ 2013-06-07 15:38 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Rainer M Krug, emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 5207 bytes --]

.

On Friday, June 7, 2013, Eric Schulte wrote:

> Rainer M Krug <Rainer@krugs.de <javascript:;>> writes:
>
> > Rainer M Krug <Rainer@krugs.de <javascript:;>> writes:
> >
> >> Eric Schulte <schulte.eric@gmail.com <javascript:;>> 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

[-- Attachment #2: Type: text/html, Size: 7272 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-06-07 15:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 14:54 refine org-babel-tangle-jump-to-org? Rainer M. Krug
2013-05-30 22:05 ` Eric Schulte
2013-05-31  7:35   ` Rainer M. Krug
2013-05-31 13:16     ` Eric Schulte
2013-06-03  9:32       ` Rainer M Krug
2013-06-03 13:34         ` Other question concerning org-babel-tangle-jump-to-org Rainer M Krug
2013-06-04  8:33           ` Julian M. Burgos
2013-06-04  8:39             ` Rainer M Krug
2013-06-05 16:10               ` Julian M. Burgos
2013-06-06 15:13           ` Eric Schulte
2013-06-07  7:27             ` Rainer M Krug
2013-06-06 15:06         ` refine org-babel-tangle-jump-to-org? Eric Schulte
2013-06-07  8:26           ` Rainer M Krug
2013-06-07 12:29             ` Rainer M Krug
2013-06-07 15:24               ` Eric Schulte
2013-06-07 15:38                 ` Rainer M Krug

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).