emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel-tangle-file not parsing code blocks
@ 2013-03-25 22:02 Marcelo de Moraes Serpa
  2013-03-25 22:03 ` Marcelo de Moraes Serpa
  2013-03-25 22:19 ` Thomas S. Dye
  0 siblings, 2 replies; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2013-03-25 22:02 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

Hi list,

I have a simple babel file with an Emacs Lisp code block, that looks like
this:

peepopen-config.org:


* Load it
#+BEGIN_SRC emacs_lisp
  (add-to-list 'load-path (concat fullofcaffeine-vendor-dir "/peepopen"))
  (require 'peepopen)
  (textmate-mode)
#+END_SRC

(provide 'peepopen-config)


I'm trying to tangle it with (org-babel-tangle-file "peepopen-config.org"),
but I get the following in the "Messages" buffer:

Tangled 0 code blocks from peepopen-config.org


I'm confused, since the file *does* contain a code block. Am I doing
something wrong?

Thanks in advance,

- Marcelo.

[-- Attachment #2: Type: text/html, Size: 1229 bytes --]

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

* Re: org-babel-tangle-file not parsing code blocks
  2013-03-25 22:02 org-babel-tangle-file not parsing code blocks Marcelo de Moraes Serpa
@ 2013-03-25 22:03 ` Marcelo de Moraes Serpa
  2013-03-25 22:19 ` Thomas S. Dye
  1 sibling, 0 replies; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2013-03-25 22:03 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

Versions:

Org-mode version 8.0-pre (release_8.0-pre-186-g8aeea9.dirty)

GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of
2013-03-12



On Mon, Mar 25, 2013 at 4:02 PM, Marcelo de Moraes Serpa <
celoserpa@gmail.com> wrote:

> Hi list,
>
> I have a simple babel file with an Emacs Lisp code block, that looks like
> this:
>
> peepopen-config.org:
>
>
> * Load it
> #+BEGIN_SRC emacs_lisp
>   (add-to-list 'load-path (concat fullofcaffeine-vendor-dir "/peepopen"))
>   (require 'peepopen)
>   (textmate-mode)
> #+END_SRC
>
> (provide 'peepopen-config)
>
>
> I'm trying to tangle it with (org-babel-tangle-file "peepopen-config.org"),
> but I get the following in the "Messages" buffer:
>
> Tangled 0 code blocks from peepopen-config.org
>
>
> I'm confused, since the file *does* contain a code block. Am I doing
> something wrong?
>
> Thanks in advance,
>
> - Marcelo.
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1850 bytes --]

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

* Re: org-babel-tangle-file not parsing code blocks
  2013-03-25 22:02 org-babel-tangle-file not parsing code blocks Marcelo de Moraes Serpa
  2013-03-25 22:03 ` Marcelo de Moraes Serpa
@ 2013-03-25 22:19 ` Thomas S. Dye
  2013-03-25 22:20   ` Marcelo de Moraes Serpa
  1 sibling, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-03-25 22:19 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode

Aloha Marcelo,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> Hi list,
>
> I have a simple babel file with an Emacs Lisp code block, that looks like
> this:
>
> peepopen-config.org:
>
>
> * Load it
> #+BEGIN_SRC emacs_lisp
>   (add-to-list 'load-path (concat fullofcaffeine-vendor-dir "/peepopen"))
>   (require 'peepopen)
>   (textmate-mode)
> #+END_SRC
>
> (provide 'peepopen-config)
>
>
> I'm trying to tangle it with (org-babel-tangle-file "peepopen-config.org"),
> but I get the following in the "Messages" buffer:
>
> Tangled 0 code blocks from peepopen-config.org
>
>
> I'm confused, since the file *does* contain a code block. Am I doing
> something wrong?

Not really, but you do need to tell Babel you want to tangle this code
block.  See the header argument :tangle, which by default is set to
`no'.  If you add :tangle yes to the code block header, then it should
do what you want.

hth,
Tom

>
> Thanks in advance,
>
> - Marcelo.
> Hi list,
>
>
> I have a simple babel file with an Emacs Lisp code block, that looks
> like this:
>
> peepopen-config.org:
>
>
>     * Load it
>     #+BEGIN_SRC emacs_lisp
>       (add-to-list 'load-path (concat fullofcaffeine-vendor-dir
>     "/peepopen"))
>       (require 'peepopen)
>       (textmate-mode)
>     #+END_SRC
>     
>     (provide 'peepopen-config)
>     
>
> I'm trying to tangle it with (org-babel-tangle-file
> "peepopen-config.org"), but I get the following in the "Messages"
> buffer:
>
>     Tangled 0 code blocks from peepopen-config.org
>
>
> I'm confused, since the file *does* contain a code block. Am I doing
> something wrong?
>
> Thanks in advance,
>
> - Marcelo. 
>
>
>

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: org-babel-tangle-file not parsing code blocks
  2013-03-25 22:19 ` Thomas S. Dye
@ 2013-03-25 22:20   ` Marcelo de Moraes Serpa
  2013-03-25 22:45     ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2013-03-25 22:20 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 2094 bytes --]

Hi Thomas,

Stupid me. There was a syntax error in the code block -- "emacs_lisp"
instead of "emacs-lisp".

Thank you for taking your time to answer it, though!

- Marcelo.

On Mon, Mar 25, 2013 at 4:19 PM, Thomas S. Dye <tsd@tsdye.com> wrote:

> Aloha Marcelo,
>
> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>
> > Hi list,
> >
> > I have a simple babel file with an Emacs Lisp code block, that looks like
> > this:
> >
> > peepopen-config.org:
> >
> >
> > * Load it
> > #+BEGIN_SRC emacs_lisp
> >   (add-to-list 'load-path (concat fullofcaffeine-vendor-dir "/peepopen"))
> >   (require 'peepopen)
> >   (textmate-mode)
> > #+END_SRC
> >
> > (provide 'peepopen-config)
> >
> >
> > I'm trying to tangle it with (org-babel-tangle-file "peepopen-config.org
> "),
> > but I get the following in the "Messages" buffer:
> >
> > Tangled 0 code blocks from peepopen-config.org
> >
> >
> > I'm confused, since the file *does* contain a code block. Am I doing
> > something wrong?
>
> Not really, but you do need to tell Babel you want to tangle this code
> block.  See the header argument :tangle, which by default is set to
> `no'.  If you add :tangle yes to the code block header, then it should
> do what you want.
>
> hth,
> Tom
>
> >
> > Thanks in advance,
> >
> > - Marcelo.
> > Hi list,
> >
> >
> > I have a simple babel file with an Emacs Lisp code block, that looks
> > like this:
> >
> > peepopen-config.org:
> >
> >
> >     * Load it
> >     #+BEGIN_SRC emacs_lisp
> >       (add-to-list 'load-path (concat fullofcaffeine-vendor-dir
> >     "/peepopen"))
> >       (require 'peepopen)
> >       (textmate-mode)
> >     #+END_SRC
> >
> >     (provide 'peepopen-config)
> >
> >
> > I'm trying to tangle it with (org-babel-tangle-file
> > "peepopen-config.org"), but I get the following in the "Messages"
> > buffer:
> >
> >     Tangled 0 code blocks from peepopen-config.org
> >
> >
> > I'm confused, since the file *does* contain a code block. Am I doing
> > something wrong?
> >
> > Thanks in advance,
> >
> > - Marcelo.
> >
> >
> >
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>

[-- Attachment #2: Type: text/html, Size: 3561 bytes --]

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

* Re: org-babel-tangle-file not parsing code blocks
  2013-03-25 22:20   ` Marcelo de Moraes Serpa
@ 2013-03-25 22:45     ` Marcelo de Moraes Serpa
  2013-03-25 23:24       ` Marcelo de Moraes Serpa
  2013-03-25 23:39       ` Thomas S. Dye
  0 siblings, 2 replies; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2013-03-25 22:45 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 2543 bytes --]

Oh, actually that wasn't the issue.

org-babel-load-file seems to force tangling the file to an .el.
org-babel-tangle-file doesn't. Is there a way to force the output to the
.el file without using the parameter in the code block itself?

Thanks!

On Mon, Mar 25, 2013 at 4:20 PM, Marcelo de Moraes Serpa <
celoserpa@gmail.com> wrote:

> Hi Thomas,
>
> Stupid me. There was a syntax error in the code block -- "emacs_lisp"
> instead of "emacs-lisp".
>
> Thank you for taking your time to answer it, though!
>
> - Marcelo.
>
>
> On Mon, Mar 25, 2013 at 4:19 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> Aloha Marcelo,
>>
>> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>>
>> > Hi list,
>> >
>> > I have a simple babel file with an Emacs Lisp code block, that looks
>> like
>> > this:
>> >
>> > peepopen-config.org:
>> >
>> >
>> > * Load it
>> > #+BEGIN_SRC emacs_lisp
>> >   (add-to-list 'load-path (concat fullofcaffeine-vendor-dir
>> "/peepopen"))
>> >   (require 'peepopen)
>> >   (textmate-mode)
>> > #+END_SRC
>> >
>> > (provide 'peepopen-config)
>> >
>> >
>> > I'm trying to tangle it with (org-babel-tangle-file "
>> peepopen-config.org"),
>> > but I get the following in the "Messages" buffer:
>> >
>> > Tangled 0 code blocks from peepopen-config.org
>> >
>> >
>> > I'm confused, since the file *does* contain a code block. Am I doing
>> > something wrong?
>>
>> Not really, but you do need to tell Babel you want to tangle this code
>> block.  See the header argument :tangle, which by default is set to
>> `no'.  If you add :tangle yes to the code block header, then it should
>> do what you want.
>>
>> hth,
>> Tom
>>
>> >
>> > Thanks in advance,
>> >
>> > - Marcelo.
>> > Hi list,
>> >
>> >
>> > I have a simple babel file with an Emacs Lisp code block, that looks
>> > like this:
>> >
>> > peepopen-config.org:
>> >
>> >
>> >     * Load it
>> >     #+BEGIN_SRC emacs_lisp
>> >       (add-to-list 'load-path (concat fullofcaffeine-vendor-dir
>> >     "/peepopen"))
>> >       (require 'peepopen)
>> >       (textmate-mode)
>> >     #+END_SRC
>> >
>> >     (provide 'peepopen-config)
>> >
>> >
>> > I'm trying to tangle it with (org-babel-tangle-file
>> > "peepopen-config.org"), but I get the following in the "Messages"
>> > buffer:
>> >
>> >     Tangled 0 code blocks from peepopen-config.org
>> >
>> >
>> > I'm confused, since the file *does* contain a code block. Am I doing
>> > something wrong?
>> >
>> > Thanks in advance,
>> >
>> > - Marcelo.
>> >
>> >
>> >
>>
>> --
>> Thomas S. Dye
>> http://www.tsdye.com
>>
>
>

[-- Attachment #2: Type: text/html, Size: 4316 bytes --]

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

* Re: org-babel-tangle-file not parsing code blocks
  2013-03-25 22:45     ` Marcelo de Moraes Serpa
@ 2013-03-25 23:24       ` Marcelo de Moraes Serpa
  2013-03-25 23:39       ` Thomas S. Dye
  1 sibling, 0 replies; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2013-03-25 23:24 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 2897 bytes --]

Perhaps I'm misunderstanding how org-babel-tangle-file works. Isn't it
supposed to create a correspondent .el file for the tangled org file?


On Mon, Mar 25, 2013 at 4:45 PM, Marcelo de Moraes Serpa <
celoserpa@gmail.com> wrote:

> Oh, actually that wasn't the issue.
>
> org-babel-load-file seems to force tangling the file to an .el.
> org-babel-tangle-file doesn't. Is there a way to force the output to the
> .el file without using the parameter in the code block itself?
>
> Thanks!
>
>
> On Mon, Mar 25, 2013 at 4:20 PM, Marcelo de Moraes Serpa <
> celoserpa@gmail.com> wrote:
>
>> Hi Thomas,
>>
>> Stupid me. There was a syntax error in the code block -- "emacs_lisp"
>> instead of "emacs-lisp".
>>
>> Thank you for taking your time to answer it, though!
>>
>> - Marcelo.
>>
>>
>> On Mon, Mar 25, 2013 at 4:19 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>>
>>> Aloha Marcelo,
>>>
>>> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>>>
>>> > Hi list,
>>> >
>>> > I have a simple babel file with an Emacs Lisp code block, that looks
>>> like
>>> > this:
>>> >
>>> > peepopen-config.org:
>>> >
>>> >
>>> > * Load it
>>> > #+BEGIN_SRC emacs_lisp
>>> >   (add-to-list 'load-path (concat fullofcaffeine-vendor-dir
>>> "/peepopen"))
>>> >   (require 'peepopen)
>>> >   (textmate-mode)
>>> > #+END_SRC
>>> >
>>> > (provide 'peepopen-config)
>>> >
>>> >
>>> > I'm trying to tangle it with (org-babel-tangle-file "
>>> peepopen-config.org"),
>>> > but I get the following in the "Messages" buffer:
>>> >
>>> > Tangled 0 code blocks from peepopen-config.org
>>> >
>>> >
>>> > I'm confused, since the file *does* contain a code block. Am I doing
>>> > something wrong?
>>>
>>> Not really, but you do need to tell Babel you want to tangle this code
>>> block.  See the header argument :tangle, which by default is set to
>>> `no'.  If you add :tangle yes to the code block header, then it should
>>> do what you want.
>>>
>>> hth,
>>> Tom
>>>
>>> >
>>> > Thanks in advance,
>>> >
>>> > - Marcelo.
>>> > Hi list,
>>> >
>>> >
>>> > I have a simple babel file with an Emacs Lisp code block, that looks
>>> > like this:
>>> >
>>> > peepopen-config.org:
>>> >
>>> >
>>> >     * Load it
>>> >     #+BEGIN_SRC emacs_lisp
>>> >       (add-to-list 'load-path (concat fullofcaffeine-vendor-dir
>>> >     "/peepopen"))
>>> >       (require 'peepopen)
>>> >       (textmate-mode)
>>> >     #+END_SRC
>>> >
>>> >     (provide 'peepopen-config)
>>> >
>>> >
>>> > I'm trying to tangle it with (org-babel-tangle-file
>>> > "peepopen-config.org"), but I get the following in the "Messages"
>>> > buffer:
>>> >
>>> >     Tangled 0 code blocks from peepopen-config.org
>>> >
>>> >
>>> > I'm confused, since the file *does* contain a code block. Am I doing
>>> > something wrong?
>>> >
>>> > Thanks in advance,
>>> >
>>> > - Marcelo.
>>> >
>>> >
>>> >
>>>
>>> --
>>> Thomas S. Dye
>>> http://www.tsdye.com
>>>
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 4823 bytes --]

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

* Re: org-babel-tangle-file not parsing code blocks
  2013-03-25 22:45     ` Marcelo de Moraes Serpa
  2013-03-25 23:24       ` Marcelo de Moraes Serpa
@ 2013-03-25 23:39       ` Thomas S. Dye
  2013-03-25 23:48         ` Marcelo de Moraes Serpa
  1 sibling, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-03-25 23:39 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode

Aloha Marcelo,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> Oh, actually that wasn't the issue.
>
> org-babel-load-file seems to force tangling the file to an .el.
> org-babel-tangle-file doesn't. Is there a way to force the output to the
> .el file without using the parameter in the code block itself?
>

Yes, there is.

(org-babel-tangle-file FILE &optional TARGET-FILE LANG)

You should be able set TARGET-FILE with a buffer-wide header argument,
like this:

#+PROPERTY: tangle force-output-to-the.el

hth,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

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

* Re: org-babel-tangle-file not parsing code blocks
  2013-03-25 23:39       ` Thomas S. Dye
@ 2013-03-25 23:48         ` Marcelo de Moraes Serpa
  2013-03-26  0:58           ` Thomas S. Dye
  0 siblings, 1 reply; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2013-03-25 23:48 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1670 bytes --]

Hi Thomas. Thanks again for the reply.

I still don't understand why the TARGET_FILE argument is optional. I would
expect it to create a file of the same name of the org file that is
tangled. Take this code:

(org-babel-tangle-file "~/.emacs.d/config/peepopen-config.org")

Contents:

* Load it
> #+BEGIN_SRC emacs-lisp
>   (add-to-list 'load-path (concat fullofcaffeine-vendor-dir "/peepopen"))
>   (require 'peepopen)
>   (textmate-mode)
> (provide 'peepopenconfig)
> #+END_SRC


When I evaluate the (org-babel-tangle-file...) line, I get the following:

Tangled 0 code blocks from peepopen-config.org


I would expect it to tangle 1 block, and create a peepopen-config.el (no
need to define a TARGET_FILE string).

Two questions:

1) Not sure why it's not tangling the BEGIN_SRC emacs-lisp block
2) Am I wrong about the .el file creation assumption ?

Cheers!

- Marcelo.

On Mon, Mar 25, 2013 at 5:39 PM, Thomas S. Dye <tsd@tsdye.com> wrote:

> Aloha Marcelo,
>
> Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
>
> > Oh, actually that wasn't the issue.
> >
> > org-babel-load-file seems to force tangling the file to an .el.
> > org-babel-tangle-file doesn't. Is there a way to force the output to the
> > .el file without using the parameter in the code block itself?
> >
>
> Yes, there is.
>
> (org-babel-tangle-file FILE &optional TARGET-FILE LANG)
>
> You should be able set TARGET-FILE with a buffer-wide header argument,
> like this:
>
> #+PROPERTY: tangle force-output-to-the.el
>
> hth,
> Tom
>
> --
> T.S. Dye & Colleagues, Archaeologists
> 735 Bishop St, Suite 315, Honolulu, HI 96813
> Tel: 808-529-0866, Fax: 808-529-0884
> http://www.tsdye.com
>

[-- Attachment #2: Type: text/html, Size: 3033 bytes --]

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

* Re: org-babel-tangle-file not parsing code blocks
  2013-03-25 23:48         ` Marcelo de Moraes Serpa
@ 2013-03-26  0:58           ` Thomas S. Dye
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas S. Dye @ 2013-03-26  0:58 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode

Aloha Marcelo,

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> I still don't understand why the TARGET_FILE argument is optional. I would
> expect it to create a file of the same name of the org file that is
> tangled. 

Here is the docstring:

  (org-babel-tangle-file FILE &optional TARGET-FILE LANG)

  Extract the bodies of source code blocks in FILE.
  Source code blocks are extracted with `org-babel-tangle'.
  Optional argument TARGET-FILE can be used to specify a default
  export file for all source blocks.  Optional argument LANG can be
  used to limit the exported source code blocks by language.

I suppose it is optional so you don't have to specify a default export
file for all source blocks.  What if you want to tangle two or more
files from the same Org buffer?

> Take this code:
>
> (org-babel-tangle-file "~/.emacs.d/config/peepopen-config.org")
>
> Contents:
>
> * Load it
>> #+BEGIN_SRC emacs-lisp
>>   (add-to-list 'load-path (concat fullofcaffeine-vendor-dir "/peepopen"))
>>   (require 'peepopen)
>>   (textmate-mode)
>> (provide 'peepopenconfig)
>> #+END_SRC
>
>
> When I evaluate the (org-babel-tangle-file...) line, I get the following:
>
> Tangled 0 code blocks from peepopen-config.org

Well, by default :tangle no, so unless you've changed this somewhere I
think Babel will defer to the default value.

hth,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

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

end of thread, other threads:[~2013-03-26  0:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 22:02 org-babel-tangle-file not parsing code blocks Marcelo de Moraes Serpa
2013-03-25 22:03 ` Marcelo de Moraes Serpa
2013-03-25 22:19 ` Thomas S. Dye
2013-03-25 22:20   ` Marcelo de Moraes Serpa
2013-03-25 22:45     ` Marcelo de Moraes Serpa
2013-03-25 23:24       ` Marcelo de Moraes Serpa
2013-03-25 23:39       ` Thomas S. Dye
2013-03-25 23:48         ` Marcelo de Moraes Serpa
2013-03-26  0:58           ` Thomas S. Dye

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