use with-current-buffer to avoid interference with font-locking

set-buffer was previously used, but shouldn't be here