emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "François Pinard" <pinard@iro.umontreal.ca>
To: emacs-orgmode@gnu.org
Subject: Re: Seeking advice for conditional code
Date: Thu, 31 Jan 2013 17:09:25 -0500	[thread overview]
Message-ID: <868v796m3u.fsf@iro.umontreal.ca> (raw)
In-Reply-To: <86halx3w0f.fsf@somewhere.org> (Sebastien Vauban's message of "Thu, 31 Jan 2013 22:03:44 +0100")

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> Hi François,

Hi, Sebastien! :-)

> Please tell if that's more or less the direction you want to take...

Direction already taken, and completed a few minutes ago! :-).  But I'll
happily revert to something else it if there is a better way to proceed.
The addition of pseudo-Org directives does not really please me, I would
prefer plain Org if possible.  If you are curious, see comments at start
of https://github.com/pinard/poporg/blob/master/extradoc.py.  In my
application, I even define context from the Makefile, which is an
unexpected advantage.

> I want to be sure to understand: do you need
> - conditional tangled code, or
> - conditional "full" document (containing conditional code and conditional
>   doc)?
> When you say "conditional", do you mean to to be able to decide to include it
> or not, or even more (such as including one version or the other)?

Exactly! :-) It's not tangling.  Rather, merely extract the
documentation out of comments found in (program) source code.  The
comments (once removed the hash marks) are in Org format.  I'm seeking
for conditional documentation.

> What's sure if that you can have conditions based on tags, and things in the
> following spirit::
> * Show the params                                                        :dev:
> Params are "dynamically" assigned. Here the results with the "dev" tag:
> #+begin_src sh :rownames no :var data=(concat (car (org-get-tags-at (point))) "-params") :exports both
> echo $data
> #+end_src

I should have thought at exploring the usage of Org tags.  :export: and
:noexport: are already very useful, but the idea did not come to me that I
could extend this to other tags.  I probably do not use tags enough!

In any case, the example above is quite interesting, and could be useful
to solve other problems.  I'll keep it around.

> #+tblname: params
> | Variable           | dev | stg | prd |
> |--------------------+-----+-----+-----|
> | webServerName      | a   | g   | m   |
> | loginWebServerName | b   | h   | n   |
> | pwWebServerName    | c   | i   | o   |
> | appBaseDir         | d   | j   | p   |
> | dbName             | e   | k   | q   |
> | dbBackupFile       | f   | l   | r   |

I missed the point of this table however, I presume the "dev" column is
to be linked in some way to the ":dev:" tag, but I do not see why/how.

> Best regards,

Thanks for caring, Sebastien!  I feel all warm inside :-).

François

  reply	other threads:[~2013-01-31 22:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 17:09 Seeking advice for conditional code François Pinard
2013-01-31 18:55 ` John Kitchin
2013-01-31 21:03 ` Sebastien Vauban
2013-01-31 22:09   ` François Pinard [this message]
2013-01-31 22:56     ` Sebastien Vauban
2013-02-01  2:25       ` François Pinard
2013-02-01  8:24         ` Sebastien Vauban
2013-02-02  0:46           ` Eric S Fraga

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=868v796m3u.fsf@iro.umontreal.ca \
    --to=pinard@iro.umontreal.ca \
    --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).