Archive for the ‘Emacs’ Category

用weblogger.el在Emacs下写myspace的博客

May 14, 2010

呵呵,myspace也是支持metaweblog接口的,但是要让weblogger.el支持它,需要做一点点的hacking。

长话短说,你可以直接使用我的weblogger.el和xml-rpc.el,放在我的svn下。

这是我发给weblogger作者的补丁及说明:

Hi, mah

First thanks for the great weblogger-el!

I made some changes to weblogger.el and xml-rpc.el to make it support Windows
Live blog, which is basically based on metaWeblog. Hope you find it
useful.

The 2 patches is attached, in case you want to apply them. But also, I
inline them to make a line-by-line explanation to you.

=== modified file 'weblogger.el'
--- weblogger.el        2010-03-11 06:51:51 +0000
+++ weblogger.el        2010-04-06 14:55:03 +0000
@@ -378,11 +378,11 @@
                                      ("blogger.newPost" . nil)
                                      ("blogger.editPost" . nil)
                                      ("blogger.deletePost" . nil)
-                                      ("metaWeblog.newPost" . nil)
-                                      ("metaWeblog.editPost" . nil)
-                                      ("metaWeblog.getPost" . nil)
-                                      ("metaWeblog.getRecentPosts" . nil)
-                                      ("metaWeblog.getCategories" . nil)
+                                      ("metaWeblog.newPost" . t)
+                                      ("metaWeblog.editPost" . t)
+                                      ("metaWeblog.getPost" . t)
+                                      ("metaWeblog.getRecentPosts" . t)
+                                      ("metaWeblog.getCategories" . t)

>> without these changes, the wrong APIs will be called, blogger.*
>> instead of metaWeblog.*

>> This patch is dirty, I think it will break blogger for
>> metaWeblog. How can I make a better solution?

                                      ("metaWeblog.newMediaObject" . nil)
                                      ("metaWeblog.deletePost" . nil)
                                      ("metaWeblog.getTemplate" . nil)
@@ -1346,8 +1346,6 @@
                       (cons "url"          url))
                     (when dateCreated
                       (cons "dateCreated"  dateCreated))
-                     (when mt_keywords
-                       (cons "mt_keywords"   mt_keywords))
>> This doesn't make sense, mt_keywords as a symbol is defined nowhere,
>> and Elisp report error

                     (when categories
                       (cons "categories"   categories))
                     (when textType
@@ -1456,9 +1454,9 @@
          (cons "url"           (message-fetch-field "X-Url"))
          (cons "title"     (or (message-fetch-field "Subject")
                                weblogger-default-title))
-           (cons "categories" (vconcat (or (message-tokenize-header
+           (cons "categories" (car (list (or (message-tokenize-header
                                            (message-fetch-field "Keywords") ", ")
-                                           weblogger-default-categories)))
+                                           weblogger-default-categories))))

>> From your latest xml-rpc, I guess you are trying to make xml-rpc
>> array a real elisp vector here, right? but it's not working yet, so I
>> made the above changes.

>> "categories" parameter need to be an array of strings, and from
>> xml-rpc comments, an array in xml-rpc is a list, not a vector in Elisp.

          (cons "mt_keywords" (message-fetch-field "Summary"))

          (when (message-fetch-field "In-Reply-To")