Revert "Use with-current-buffer."

This reverts commit 5ee1cb497c3143fb3f500e9e304ca39de15d0d46.
Fix a bug with partial-completion.