Friday, March 02, 2007

An Emacs Client For Google Services

1 An Emacs Interface To Google Services

Google offers a number of services using a Google account. Many of these services also expose a Web API. this package provides a set of Emacs modules for accessing these services from inside Emacs. These modules are designed with an Emacs-centric, rather than a Web-browser centered view of the world. Where necessary Emacs package browse-url is used to invoke the Web browser of choice.

The current distribution can be downloaded from Google Code Hosting and the source code is available via Subversion. Note that this is still work in progress. I'm releasing it as part of the Emacspeak project since I believe the package already has sufficiently useful functionality for users who spend a large amount of their time inside Emacs. There is no dependency on Emacspeak, and all clients provided here can be used without Emacspeak loaded.

1.1 Installation

These are needed only if installing package g-client stand-alone, i.e. outside of Emacspeak.

  • Unpack the tar archive and place the resulting g-client directory on your emacs load-path.
  • Type make to compile the code.
  • In your .emacs, add (load-library "g") to set it up.

1.2 How It Works

Clients are implemented using Google APIs based on Atom Publishing Protocol APP and Google Data APIs (GData). We use curl to retrieve content via HTTPS and xsltproc to transform the retrieved content to browsable HTML.

Clients sign you in the first time you invoke commands that require authentication. Once signed in, the session cookie is cached for future use. Session cookies presently expire in 30 minutes, and clients check for expired cookies when authentication is needed. If the cookie has expired, clients retrieve a fresh cookie using the authentication credentials provided earlier. Note that authorization tokens etc are specific to a given service.

1.3 Top-level Customizations

All clients in this package use Emacs' customize interface to set user preferences. The most commonly used ones are enumerated below.

  • g-user-email Default email-id to use. Individual clients typically override this via user option <clientname>-user-email.
  • g-html-handler Name of function that handles HTML content.

1.4 Google Blogger gblogger

This client implements posting, editting and deleting of blog entries using the new Blogger API --- it replaces the now obsolete atom-blogger that implemented similar functionality using the old Blogger API. It uses value of customization option g-user-email by default; this can be overridden via option gblogger-user-email. See Blogger GData API for the underlying APIs used. For editing posts, I recommend installing nxml-mode.

  • Browse Command gblogger-blog brings up the list of blogs owned by the currently authenticated user.
  • Posting Command gblogger-new-entry takes a post URL and sets up a special buffer where you can compose your article. the post url is obtained from the feed of blogs above, use the post link for the blog to which you wish to post.
  • Browsing Command gblogger-atom-display displays the atom feed for a specified blog as a browsable HTML page. In addition to reading your blog, this helps you find the edit url for individual posts.
  • Editting Command gblogger-edit-entry takes the edit url of a previously posted entry. It retrieves the entry, and sets up a special composition buffer where you can edit the entry.
  • Submitting The special composition buffer created by commands gblogger-new-entry and gblogger-edit-entry provide a special command gblogger-publish (bound to C-c C-c) that submits the entry to blogger.
  • Deleting Command gblogger-delete-entry deletes an entry specified by its edit url.

1.5 Google Calendar gcal

This client can be used to view, add or delete events from the Google Calendar for the authenticated user. It uses value of customization option g-user-email by default; this can be overridden via option gcal-user-email. Commands that display calendar items optionally accept the feed url of the calendar to view; this can be used to view calendars to which the authenticated user has read access. See GData Calendar API for the underlying APIs used.

  • View Command gcal-calendar-agenda displays the default calendar for the authenticated user. A prefix arg prompts for the calendar to display. This command is best used from inside the Emacs calendar; in this case, it uses the date under point when showing the agenda.
  • Add Command gcal-add-event prompts for event details and adds it to the calendar.
  • Accept Command gcal-accept-event accepts an event. Event is specified using the edit url of the event.
  • Delete Command gcal-delete-event deletes an event. Event is specified using the edit url of the event.

1.6 Google Reader greader

This client allows the authenticated user to read, browse and subscribe/unsubscribe to feeds. It uses value of customization option g-user-email by default; this can be overridden via option g-user-email.

  • Reading Command greader-reading-list displays the reading list (river of news).
  • Browsing Command greader-feed-list displays a browsable Web page with pointers to subscribed feeds.
  • Finding Command greader-find-feeds searches for matching feeds to subscribe.
  • Subscribing Commands greader-subscribe-feed and greader-unsubscribe-feed are used to subscribe and unsubscribe.
  • Labeling Command greader-star and greader-add-label are used to label articles.
  • Reading Starred articles can be read by providing a prefix argument to command greader-reading-list. Thus, C-u M-x greader-reading-list will prompt for the specific set of articles to retrieve.

Author: T.V Raman <raman@cs.cornell.edu>>

Date: 2007/03/02 10:36:07