Re: [O] Jumping between source blocks in a file

2016-06-25 Thread Xebar Saram
thx alot Andrew!

Just discovered this and its so useful. it would be great if in the future
this could be integrated into org mode

best

Z


Re: [O] Jumping between source blocks in a file

2015-12-02 Thread Andreas Leha
Hi Andrew,

Martin Yrjölä  writes:
> Hi Andrew!
>
> Andrew Kirkpatrick writes:
>
>> If this is deemed useful, I'm happy to make changes suitable for
>> inclusion in the project.
>
> Thanks for sharing! I would certainly want these functions included in
> org-mode by default. They streamline at least my literate programming
> workflow substantially.
>

Sorry for joining late.  I too find these useful.

(Also useful would be the possibility to jump to noweb references
directly from the src buffer...)

Regards,
Andreas





Re: [O] Jumping between source blocks in a file

2015-12-02 Thread Rainer M Krug
Rainer M Krug  writes:

> Andreas Leha  writes:
>
>> Hi Andrew,
>>
>> Martin Yrjölä  writes:
>>> Hi Andrew!
>>>
>>> Andrew Kirkpatrick writes:
>>>
 If this is deemed useful, I'm happy to make changes suitable for
 inclusion in the project.
>>>
>>> Thanks for sharing! I would certainly want these functions included in
>>> org-mode by default. They streamline at least my literate programming
>>> workflow substantially.
>>>
>>
>> Sorry for joining late.  I too find these useful.
>
> Absolutely - very useful. Please include!
>>
>> (Also useful would be the possibility to jump to noweb references
>> directly from the src buffer...)
>
> Very nice idea indeed - or possibly even expand them when executing? But
> I think this would be a job for the mode in the source buffer...

