(defun replace-white-space-to-2ch-board-format (begin end)
(interactive
(let ()
(list
(if (and transient-mark-mode mark-active)
(region-beginning))
(if (and transient-mark-mode mark-active)
(region-end)))))
(let ((temp (buffer-substring begin end))
(buffer (get-buffer-create
"*replace-white-space-to-2ch-board-format*")))
(with-current-buffer buffer
(erase-buffer)
(insert temp)
(untabify (point-min) (point-max))
(call-process-region (point-min) (point-max) shell-file-name t buffer nil
shell-command-switch "perl -pe 's/^\\s*/q{ } x length($&)/e'")
(kill-ring-save (point-min) (point-max))
(kill-buffer buffer))))
test