From: Rainer M Krug <Rainer@krugs.de>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: refine org-babel-tangle-jump-to-org?
Date: Mon, 03 Jun 2013 11:32:10 +0200 [thread overview]
Message-ID: <878v2rsfol.fsf@krugs.de> (raw)
In-Reply-To: <87wqqfjnmi.fsf@gmail.com> (Eric Schulte's message of "Fri, 31 May 2013 09:16:21 -0400")
[-- 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 --]
next prev parent reply other threads:[~2013-06-03 9:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878v2rsfol.fsf@krugs.de \
--to=rainer@krugs.de \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).