#+Title: Starter Kit G-Client
#+OPTIONS: toc:nil num:nil ^:nil
#+Babel: :exports code :tangle no

This is part of the [[file:starter-kit.org][Emacs Starter Kit]].

G-Client is part of T.V. Raman's [[http://code.google.com/p/emacspeak/][emacspeak]] package which provides for
interaction with Google services (e.g., google-docs, google-calendar)
from within Emacs.

* Installation
  :PROPERTIES:
  :results:  silent
  :CUSTOM_ID: instillation
  :END:

1. Grab the latest version of G-Client by running the following in
   this directory.
   #+begin_src sh
     cd src/
     svn co http://emacspeak.googlecode.com/svn/trunk/lisp/g-client/
   #+end_src

2. The in the =g-client= directory run the following commands to build
   the package.
   #+begin_src sh
     cd src/g-client
     make
   #+end_src

3. Add the =g-client= directory to the load path, and load the package
   #+begin_src emacs-lisp
     (add-to-list 'load-path
                  (expand-file-name
                   "g-client"
                   (expand-file-name
                    "src"
                    (file-name-directory
                     (or load-file-name (buffer-file-name))))))
     (load-library "g")
   #+end_src

4. Finally, in the current version of g-client one small change to the
   code is required.  In the definition `[[file:src/g-client/gdocs.el::(defun%20gdocs-publish-from-org%20()][gdocs-publish-from-org]]' the
   call to the `org-export-region-as-html' function should be changed
   from
   #+begin_src emacs-lisp
     (org-export-region-as-html (point-min) (point-max)
                                nil g-scratch-buffer)
   #+end_src
   to
   #+begin_src emacs-lisp
     (org-export-region-as-html (point-min) (point-max)
                                'body-only g-scratch-buffer)
   #+end_src
   so that the exported html only includes the body of the html
   document.  The header information generated by Org-mode seems to
   confuse google documents.

For more information see
- the [[usage]] section immediately below
- the file:src/g-client/g-client.org file included with =g-client=
- and this blog post [[http://blog.vivekhaldar.com/post/1649745633/editing-google-docs-in-emacs][blog.vivekhaldar.com/editing-google-docs-in-emacs]]

* Usage
  :PROPERTIES:
  :CUSTOM_ID: usage
  :END:
Usage is as simple as

1. add g-client to your load path
   #+begin_src emacs-lisp
     (add-to-list 'load-path (expand-file-name
                              "g-client" (expand-file-name "src" starter-kit-dir)))
   #+end_src

2. load g-client
   #+begin_src emacs-lisp
     (load-library "g")
   #+end_src

3. sign into google documents with =M-x gdocs-sign-in=

4. open an Emacs buffer which you would like to post to google docs

5. publish the buffer with `gdocs-publish-from-text'