From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo de Moraes Serpa Subject: [OT] The joy of elisp Date: Mon, 5 Dec 2011 00:08:20 -0600 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cdf8dbc46d74804b3522580 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:33740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXRiy-00082n-Hj for emacs-orgmode@gnu.org; Mon, 05 Dec 2011 01:08:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXRix-0006qN-9y for emacs-orgmode@gnu.org; Mon, 05 Dec 2011 01:08:24 -0500 Received: from mail-bw0-f41.google.com ([209.85.214.41]:55668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXRix-0006qJ-19 for emacs-orgmode@gnu.org; Mon, 05 Dec 2011 01:08:23 -0500 Received: by bkbzt12 with SMTP id zt12so3768788bkb.0 for ; Sun, 04 Dec 2011 22:08:21 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode --000e0cdf8dbc46d74804b3522580 Content-Type: text/plain; charset=ISO-8859-1 Hi list! I decided to finally get my hands dirty and build a small function to improve my org-based productivity system. Let me explain: I have a subdirectory under ~/org which has a bunch of files named after different subjects. Originally it was supposed to model a wiki, but in practice, I create a file there whenever I start studying a new (often complex) subject and that I know I will come back often and edit / improve. It's indeed like a wiki. However, I don't keep those files in the agenda. It would slow it down a lot. To keep the organization as organic as possible, I simply use tags to bring them together semantically. So, I have other files with items that are tagged, say, business, and I have a "wiki file" with a headline like this: * tags :business: I use the tags headline to tag those files. Now, what I wanted was to get a list of files related to say, the business tag. It's quite useful to find myself in the (good) chaos of tagged "wiki files", I came up with a small elisp function that does just that! (progn (shell-command "cd ~/org; ack \"\\* tags.*(business).*\" --all" "mybuf") (set-buffer "mybuf") (beginning-of-buffer) (ignore-errors (while (search-forward-regexp "\\(.*?\\):") (replace-match "[[~/org/\\1]]" ) )) (org-mode) ) Bear in mind this is my first elisp program ever. It's not even a function yet, actually. But it works pretty well for what I want :) Took me around 1 hour to bring it up. The joy of breaking your head on something! Cheers! (Suggestions on how to improve it welcome!) Marcelo. --000e0cdf8dbc46d74804b3522580 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi list!

I decided to finally get my hands dirty a= nd build a small function to improve my org-based productivity system.
=
Let me explain:

I have a subdirecto= ry under ~/org which has a bunch of files named after different subjects. O= riginally it was supposed to model a wiki, but in practice, I create a file= there whenever I start studying a new (often complex) subject and that I k= now I will come back often and edit / improve. It's indeed like a wiki.=

However, I don't keep those files in the agenda. It= would slow it down a lot. To keep the organization as organic as possible,= I simply use tags to bring them together semantically. So, I have other fi= les with items that are tagged, say, business, and I have a "wiki file= " with a headline like this:

* tags :business:

<contents= >

I use the tags headline to tag those files.

Now, what I wanted was to get a list of files relat= ed to say, the business tag. It's quite useful to find myself in the (g= ood) chaos of tagged "wiki files", I came up with a small elisp f= unction that does just that!

(progn=A0
(shell-command "cd ~/org;= =A0ack \"\\* tags.*(business).*\" --all" "mybuf")=
(set-buffer "mybuf")
(beginning-of-buffer)
(ignore-errors
=A0 (while (search-forward-regexp "\\(.*= ?\\):")
=A0 =A0 (replace-match "[[~/org/\\1]]" )
=A0 =A0 ))
(org-mode)
)

Bear in mind this is my first elisp program ever. It's not even a funct= ion yet, actually. But it works pretty well for what I want :)
Took me around 1 hour to bring it up.

The joy of breaking your head on something!

C= heers!

(Suggestions on how to improve it welcome!)=

Marcelo.
--000e0cdf8dbc46d74804b3522580--