emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Re: [BABEL][PROPOSAL] headlines as executable srcnames


From: Eric Schulte
Subject: [Orgmode] Re: [BABEL][PROPOSAL] headlines as executable srcnames
Date: Sun, 19 Sep 2010 22:03:11 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi Jambunathan,

So, if I'm understanding correctly, what you are proposing includes two
separate things, first, a new link-style syntax for calling code blocks,
and second, the ability to provide un-named arguments to code blocks.

I definitely agree that the second suggestion would be desirable.  Even
if we still use named arguments when writing code blocks it should be
possible to supply un-named arguments when calling code blocks, and use
the order of the arguments to resolve their variable mappings.  This has
been on our TODO list for some time and is just waiting for some
development time.

I'm less sure about expanding link syntax into a means of calling code
blocks.  There has been some recent discussion on the list about
expanding link syntax (in fact related to the thread your referenced
below) and my impression was that there is far from unanimous support
for changing the semantics of links in Org-mode.  Maybe this would be
appropriate as an optional extension to org, i.e. something in the
contrib directory.

Thanks -- Eric

Jambunathan K <address@hidden> writes:

> I am slightly drifting a bit. I think the broader theme that is emerging
> in this thread is this - how Babel as a Org's VM would enable one to
> create useful text mashups. Call it Org 2.0 if you may like.
>
> Needless, to say I am having a hammer and everything looks nail to
> me. Please be patient with my regurgitations! Read on ...
>
> ,----
> | "*Article*" #("From: Vinh Nguyen <address@hidden>
> | Subject: Re: text color + highlight
> | Newsgroups: gmane.emacs.orgmode
> | To: address@hidden
> | Date: Thu, 9 Sep 2010 09:15:05 -0700
> | Message-ID: <address@hidden>
> | Archived-At: <http://permalink.gmane.org/gmane.emacs.orgmode/30143>
> | 
> | I'd like to write a concluding email for this thread for future
> | searchers to find.  This easy solution is brought to you by Eric
> | Schulte and Christian Moe.
> | 
> | Place the following in your .emacs or init.el file:
> | ;; org-mode color
> | (org-add-link-type
> |  \"color\" nil
> |  (lambda (path desc format)p
> |   (cond
> |    ((eq format 'html)
> |     (format \"<span style=\\\"color:%s;\\\">%s</span>\" path desc))
> |    ((eq format 'latex)
> |     (format \"{\\\\color{%s}%s}\" path desc)))))
> | ;; org-mode highlight
> | (org-add-link-type
> |  \"hl\" nil
> |  (lambda (path desc format)
> |   (cond
> |    ((eq format 'html)
> |     (format \"<font style=\\\"background-color:%s;\\\">%s</font>\" path 
> desc))
> |    ((eq format 'latex)
> |     (format \"\\\\colorbox{%s}{%s}\" path desc))))) ;; require 
> \\usepackage{color}
> | 
> | Examples:
> | [[color:blue][test this out]]
> | [[hl:yellow][highlighted text]]
> | 
> | Remarks:
> | * Pros
> |   - don't need to modify org-mode source (just edit your .emacs)
> |   - use the existing links syntax
> | * Cons
> |   - cannot be used concurrently or with other formatting
> | * To Do
> |   - Hopefully it will be implemented via extensible syntax in the
> | future ($[options mytext])
> |   - highlight and color paragraph or region
> | 
> | 
> | -- Vinh
> | 
> | 
> | 
> | On Thu, Aug 5, 2010 at 1:42 PM, Vinh Nguyen <address@hidden> wrote:
> | > Dear list,
> | >
> | > I was wondering if there is an easy way to markup the color of the
> | > text for html output (and highlight as well).  When I prepare meeting
> | > minutes I'd like to color some things and highlight certain things.
> | > Right now, I am using emphasizing a major portion of the text.  It
> | > would be great to have colors and highlights to draw attention to
> | > certain items.
> | >
> | > Thanks.
> | > Vinh
> `----
>
> I wonder whether there is a way to achieve the requested feature without
> too much of elisp programming.
>
> [[color:blue][test this out]]
>  ^^^^^ ^^^^^  ^^^^^^^^^^^^^
>
> If one imagines this as a macro call 
>
> color => babel srcname [accessible through %0 in srcbody]
> blue => param1 for srcname [accessible through %1 in srcbody]
> test this out => text param for the macro ['this' param for text mashup]
>
> In my earlier post, I tried to argue that if headlines could be srcnames
> then the text content of the headline could be considered as an implicit
> 'this' param (which the 'headline macro' works upon)
>
> Now if link syntax could be used as a macro call (as seen above) then
> the description part of the link i.e., text contained within "inner []"
> could be considered as the 'this' param for link-oriented
> srcnames. (Think of links as mini, inline headlines and desc as headline
> body)
>
> It is important to note that the user still works with text documents
> which are very much like existing org documents.
>
> Note also that having positional params and having them canonically
> accessible as %0, %1, %2 etc could have it's uses [1]. It is left to the
> reader how color macro could be defined with above redefinitions.
>
> Let me reiterate (and I think it is important) Babel's macro expansion
> if tweaked and designed for 'text mashups and massages' then much of
> user requirements (like the one above) could be implemented by the user
> himself without any help from expert elisp programmers.
>
> Footnotes:
> [1] I believe babel as of this writing only permits named param list.
>
> Jambunathan K.



reply via email to

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