8十二/093
emacs写wordpress的一个小补丁
使用emacs的插件weblogger来写blog的时候,最新的版本在我这边没办法使用分类,所有的都是未分类的,但可使用’< ''>‘等,在weblogger的仓库中,我在bug列表里中找到到关于这方面的问题,同时,gabrielsaldana提供了一个针对之前修改的版本。该版本支持分类,但在我这边,不支持使用’< ' '>‘等,因为我从未学过lisp语言,所以没有在最新版本上做补丁,而是退一步在gabrielsaldana的版本上进行了修改,这样可以支持html部分。下面是patch:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | diff -u -r ../old/weblogger.el ./weblogger.el --- ../old/weblogger.el 2009-01-29 15:48:41.000000000 +0800 +++ ./weblogger.el 2009-12-08 19:48:44.649587365 +0800 @@ -219,9 +219,10 @@ (defvar weblogger-entry-mode-hook nil "Hook to run after starting up weblogger mode.") -(defvar weblogger-start-edit-entry-hook (lambda () - (message-goto-body) - (replace-string "\r" "" nil (point) (point-max))) +(defvar weblogger-start-edit-entry-hook + (lambda () + (message-goto-body) + (replace-string "\r" "" nil (point) (point-max))) "Hook to run after loading an entry in buffer for editting.") (defvar weblogger-new-entry-hook '(weblogger-ping-weblogs) @@ -1073,7 +1074,10 @@ (with-temp-buffer (insert (cdr content)) (goto-char (point-min)) - (replace-string (match-string 0 (cdr content)) "") + ; (replace-string (match-string 0 (cdr content)) "") + (while (and (not (string= "" (match-string 0 (cdr content)))) + (search-forward (match-string 0 (cdr content)) nil t)) + (replace-match "" nil t)) (buffer-string))) (cons "title" title))) (when authorName @@ -1161,7 +1165,7 @@ (has-mt-api t) (has-blogger-api t)) (condition-case nil - (progn (mapcar + (progn (mapc (lambda (method) (and (assoc method weblogger-capabilities) (setcdr (assoc method weblogger-capabilities) t))) @@ -1258,4 +1262,5 @@ ;; 'ispell-message "spell" message-mode-map) ;; tool-bar-map)))) -(provide 'weblogger) \ 文件结尾缺少空行 +(provide 'weblogger) + diff -u -r ../old/xml-rpc.el ./xml-rpc.el --- ../old/xml-rpc.el 2009-01-20 00:15:35.000000000 +0800 +++ ./xml-rpc.el 2009-12-08 19:36:01.510833897 +0800 @@ -175,7 +175,12 @@ "*Hook run after loading xml-rpc." :type 'hook :group 'xml-rpc) -(defcustom xml-rpc-allow-unicode-string t +(defcustom xml-rpc-use-coding-system + (if (coding-system-p 'utf-8) 'utf-8 'iso-8859-1) + "The coding system to use." + :type 'symbol :group 'xml-rpc) + +(defcustom xml-rpc-allow-unicode-string (coding-system-p 'utf-8) "If non-nil, non-ASCII data is composed as 'value' instead of 'base64'. And this option overrides `xml-rpc-base64-encode-unicode' and `xml-rpc-base64-decode-unicode' if set as non-nil." @@ -242,9 +247,11 @@ (while (and vals result) (setq result (and (setq curval (car-safe vals)) - (or (and (listp curval) (symbolp (car curval)) (string= (car curval) :struct)) - (and (memq (safe-length curval) '(1 2)) - (stringp (car-safe curval)))))) +; (or (and (listp curval) (symbolp (car curval)) (string= (car curval) :struct)) +; (and (memq (safe-length curval) '(1 2)) + (consp curval) + (stringp (car-safe curval)))) +; )) (setq vals (cdr-safe vals))) result))) @@ -356,9 +363,12 @@ (and (eq 1 (length charset-list)) (eq 'ascii (car charset-list))) (not xml-rpc-base64-encode-unicode)) - `((value nil (string nil ,(url-insert-entities-in-string value)))) - `((value nil (base64 nil ,(base64-encode-string - (encode-coding-string value 'utf-8)))))))) + `((value nil (string nil ,value))) +; (url-insert-entities-in-string value)))) + `((value nil (base64 nil ,(if xml-rpc-base64-encode-unicode + (base64-encode-string + (encode-coding-string value xml-rpc-use-coding-system)) + (base64-encode-string value)))))))) ((xml-rpc-value-doublep value) `((value nil (double nil ,(number-to-string value))))) (t @@ -528,8 +538,10 @@ ; a string, so clean it. ((stringp elem) (let ((tmp (xml-rpc-clean-string elem))) - (if (and tmp xml-rpc-allow-unicode-string) - (setq tmp (decode-coding-string tmp 'utf-8))) +; (if (and tmp xml-rpc-allow-unicode-string) +; (setq tmp (decode-coding-string tmp 'utf-8))) + (when (and tmp xml-rpc-allow-unicode-string) + (setq tmp (decode-coding-string tmp xml-rpc-use-coding-system))) (if tmp (setq result (append result (list tmp))) result))) |
原创文章,转载请注明: 转载自RIX 编程应该是快乐的
本文链接地址: emacs写wordpress的一个小补丁
文章的脚注信息由WordPress的wp-posturl插件自动生成
2010年05月08日 00:15
Hi! I got the pingback from your post. I’d really like to know/understand what you’re commenting here and integrate your patch to the version I have on my site. Can you email me so we can work something out?
2010年03月04日 21:03
我觉得我的网站够慢的了,没想到你的比我的还慢,难道是我这边网络的问题?说不定很可能是这样的
2010年03月04日 21:13
不知道你的有什么改变?你的关于我的链接连的是一个不太好的patch