uniquify:これは便利。同名ファイルのバッファ名の識別文字列を変更する

同名のファイル(例えばMakefile)を複数開くと、バッファ名がMakefileMakefile<2>のようになってしまいます。今まではC-x C-v(find-alternate-file)でどこのMakefileかを判別していました。

uniquify.elを使って

(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)

のように書けばMakefileMakefileのようになってくれるのでバッファ名だけで識別できます。

uniquify-buffer-name-styleには以下のものが用意されているようです。

nil                         Makefile                     Makefile<2>
forward                     WebService-YouTube/Makefile  Plagger-Plugin-CustomConfig/Makefile
reverse                     Makefile\WebService-YouTube  Makefile\Plagger-Plugin-CustomConfig
post-forward                Makefile|WebService-YouTube  Makefile|Plagger-Plugin-CustomConfig
post-forward-angle-brackets Makefile<WebService-YouTube> Makefile<Plagger-Plugin-CustomConfig>

ちょっと例が悪かったのですが、reverseはそのファイルに至るディレクトリの順番が逆転しています。詳しくはM-x describe-variableuniquify-buffer-name-styleで。