From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Riley Subject: Re: Blogging org entries using google command line. Date: Thu, 09 Sep 2010 05:35:42 +0200 Message-ID: References: <87zkvroj1p.fsf@rochester.rr.com> <87vd6foeo2.fsf@rochester.rr.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=39798 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtXvl-0004zS-Ao for emacs-orgmode@gnu.org; Wed, 08 Sep 2010 23:36:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtXvg-0007PK-Pa for emacs-orgmode@gnu.org; Wed, 08 Sep 2010 23:36:09 -0400 Received: from lo.gmane.org ([80.91.229.12]:48664) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtXvg-0007Os-EL for emacs-orgmode@gnu.org; Wed, 08 Sep 2010 23:36:04 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OtXve-0004Sf-B6 for emacs-orgmode@gnu.org; Thu, 09 Sep 2010 05:36:02 +0200 Received: from 85.183.18.158 ([85.183.18.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Sep 2010 05:36:02 +0200 Received: from rileyrg by 85.183.18.158 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Sep 2010 05:36:02 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org ok, last change of the day : this removes the tags from the blogged heading (is there not an easier way?) and also converts the tags format into a comman seperated list suitable for googlecl/blogger labels. I'll put it up into git soon. --8<---------------cut here---------------start------------->8--- ;; Interface to the google command line utility. ;; org-googlecl-blog : posts the current org entry to your google blogger/blogspot blog. ;; See http://code.google.com/p/googlecl/ for details on downloading and installing the tool. ;; Another good reason for postactions on creating new-entries - possibly using a inherited tag, if ;; googlecl-auto-blog tag is set we could call this function directly with no user intervention. ;; email :rileyrgATgooglemailDOTcom (defcustom org-googlecl-blogname "My Blog Name" "The name of the default blogger/blogspot blog you wish to blog to." :group 'org-googlecl :type 'string) (defcustom org-googlecl-username "changeme@googlemail.com" "The google user id you wish to authenticate with. e.g mydevusername@googlemail.com" :group 'org-googlecl :type 'string) (defun org-googlecl-blog () (interactive) (if current-prefix-arg ; WOuld be nice to be able to query possible blogs and allow tab completion on legal names. (setq org-googlecl-blogname (read-from-minibuffer "Blog Name:"))) (save-excursion (goto-char (org-entry-beginning-position)) (let ((tmpheading (org-trim (replace-regexp-in-string (org-get-tags-string) "" (org-get-heading)) )) (tmptags (mapconcat 'identity (org-get-tags) ","))) (set-mark (org-entry-end-position)) (let*((tmpfile (make-temp-file "org-blog-html-")) (blog-command (concat "google blogger post --blog \"" org-googlecl-blogname "\" --title \"" tmpheading "\" --user \"" org-googlecl-username (if (length tmptags) (concat "\" --tags \"" tmptags "\" ")) tmpfile ))) (org-export-as-html 1 nil nil (find-file-noselect tmpfile) t) (with-current-buffer (get-file-buffer tmpfile) (save-buffer)) (start-process-shell-command "Google Blog" "*googlecl*" blog-command) )))) (provide 'org-googlecl) --8<---------------cut here---------------end--------------->8--- r.