+(defun riece-yank-strip-space (string)
+ (with-temp-buffer
+ (insert string)
+ (untabify (point-min) (point-max))
+ ;; Delete blank lines before the first non-blank line.
+ (goto-char (point-min))
+ (while (looking-at " *$")
+ (delete-region (point) (progn (forward-line) (point))))
+ ;; Delete blank lines after the last non-blank line.
+ (goto-char (point-max))
+ (while (progn (beginning-of-line) (looking-at " *$"))
+ (delete-region (point) (progn (end-of-line 0) (point))))
+ ;; Delete common spaces in front of lines.
+ (let ((space-width (point-max)))
+ (while (looking-at " +")
+ (setq space-width (min space-width (length (match-string 0))))
+ (forward-line))
+ (goto-char (point-min))
+ (while (not (eobp))
+ (delete-char space-width)
+ (forward-line)))
+ (buffer-string)))
+
+(defun riece-command-yank (arg prefix)
+ (interactive "P\nsPrefix: ")