From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Magal Subject: Re: Embedded code Date: Thu, 20 Jan 2011 19:54:23 -0800 Message-ID: References: <2324250583714673900@unknownmsgid> <87aaizhz23.fsf@gmail.com> <4D3554AC.1060303@gmail.com> <8762tmfa74.fsf@gmail.com> <871v4a2b15.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0420316614==" Return-path: Received: from [140.186.70.92] (port=54676 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pg85H-0002Ye-1p for emacs-orgmode@gnu.org; Thu, 20 Jan 2011 22:54:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pg85F-0004vP-Gj for emacs-orgmode@gnu.org; Thu, 20 Jan 2011 22:54:46 -0500 Received: from mail-ww0-f41.google.com ([74.125.82.41]:41110) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pg85F-0004v5-3y for emacs-orgmode@gnu.org; Thu, 20 Jan 2011 22:54:45 -0500 Received: by wwi18 with SMTP id 18so220781wwi.0 for ; Thu, 20 Jan 2011 19:54:43 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode@gnu.org, Rainer M Krug --===============0420316614== Content-Type: multipart/alternative; boundary=001485f0a010dc8f4f049a53359e --001485f0a010dc8f4f049a53359e Content-Type: text/plain; charset=UTF-8 So I was able to construct the following functioning bit of code from someone else recent post: #+begin_src emacs-lisp :results output raw (defun tagged (tag &optional scope) (let ((entries ())) (org-map-entries (lambda () (add-to-list 'entries (list (concat "[[" (nth 4 (org-heading-components)) "]]")))) tag scope) (sort entries (lambda (f s) (string-lessp (car f) (car s)))))) (tagged "buy" 'agenda) #+end_src I have a few elementary questions I hope someone can bother to answer: 1. It seems that when org prints a list, it automatically formats it into a table. In lisp, what's a proper way of converting a list to a string so I can have more control over the format? My first attempts were unsuccessful. 2. I'd like to use Org's macros to replace #+begin_src (tagged "foo") #+end_src with {{{(tagged "foo")}}} but Org macros only expand on export. Would it be feasible to change the macro functionality and hook into file loading? Or is there some other way I can slim these down to be terse? On Tue, Jan 18, 2011 at 22:46, Ido Magal wrote: > Excellent. > > Now that I see that it's possible, I'm struggling to find sufficient > examples to help me understand how to go about writing the bits of lisp that > would allow to me create useful blocks of org-mode code, such as a > back-links block or a list of links to entries of a certain tag. I'm > lisp-illiterate but I was expecting that if it was possible then someone had > already done it and that I could cut and paste my way to success. > > Do these examples exist? Does anyone use babel to extend the functionality > of the note organizing aspect of org-mode? All of the babel examples I've > found relate to manipulating content for export as opposed to enhancing > organizational utility. > > Cheers and thanks again. > > > On Tue, Jan 18, 2011 at 12:42, Eric Schulte wrote: > >> > >> > 2. Is it possible to manipulate or reference the results so that they're >> not >> > bound to a RESULTS block. I'm finding all of the blocks of orgmode >> > distracting and I'm trying to avoid and eliminate them as much as >> possible. >> > I'm not used to it and they really impedes the readability of my notes. >> >> Yes, you can change the look of the results of code blocks, see the >> results header argument for more information. >> http://orgmode.org/manual/results.html >> > > --001485f0a010dc8f4f049a53359e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
So I was able to construct the following functioning bit o= f code from someone else recent post:

#+begin_src e= macs-lisp :results output raw
(defun tagged (tag &optional sc= ope)
=C2=A0(let ((entries ()))
=C2=A0=C2=A0 (org-map-entries
=C2=A0=C2=A0 =C2=A0 (lambda ()
=C2=A0=C2=A0 =C2=A0 =C2=A0 (= add-to-list 'entries
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(list (concat "[[" (nth 4 (org= -heading-components)) "]]"))))
=C2=A0=C2=A0 =C2=A0 tag scope)

=C2=A0=C2=A0 (= sort entries (lambda (f s)
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(string-lessp (car f) (car s))))))

(tagged "buy" 'agenda)
#+end= _src

I have a few elementary questions I hope someone can bo= ther to answer:

1. It seems that when org prints a= list, it automatically formats it into a table. =C2=A0In lisp, what's = a proper way of converting a list to a string so I can have more control ov= er the format? =C2=A0My first attempts were unsuccessful.

2. I'd like to use Org's macros to replace
=C2=A0
#+begin_src
(tagged "foo")
=
#+end_src

with

{{{(t= agged "foo")}}}

but Org macros only expand on export. =C2=A0Would it be= feasible to change the macro functionality and hook into file loading? =C2= =A0Or is there some other way I can slim these down to be terse?
=

On Tue, Jan 18, 2011 at 22:46, Ido Magal <ido@idomagal.com= > wrote:
Excellent.

Now that I see that it's= possible, I'm struggling to find sufficient examples to help me unders= tand how to go about writing the bits of lisp that would allow to me create= useful blocks of org-mode code, such as a back-links block or a list of li= nks to entries of a certain tag. =C2=A0I'm lisp-illiterate=C2=A0but I w= as expecting that if it was possible then someone had already done it and t= hat I could cut and paste my way to success.

Do these examples exist? =C2=A0Does anyone use babel to= extend the functionality of the note organizing aspect of org-mode? =C2=A0= All of the babel examples I've found relate to manipulating content for= export as opposed to enhancing organizational utility.

Cheers and thanks again.


On Tue, Jan 18, 2011= at 12:42, Eric Schulte <schulte.eric@gmail.com> wrote:=
>
> 2. Is it possible to manipulate or reference the results so that they&= #39;re not
> bound to a RESULTS block. =C2=A0I'm finding all of the blocks of o= rgmode
> distracting and I'm trying to avoid and eliminate them as much as = possible.
> =C2=A0I'm not used to it and they really impedes the readability o= f my notes.

Yes, you can change the look of the results of code blocks, see the results header argument for more information.
http:/= /orgmode.org/manual/results.html


--001485f0a010dc8f4f049a53359e-- --===============0420316614== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0420316614==--