johnsu01 (johnsu01) wrote,

planner-delicious tips

Working out some more kinks and finding a routine.

I've been working on planner-delicious quite a bit lately. It's coming along, but I've run into a difficult bug that locks up my emacs session entirely if I try to embed the lisp to insert my posts between <lisp></lisp> tags. I still wasn't able to solve it tonight, but I did write a workaround, which is to define planner-day-page-template as a function rather than a string, and to include the function to insert my posts in the body of that function. Here's what that code in my .emacs looks like:

(defun johnsu01/planner-daily-template () "Build a new daily planner page." (let* ((planner-timewarp-date (planner-get-current-date-filename)) (yesterday (planner-yesterday))) (insert "* Tasks\n\n\n* Diary\n\n\n* Notes\n\n\n* Delicious\n\n") (planner-delicious-insert-posts "to-read to-listen" yesterday 'any))) (setq planner-day-page-template 'johnsu01/planner-daily-template)

(Note the use of Sacha Chua's time machine hack.)

This inserts whatever posts I tagged with either "to-listen" or "to-read" on the day preceding the date of the day page. So, today's page displays yesterday's posts.

So, for example, today's page includes:

* Delicious

[[][NPR : Privacy Groups Sound Warning on Homeland Security Database]]

[[][NPR : 'Sith' a Compelling Walk Down the Dark Side]]

[[][NPR : 'Revenge of the Sith': The Power of the Dark Side]]

[[][NPR : I Blog, I Said: Writing Amid the Rabble]]

These are all NPR stories that I tagged "to-listen". (I'm sure I'll get around to listening to them in about a month.) In the emacs buffer, they are all hyperlinks I can follow just by hitting enter on the description. I don't see the actual http links as shown above while in the emacs buffer --- just the description that follows them.

The problem with that is that I often look at a page far in advance. So, if I go to a page for the date a week from now, it will have no posts on it. To fix that, the following function forces an update using the same criteria as above. So when I get to the actual date, I'll run this command, and it will insert the matching posts.

(defun johnsu01/planner-delicious-update () "Rewrite the delicious section on this planner page." (interactive) (let* ((planner-timewarp-date (planner-get-current-date-filename)) (yesterday (planner-yesterday))) (planner-delicious-insert-posts "to-read to-listen" yesterday 'any)))

These are just what I want to see every day by default. If I want to see something different on a particular day, or want to insert some posts with a particular set of tags into some project page, then I'll use the more open-ended commands planner-delicious-insert-posts-any and planner-delicious-insert-posts-all, which are defined in the planner-delicious file.

You can download the planner-delicious files here. Everything is still developing, so please make backups and be careful.

Tags: delicious, emacs, lisp, planner
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.