emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Line numbers in tangled source
@ 2010-09-04  3:55 aditya siram
  2010-09-04 13:21 ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: aditya siram @ 2010-09-04  3:55 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 136 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 153 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Line numbers in tangled source
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2010-09-04 13:21 UTC (permalink / raw)
  To: aditya siram; +Cc: emacs-orgmode

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

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

* Re: Line numbers in tangled source
  2010-09-04 13:21 ` Eric Schulte
@ 2010-09-04 19:51   ` aditya siram
  2010-09-05 21:17     ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: aditya siram @ 2010-09-04 19:51 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

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
>

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

* Re: Line numbers in tangled source
  2010-09-04 19:51   ` aditya siram
@ 2010-09-05 21:17     ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2010-09-05 21:17 UTC (permalink / raw)
  To: aditya siram; +Cc: emacs-orgmode

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

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

end of thread, other threads:[~2010-09-05 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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