help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible to hook into Emacs's buffer name generation?


From: Sean McAfee
Subject: Possible to hook into Emacs's buffer name generation?
Date: Thu, 17 Feb 2011 16:28:11 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Lately I've been doing a lot of editing inside a large source
repository.  Sometimes I'll have different versions of the same source
file open at the same time, and it's a bit of a hassle to have to keep
in mind whether the older or the newer version is the one with a "<2>"
after its name in the mode line.

I thought it might be cool to have Emacs automatically name buffers that
are visiting files in my repository with a trailing "<component-x.y.z>"
when I open them, where component-x.y.z is simply the closest directory
name above the file that matches that pattern.  I could do this by
adding a hook to find-file-hooks and renaming the buffer according to my
scheme, but it seems cleaner to tell Emacs how to generate the desired
buffer name in the first place.  I've traced the code from find-file all
the way down to generate-new-buffer-name, but I can't find anywhere I
can interpose my buffer-naming logic.

Did I miss something, or am I out of luck?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]