emacs的weblogger(1.4.4)的wordpress patch

emacs的weblogger(1.4.4)的wordpress patch

主要修正了weblogger-mode 1.4.4在emacs 23.1下无法设定Wordpress的categories的bug。同时修正了在我电脑上关于日期错误的bug。
注意:我将标签(tags)的设置修改为了Summary

以下是patch:

diff -Naur old/weblogger.el new/weblogger.el
--- old/weblogger.el	2009-12-15 14:11:44.000000000 +0800
+++ new/weblogger.el	2009-12-15 16:50:10.000000000 +0800
@@ -10,7 +10,7 @@
 ;; URL: http://emacswiki.org/emacs/weblogger.el
 ;; Maintained-at: http://savannah.nongnu.org/bzr/?group=emacsweblogs
 ;; Version: 1.4.4
-;; Last Modified: <2009-12-07 17:21:57 mah>
+;; Last Modified: <zhang_ze 2009-12-15 16:50:09>
 ;; Package-Requires: ((xml-rpc "1.6.7"))
 
 (defconst weblogger-version "1.4.4"
@@ -651,7 +651,7 @@
 				    (url-host (url-generic-parse-url
                                                weblogger-server-url)))))
 		    (list "Date"
-                          (format-time-string "%d %b %Y %H:%M:%S %z"
+                          (format-time-string "%Y-%m-%d %H:%M:%S %z"
                                               (caddr (assoc "dateCreated"
                                                             entry))))
 		    (list "In-Reply-To"
@@ -666,7 +666,12 @@
 		    (list "X-TextType"
 			  (cdr (assoc "texttype" entry)))
 		    (list "Subject" title)
-		    (list "Keywords" (cdr (assoc "tags" entry)))
+                    (list "Keywords" (let ((cats (cdr (assoc "categories" entry))))
+                                       (when (> (length cats) 0)
+                                         (mapconcat
+                                          (lambda (p) p)
+                                          cats ", "))))
+		    (list "Summary" (cdr (assoc "mt_keywords" entry)))
                                         ; Note that the blogger API on
                                         ; blogger.com is depcrated and
                                         ; broken on this element.
@@ -1199,7 +1204,7 @@
 	(url         (cdr (assoc-string "link" response t)))
 	(description      (assoc-string "description" response))
 	(extended         (assoc-string "mt_text_more" response))
-	(tags        (cdr (assoc-string "mt_tags" response t)))
+	(mt_keywords        (cdr (assoc-string "mt_keywords" response t)))
         (categories  (cdr (assoc-string "categories" response t))))
     
     (cond (content
@@ -1254,8 +1259,8 @@
 			(cons "url"          url))
 		      (when dateCreated
 			(cons "dateCreated"  dateCreated))
-		      (when tags
-			(cons "tags"   tags))
+		      (when mt_keywords
+			(cons "mt_keywords"   mt_keywords))
 		      (when categories
 			(cons "categories"   categories))
 		      (when textType
@@ -1281,10 +1286,10 @@
            (cons "link" (cdr (assoc "url" entry))))
          (when (cdr (assoc "content" entry))
            (cons "description" (cdr (assoc "content" entry))))
-         (when (cdr (assoc "tags" entry))
-           (cons "mt_tags" (cdr (assoc "tags" entry))))
          (when (cdr (assoc "categories" entry))
-           (cons "categories" (cdr (assoc "categories" entry)))))))
+           (cons "categories" (cdr (assoc "categories" entry))))
+         (when (cdr (assoc "mt_keywords" entry))
+           (cons "mt_keywords" (cdr (assoc "mt_keywords" entry)))))))
 
 (defun weblogger-server-userid ()
   "Get information on user."
@@ -1366,7 +1371,11 @@
 	   (cons "url"           (message-fetch-field "X-Url"))
 	   (cons "title"     (or (message-fetch-field "Subject") 
 				 weblogger-default-title))
-	   (cons "tags" (message-fetch-field "Keywords"))
+           (cons "categories" (vconcat (or (message-tokenize-header
+                                            (message-fetch-field "Keywords") ", ")
+                                           weblogger-default-categories)))
+	   (cons "mt_keywords" (message-fetch-field "Summary"))
+
 	   (when (message-fetch-field "In-Reply-To")
              (cons "trackbacks"
                    (or (message-tokenize-header 
diff -Naur old/xml-rpc.el new/xml-rpc.el
--- old/xml-rpc.el	2009-12-15 14:11:30.000000000 +0800
+++ new/xml-rpc.el	2009-12-15 16:51:26.000000000 +0800
@@ -13,7 +13,7 @@
 ;; Keywords: xml rpc network
 ;; URL: http://emacswiki.org/emacs/xml-rpc.el
 ;; Maintained-at: http://savannah.nongnu.org/bzr/?group=emacsweblogs
-;; Last Modified: <2009-12-07 17:21:47 mah>
+;; Last Modified: <zhang_ze 2009-12-15 16:51:25>
 
 ;; This file is NOT (yet) part of GNU Emacs.
 
@@ -369,6 +369,8 @@
    ((xml-rpc-value-datetimep value)
     `((value nil (dateTime.iso8601 nil ,(xml-rpc-datetime-to-string value)))))
    ;; list
+   ((vectorp value)
+    (xml-rpc-value-to-xml-list (append value nil)))
    ((xml-rpc-value-arrayp value)
     (let ((result nil)
 	  (xmlval nil))

发布者

rix

如果连自己都不爱自己,哪还有谁来爱你