[Top][All Lists]

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

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

From: Jambunathan K
Subject: [Orgmode] Re: [BABEL][PROPOSAL] headlines as executable srcnames
Date: Fri, 10 Sep 2010 10:21:15 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (windows-nt)

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

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.

[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]