+(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)))
+