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

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

Re: Possible to hook into Emacs's buffer name generation?


From: Leo
Subject: Re: Possible to hook into Emacs's buffer name generation?
Date: Fri, 18 Feb 2011 09:37:35 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.94 (Mac OS X 10.6.6)

On 2011-02-18 08:28 +0800, Sean McAfee wrote:
> 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?

Maybe you can build on top of uniquify.el?

Leo




reply via email to

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