emacs integration: problem with formatting C++ buffers before saving

Hi list,

I added this to my .emacs to clang-format C++ buffers before they are saved:

; on-save: clang-format
(add-hook 'c+±mode-hook
(add-hook 'before-save-hook 'clang-format-buffer)))

This is fine if I save an individual buffer with “C-x C-s”, but if I do “C-x s” (save-some-buffers), the buffer is clang-formatted (as expected) but sadly I lose my place in the buffer (window-start is moved to the beginning, and the point is moved to beginning-of-line about halfway down the window). Does anyone know what’s going on with that? I’m not much good with elisp, but so far I’ve overcome that deficit enough to understand most of clang-format.el. Unfortunately, I haven’t identified the problem yet. I’m prepared to spend some more time on this tomorrow, and if I come up with any improvement to clang-format.el I’ll share it of course. Any clue you may have would be much appreciated.