emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Riley <rileyrg@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Blogging org entries using google command line.
Date: Thu, 09 Sep 2010 05:35:42 +0200	[thread overview]
Message-ID: <i69kmk$7ft$1@dough.gmane.org> (raw)
In-Reply-To: 87vd6foeo2.fsf@rochester.rr.com


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.

  reply	other threads:[~2010-09-09  3:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-08 21:11 Blogging org entries using google command line Richard Riley
2010-09-08 22:32 ` Eric Schulte
2010-09-09  0:12   ` Richard Riley
2010-09-09  0:30 ` Tim Burt
2010-09-09  1:05   ` Richard Riley
2010-09-09  2:04     ` Tim Burt
2010-09-09  3:35       ` Richard Riley [this message]
2010-09-10  8:01         ` Yavuz Arkun
2010-09-10 17:00           ` Richard Riley
2010-09-12 16:40         ` David Maus
2010-09-12 16:57           ` Richard Riley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='i69kmk$7ft$1@dough.gmane.org' \
    --to=rileyrg@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).