Use with-current-buffer instead of save-excursion/set-buffer