[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emacs-wiki-discuss] Re: Including RSS feeds in a project page
From: |
John Sullivan |
Subject: |
Re: [emacs-wiki-discuss] Re: Including RSS feeds in a project page |
Date: |
Sat, 26 Mar 2005 01:09:24 -0500 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Chris Lowis <address@hidden> writes:
>> My idea was to use the (rough) delicious-el code that I've written
>> (http://johnsu01.isa-geek.net:8000/darcs/delicious-el/delicious-el.tar.gz) to
>> pull information into Planner pages.
>
> I thought about that after I posted the first message - I use your delicious
> code with w3m-emacs.
>
>> There's several possibilities for exactly
>> how this could work. If you want to give some examples of what exactly you
>> would like to see on your plan pages and what kinds of things you would like
>> to
>> be able to configure, throw them out and I'll give it a go.
>
> On a project page for example, it would be useful to have a * Bookmarks
> section, for example, containing related bookmarks for that project. Then if I
> tag a url in del.icio.us with a project.name tag, the information would appear
> in the project page. If it could appear in both the Emacs buffer AND the
> published page, and include the "information" field from delicious as well,
> that would be fantastic.
Here's a first quick effort at something like what you are talking about.
Not very tested.
Put something like this on a planner page to try it out:
* Delicious
<lisp>
(planner-rewrite-delicious-posts "fooproject.name")
</lisp>
Ideally you won't have to put "fooproject.name" there but could have the right
thing automatically inserted.
I tried with (planner-rewrite-delicious-posts (planner-page-name)), but that
locked up emacs. Should that happen?
(planner-rewrite-delicious-posts (buffer-name)) worked, but is not ideal.
(defun planner-rewrite-delicious-posts (&optional tag date)
"Insert all posts from your account filtered by TAG, from DATE.
Into the '* Delicious' section of your planner page. If no DATE
is specified, the most recent date with posts will be used.
DATE format should be %C%y-%m-%dT%H:%M:%SZ. The T and Z are literal."
(save-excursion
(goto-char (point-min))
(re-search-forward "* Delicious")
(forward-line 2)
(save-excursion
(let ((beg (line-beginning-position))
(end (if (re-search-forward "^* " (point-max) t)
(line-beginning-position)
(point-max))))
(delete-region beg end)))
(let ((matching-posts (delicious-api-get-posts tag date)))
(ignore
(mapc (lambda (post)
(let* ((href (cdr (assoc "href" post)))
(description (cdr (assoc "description" post)))
(extended (cdr (assoc "extended" post))))
(insert (format "[[%s]" href))
(if (null description)
(insert "]\n")
(insert (format "[%s]]\n" description)))
(unless (null extended)
(insert (format "%s\n" extended)))
(insert "\n")))
matching-posts)))))