title: emacs save-excursion not restoring point?
body: <p>I'm running this function (interactive and in a hook) to reformat source code</p>
  
  <pre><code>(defun a-style ()                                                                                                                                                                                         
    (interactive)                                                                                                                                                                                           
    (save-excursion                                                                                                                                                                                         
      (shell-command-on-region (point-min) (point-max) "/usr/local/bin/astyle -A10 -s4 -m0 -M40 -k1 -W0 -z2 -xd -CSKNLwYfpHjJcn" t t)))
  </code></pre>
  
  <p>but the save-excursion does not seem to work, the point always jumps to 1 (the shell command works though!). Am I missing something obvious here?</p>
  
  <p>Thanks,
  Mario</p>
  
  <p>EDIT:</p>
  
  <p>So I finally did it the naive way:</p>
  
  <pre><code>(defun a-style ()                                                                                                                                                                                         
    (interactive)                                                                                                                                                                                           
    (setq temp-point (point))                                                                                                                                                                               
    (shell-command-on-region (point-min) (point-max) "/usr/local/bin/astyle -A10 -s4 -m0 -M40 -k1 -W0 -z2 -xd -CSKNLwYfpHjJcn" t t)                                                                         
    (goto-char temp-point))
  </code></pre>
  
  <p>Kinda stupid, but does what I want. If anyone knows of a better solution, I'd be grateful.</p>