From: bg66 Date: Fri, 26 Dec 2008 02:44:09 +0000 (+0000) Subject: (mixi-replace-tab-and-space-to-nbsp): New user option. X-Git-Tag: mixi-el-2_2_0~2 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=84b8178206a49ada2b6581f5b533dd57f88cbbdc;p=elisp%2Fmixi.git (mixi-replace-tab-and-space-to-nbsp): New user option. (mixi-replace-tab-and-space-to-nbsp): New function. (mixi-post-diary): Use it. (mixi-post-topic): Ditto. (mixi-post-comment): Ditto. (mixi-post-message): Ditto. --- diff --git a/ChangeLog b/ChangeLog index 35c06e0..a4800d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-12-26 OHASHI Akira + + * mixi.el (mixi-replace-tab-and-space-to-nbsp): New user option. + (mixi-replace-tab-and-space-to-nbsp): New function. + (mixi-post-diary): Use it. + (mixi-post-topic): Ditto. + (mixi-post-comment): Ditto. + (mixi-post-message): Ditto. + 2008-12-09 OHASHI Akira * mixi-gnus.el (toplevel): Avoid warnings when compiling. diff --git a/mixi-ja.texi b/mixi-ja.texi index e276ed2..c14f355 100755 --- a/mixi-ja.texi +++ b/mixi-ja.texi @@ -1437,6 +1437,11 @@ mixi $B$N%5%$%H$O<+F0%D!<%k$J$I$GC;;~4V$KO"B3$7$F%"%/%;%9$7$?>l9g!"$=$N@\(B $B@\B3$r5qH]$5$l$?>l9g$KBT5!$9$k(B@emph{$BIC?t(B}$B$r;XDj$7$^$9!#(B @end defopt +@defopt mixi-replace-tab-and-space-to-nbsp +$BuBV$rJ]$D$?$a$K%?%V$H%9%Z!<%9$rJ8;zH$G$"$k(B @code{ } $B$XCV49$9$k$+$I$&$+$r;XDj$7$^$9!#(B +@end defopt + @defopt mixi-cache-expires mixi $B%*%V%8%'%/%H$N%-%c%C%7%e$NM-8z4|8B$r;XDj$7$^$9!#(B diff --git a/mixi.el b/mixi.el index 6b6bd2e..426b276 100644 --- a/mixi.el +++ b/mixi.el @@ -138,7 +138,7 @@ (autoload 'w3m-retrieve "w3m") (autoload 'url-retrieve-synchronously "url")) -(defconst mixi-revision "$Revision: 1.201 $") +(defconst mixi-revision "$Revision: 1.202 $") (defgroup mixi nil "API library for accessing to mixi." @@ -221,6 +221,11 @@ Increase this value when unexpected error frequently occurs." :type 'number :group 'mixi) +(defcustom mixi-replace-tab-and-space-to-nbsp t + "*If non-nil, replace tab and space to   for keeping formatted." + :type 'boolean + :group 'mixi) + (defcustom mixi-cache-expires nil "*Seconds for expiration of a cached object." :type '(radio (integer :tag "Expired seconds") @@ -565,6 +570,18 @@ Increase this value when unexpected error frequently occurs." (setq pos (+ (match-end 0) 1))) string)) +(defun mixi-replace-tab-and-space-to-nbsp (string) + (when mixi-replace-tab-and-space-to-nbsp + (let ((pos 0)) + (while (or (string-match "\t" string pos) + (string-match " " string pos)) + (if (string= (match-string 0 string) "\t") + (setq string (replace-match (make-string tab-width ?\ ) + nil nil string)) + (setq string (replace-match " " nil nil string)) + (setq pos (+ (match-end 0) 1)))) + string))) + ;; Object. (defconst mixi-object-prefix "mixi-") @@ -1455,7 +1472,8 @@ Increase this value when unexpected error frequently occurs." (setq fields `(("post_key" . ,post-key) ("id" . ,(mixi-friend-id (mixi-make-me))) ("diary_title" . ,title) - ("diary_body" . ,content) + ("diary_body" . ,(mixi-replace-tab-and-space-to-nbsp + content)) ("submit" . "confirm"))) (with-mixi-post-form (mixi-post-diary-page) fields (unless (re-search-forward mixi-post-succeed-regexp nil t) @@ -1920,7 +1938,8 @@ Increase this value when unexpected error frequently occurs." (mixi-post-error 'cannot-find-key community))) (setq fields `(("post_key" . ,post-key) ("bbs_title" . ,title) - ("bbs_body" . ,content) + ("bbs_body" . ,(mixi-replace-tab-and-space-to-nbsp + content)) ("submit" . "confirm"))) (with-mixi-post-form (mixi-post-topic-page community) fields (unless (re-search-forward mixi-post-succeed-regexp nil t) @@ -2519,10 +2538,12 @@ Increase this value when unexpected error frequently occurs." (setq fields `(("post_key" . ,post-key) ("owner_id" . ,(mixi-friend-id (mixi-diary-owner parent))) - ("comment_body" . ,content) + ("comment_body" . ,(mixi-replace-tab-and-space-to-nbsp + content)) ("submit" . "confirm"))) (setq fields `(("post_key" . ,post-key) - ("comment" . ,content) + ("comment" . ,(mixi-replace-tab-and-space-to-nbsp + content)) ("submit" . "confirm")))) (with-mixi-post-form (funcall page parent) fields (unless (re-search-forward mixi-post-succeed-regexp nil t) @@ -2725,7 +2746,7 @@ Increase this value when unexpected error frequently occurs." (mixi-post-error 'cannot-find-key friend))) (setq fields `(("post_key" . ,post-key) ("subject" . ,title) - ("body" . ,content) + ("body" . ,(mixi-replace-tab-and-space-to-nbsp content)) ("yes" . "¡¡Á÷¡¡¿®¡¡") ("submit" . "confirm"))) (with-mixi-post-form (mixi-post-message-page friend) fields