(if (equal to-buffer 'string)
          (progn (setq str-ret (buffer-string))
                 (kill-buffer (current-buffer))
                 str-ret)
        (kill-buffer (current-buffer)))