Buffer-manipulation utility functions for Emacs