emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Line numbers in tangled source


From: Eric Schulte
Subject: Re: [Orgmode] Line numbers in tangled source
Date: Sun, 05 Sep 2010 15:17:01 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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 <address@hidden> 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 <address@hidden> 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 <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]