emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Neeum Zawan <mailinglists@nawaz.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Literate Programming - Continue a Source Block?
Date: Mon, 13 Jun 2011 14:57:18 -0700	[thread overview]
Message-ID: <87zkllie03.fsf@gmail.com> (raw)
In-Reply-To: 87oc238vby.fsf@fester.com

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

Hi Neeum,

Neeum Zawan <mailinglists@nawaz.org> writes:

> Eric Schulte <schulte.eric@gmail.com> writes:
>
>> Hi Neeum,
>>
>> Thanks for your feedback.  Your point is well taken about the
>> flexibility of header arguments, and the ability of a header argument
>> based solution to overwrite blocks.
>>
>> I would mention that variables such as the newly introduced
>> `org-babel-tangle-named-block-combination' may be easily set on a
>> per-file bases using file local variables---basically adding a line like
>> the following to the top of your Org-mode file.
>
> Somehow I couldn't get your new function to work. The variable is set to
> append, and I removed all org-modes from my system except the latest
> from git. I even ensured that this code gets executed:
>
> (append (mapconcat #'identity
>     named "\n"))
>
> However, the output I get is the same as before - it just uses the first
> source block.
>

Could you try the attached example file?  I first evaluated the
following elisp code to set the combination variable's value to append.

#+begin_src emacs-lisp
  (setq org-babel-tangle-named-block-combination 'append)
#+end_src

I then call org-babel-tangle in the attached Org-mode file to generate
the attached elisp file.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: combined-tangle-example.org --]
[-- Type: text/x-org, Size: 564 bytes --]

* continued code blocks
   :PROPERTIES:
   :tangle:   yes
   :comments: yes
   :END:
#+source: foo
#+begin_src emacs-lisp
  (message "foo:%S" 1)
#+end_src

#+begin_src emacs-lisp
  (message "un-named")
#+end_src

#+source: bar
#+begin_src emacs-lisp
  (message "bar:%S" 1)
#+end_src

#+source: foo
#+begin_src emacs-lisp
  (message "foo:%S" 2)
#+end_src

#+source: bar
#+begin_src emacs-lisp
  (message "bar:%S" 2)
#+end_src

#+begin_src emacs-lisp :tangle no :results silent
  (with-temp-buffer
    (insert-file-contents "scraps.el")
    (eval-buffer))
#+end_src

[-- Attachment #3: combined-tangle-example.el --]
[-- Type: application/emacs-lisp, Size: 486 bytes --]

[-- Attachment #4: Type: text/plain, Size: 422 bytes --]


>
> Incidentally, why do we need "\n" as a separator? What if I wanted to
> do (in Python)
>
> def func(a, b, <<func_args>>):
>   stuff
>
> In other words, I want to add more arguments later on. Wouldn't a \n
> mess things up here?
>

Ah, this is a good point.  I've just changed the code to avoid inserting
superfluous newlines.  Thanks!

Cheers -- Eric

>
>
> Thanks.
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2011-06-13 22:05 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08  5:47 Literate Programming - Continue a Source Block? Neeum Zawan
2011-06-08  7:34 ` Sebastien Vauban
2011-06-08 15:20   ` Neeum Zawan
2011-06-08 19:40     ` Eric Schulte
2011-06-08 21:20       ` Neeum Zawan
2011-06-10  4:55         ` Avdi Grimm
2011-06-10 19:09         ` Eric Schulte
2011-06-10 19:27           ` Achim Gratz
2011-06-10 20:00             ` Eric Schulte
2011-06-12  8:32               ` Achim Gratz
2011-06-13 22:04                 ` Eric Schulte
2011-06-14 20:48                   ` Achim Gratz
2011-06-15 17:23                     ` Eric Schulte
2011-06-15 21:19                       ` Achim Gratz
2011-06-16  4:54                         ` Eric Schulte
2011-06-16  2:35                       ` Neeum Zawan
2011-06-11  1:02             ` Neeum Zawan
2011-06-11  0:44           ` Neeum Zawan
2011-06-11 20:08             ` Eric Schulte
2011-06-12  5:36               ` Neeum Zawan
2011-06-13 21:57                 ` Eric Schulte [this message]
2011-06-15  5:17                   ` Neeum Zawan
2011-06-15 17:27                     ` Eric Schulte
2011-06-15 19:37                       ` Neeum Zawan
2011-06-16  2:26                         ` Eric Schulte
2011-06-17  4:30                           ` Neeum Zawan
2011-06-17  4:39                             ` Eric Schulte
2011-06-17  7:00                               ` Sebastien Vauban
2011-06-19 23:38                                 ` Neeum Zawan
2011-06-16 10:14     ` Olaf.Hamann

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=87zkllie03.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mailinglists@nawaz.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).