After some use, it seems better to return an alist rather than a hash table from this function; that alist is in the same order as the buffer list that was passed in, which is nice for completion. So here's a version which does that.