emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: aditya siram <aditya.siram@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Line numbers in tangled source
Date: Sun, 05 Sep 2010 15:17:01 -0600	[thread overview]
Message-ID: <87zkvvkhzk.fsf@gmail.com> (raw)
In-Reply-To: AANLkTinf+ViY95ZeSAS6XraJKY=-spR5K-9TmD+aP+oD@mail.gmail.com

Hi,

This isn't the first request for customizable comments in tangled code.
I've just implemented a first pass at this functionality, the variables
org-babel-tangle-comment-format-beg and
org-babel-tangle-comment-format-end now hold simple format string
specifying how the comments surrounding code blocks should be
constructed, see their documentation for more info.

As an example, the following specification should yield the results
you're after
#+begin_src emacs-lisp :results silent
  (setq org-babel-tangle-comment-format-beg "{-# LINE %start-line \"%file\" #-}"
        org-babel-tangle-comment-format-end ""
        org-babel-tangle-pad-newline)
#+end_src

Best -- Eric

aditya siram <aditya.siram@gmail.com> writes:

> Yes I am aware of the comments argument but it is not what I was
> referring to. What I want is, if I had the following in a file called
> "Haskell.org" :
> * Root
> Root comment
> #+begin_src haskell :tangle Main.hs
>   test = length
>   main = print $ test [1,2,3]
> #+end_src
>
> I would like the following output in the tangled file Main.hs:
>
> {-# LINE 4 "Haskell.org" #-}
> test = length
> main = print $ test [1,2,3]
>
> The line that starts with {-# LINE ... #-} is a pragma that tells the
> compiler that this line corresponds to line 4 in Haskell.org and if
> there is an error it will point to that file and not to Main.hs.
>
> Can I take it that this functionality doesn't yet exist?
>
> -deech
>
>
> On Sat, Sep 4, 2010 at 8:21 AM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>
>> Hi,
>>
>> You can use the :comments header argument to include comments around
>> tangled code blocks indicating where the code block lives in the
>> original Org file.
>>
>> See [1] for information on the :comment header argument, and see [2] for
>> information on using header arguments in general.
>>
>> Best -- Eric
>>
>> aditya siram <aditya.siram@gmail.com> writes:
>>
>> > Hi all,
>> > How do I get the org file line numbers in the tangled source? This way error
>> > messages point to the org file.
>> >
>> > thanks ...
>> > -deech
>>
>> Footnotes:
>> [1]  http://orgmode.org/manual/comments.html#comments
>>
>> [2]  http://orgmode.org/manual/Using-header-arguments.html#Using-header-arguments
>>

      reply	other threads:[~2010-09-05 21:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-04  3:55 Line numbers in tangled source aditya siram
2010-09-04 13:21 ` Eric Schulte
2010-09-04 19:51   ` aditya siram
2010-09-05 21:17     ` Eric Schulte [this message]

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=87zkvvkhzk.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=aditya.siram@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).