emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Rainer M Krug <r.m.krug@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [BABEL] tangling with leaving non-source code lines as empty lines?
Date: Mon, 12 Jul 2010 11:04:53 -0700	[thread overview]
Message-ID: <871vb8lgoq.fsf@gmail.com> (raw)
In-Reply-To: <AANLkTim-CHhfvjqeNb47WIqnd4IZYg6mYavNZe84wTCN@mail.gmail.com> (Rainer M. Krug's message of "Mon, 12 Jul 2010 17:19:42 +0200")

Hi Rainer,

If I'm understand you correctly you want the absolute position (by LOC)
of the lines of R code to be the same in both the original org file and
the tangled file or R code.  I don't think this is possible.  It is
possible to tangle code blocks in any order (not just the order in which
they appear in the original org file), so there are many valid tangling
scenarios in which this feature could not work.

Rather, I think that it may make sense to have a function for jumping
back and forth between tangled code blocks and the related Org file.  In
that case the R errors could be followed to the tangled R code file,
from which you could easily jump to the relevant line in the relevant
code block in the Org file.  If you are tangling with comments, then it
should be possible to have a function called from a line in a tangled
code file which when called

1) finds it's enclosing comments
2) remembers it's offset from the comments (which would then be it's
   offset in the code block in the Org file)
3) read the comment to learn which code block in which Org file it's
   tangled from
4) jump to the relevant line, in the relevant block, in the relevant
   file

Similarly when called form within a code block in an Org file the
function could

1) read it's header argument to find the relevant tangled code file
2) jump to that file
3) use the comments in that file to move to the appropriate section of
   code and related line

I'll think about such a function, and if it makes sense to implement it
apart from a more general "activate org-mode links in comments" minor
mode.  Any ideas or suggestions would be welcome!

Thanks -- Eric

Rainer M Krug <r.m.krug@gmail.com> writes:

> Hi Eric,
>
> would it be possible, when tangling, to leave lines without source code in
> the resulting code file as empty lines? The reasoning would be that error
> messages (at least in R) give the line in which the error occurred. If the
> line numbers in which the code sits would be preserved (by leaving empty
> lines where no code is in the .org file), debugging would be much easier.
>
> By the way: I am using the after tangle hook and it works absolutely
> perfectly.
>
> Thanks and cheers,
>
> Rainer

  reply	other threads:[~2010-07-12 18:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 15:19 [BABEL] tangling with leaving non-source code lines as empty lines? Rainer M Krug
2010-07-12 18:04 ` Eric Schulte [this message]
2010-07-13  0:46   ` Eric Schulte
2010-07-13  8:10     ` Dr Rainer M Krug
2010-07-13 17:22       ` Eric Schulte
2010-07-15  8:00         ` Rainer M Krug
2010-07-13  7:47   ` Dr 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=871vb8lgoq.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=r.m.krug@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).