different result when a function run as interactive command and run as eval-expression
<p>I have a elisp function to change the <code>default-directory</code> of scratch buffer, </p>

<pre><code>(defun sd/test ()
  (interactive)
  (print (current-buffer))
  (setq default-directory "~/"))
</code></pre>

<p>I put this code in scratch buffer, whose default directory is <code>~/temp</code>, and I try to use this function to change it to <code>~/</code>.</p>

<p>The strange thing is that this function does not work when I call it from <code>M-x</code>. the defaut-directory isn't changed. 
However, when I call it from <code>M-:</code>, <code>eval-expression</code>, it works. the default-directory changed.</p>

<p>So why the first way to call the function doesn't take effect?</p>