Actually, expand them when opening the Source Buffer (C-c ') and
possibly update them when closing?

>
> At the moment, these noweb references are very nice, but not so nice when
> debugging a source block where they are used.
>
> Cheers,
>
> Rainer
>
>>
>> Regards,
>> Andreas
>>
>>
>>

-- 
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:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


signature.asc
Description: PGP signature


Re: [O] Jumping between source blocks in a file

2015-12-02 Thread Rainer M Krug
Andreas Leha  writes:

> Rainer M Krug  writes:
>> Rainer M Krug  writes:
>>
>>> Andreas Leha  writes:
>>>
 Hi Andrew,

 Martin Yrjölä  writes:
> Hi Andrew!
>
> Andrew Kirkpatrick writes:
>
>> If this is deemed useful, I'm happy to make changes suitable for
>> inclusion in the project.
>
> Thanks for sharing! I would certainly want these functions included in
> org-mode by default. They streamline at least my literate programming
> workflow substantially.
>

 Sorry for joining late.  I too find these useful.
>>>
>>> Absolutely - very useful. Please include!

 (Also useful would be the possibility to jump to noweb references
 directly from the src buffer...)
>>>
>>> Very nice idea indeed - or possibly even expand them when executing? But
>>> I think this would be a job for the mode in the source buffer...
>>
>> Actually, expand them when opening the Source Buffer (C-c ') and
>> possibly update them when closing?
>>
>
> This might conflict with open Source Buffers for the referenced code
> block.

True - than simply deliminate them with something like

## <> BEGIN
...
## <> END

and *don't* update them at the end?

Probably better: language specific - for R one could write the block to
a temporary file and then insert a =source()= to execute it:


## DO NOT EDIT - AUTO INSERTED - BEGIN
source("<>.R")
## DO NOT EDIT - AUTO INSERTED - END

Would make debugging much easier, if they would be in the source block
where they are used.

And if no language specific behavior is supplied, use the present
behavior.

>
>>>
>>> At the moment, these noweb references are very nice, but not so nice when
>>> debugging a source block where they are used.
>
> Exactly.

Let's do some brainstorming how this could be solved.

Cheers,

Rainer

>
> Regards,
> Andreas
>
>

-- 
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:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


signature.asc
Description: PGP signature


Re: [O] Jumping between source blocks in a file

2015-12-02 Thread Rainer M Krug
Andreas Leha  writes:

> Hi Andrew,
>
> Martin Yrjölä  writes:
>> Hi Andrew!
>>
>> Andrew Kirkpatrick writes:
>>
>>> If this is deemed useful, I'm happy to make changes suitable for
>>> inclusion in the project.
>>
>> Thanks for sharing! I would certainly want these functions included in
>> org-mode by default. They streamline at least my literate programming
>> workflow substantially.
>>
>
> Sorry for joining late.  I too find these useful.

Absolutely - very useful. Please include!
>
> (Also useful would be the possibility to jump to noweb references
> directly from the src buffer...)

Very nice idea indeed - or possibly even expand them when executing? But
I think this would be a job for the mode in the source buffer...

At the moment, these noweb references are very nice, but not so nice when
debugging a source block where they are used.

Cheers,

Rainer

>
> Regards,
> Andreas
>
>
>

-- 
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:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


signature.asc
Description: PGP signature


Re: [O] Jumping between source blocks in a file

2015-12-02 Thread Andreas Leha
Rainer M Krug  writes:
> Rainer M Krug  writes:
>
>> Andreas Leha  writes:
>>
>>> Hi Andrew,
>>>
>>> Martin Yrjölä  writes:
 Hi Andrew!

 Andrew Kirkpatrick writes:

> If this is deemed useful, I'm happy to make changes suitable for
> inclusion in the project.

 Thanks for sharing! I would certainly want these functions included in
 org-mode by default. They streamline at least my literate programming
 workflow substantially.

>>>
>>> Sorry for joining late.  I too find these useful.
>>
>> Absolutely - very useful. Please include!
>>>
>>> (Also useful would be the possibility to jump to noweb references
>>> directly from the src buffer...)
>>
>> Very nice idea indeed - or possibly even expand them when executing? But
>> I think this would be a job for the mode in the source buffer...
>
> Actually, expand them when opening the Source Buffer (C-c ') and
> possibly update them when closing?
>

This might conflict with open Source Buffers for the referenced code
block.

>>
>> At the moment, these noweb references are very nice, but not so nice when
>> debugging a source block where they are used.

Exactly.

Regards,
Andreas




Re: [O] Jumping between source blocks in a file

2015-12-01 Thread Martin Yrjölä

Hi Andrew!

Andrew Kirkpatrick writes:

> If this is deemed useful, I'm happy to make changes suitable for
> inclusion in the project.

Thanks for sharing! I would certainly want these functions included in
org-mode by default. They streamline at least my literate programming
workflow substantially.

Cheers,
Martin



[O] Jumping between source blocks in a file

2015-11-27 Thread Andrew Kirkpatrick
On the emacs subreddit, someone recently asked if there was a command
to jump between babel source blocks while editing them. I couldn't
find such a command but liked the idea so I implemented it. My
implementation can be invoked from org-mode or org-src-mode. If a C-u
prefix is supplied, the edit is aborted rather than exited retaining
edits.

If this is deemed useful, I'm happy to make changes suitable for
inclusion in the project.

Cheers

(defun my-babel-src-jump (arg jump-fn)
  (let* ((minor-modes (cl-remove-if-not (lambda (x)
  (and (boundp x) (symbol-value x)))
minor-mode-list)))
(when (member 'org-src-mode minor-modes)
  (if (equal arg '(4))
  (org-edit-src-abort)
(org-edit-src-exit)))
(when (eq major-mode 'org-mode)
  (funcall jump-fn)
  (org-edit-src-code

(defun my-babel-edit-next (arg)
  (interactive "P")
  (my-babel-src-jump arg #'org-babel-next-src-block))

(defun my-babel-edit-previous (arg)
  (interactive "P")
  (my-babel-src-jump arg #'org-babel-previous-src-block))