unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Possible to hook into Emacs's buffer name generation?
@ 2011-02-18  0:28 Sean McAfee
  2011-02-18  1:37 ` Leo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sean McAfee @ 2011-02-18  0:28 UTC (permalink / raw)
  To: help-gnu-emacs

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?


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-21  1:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18  0:28 Possible to hook into Emacs's buffer name generation? Sean McAfee
2011-02-18  1:37 ` Leo
2011-02-18  9:13   ` Tassilo Horn
2011-02-18  1:37 ` Óscar Fuentes
     [not found] ` <mailman.5.1297993074.2625.help-gnu-emacs@gnu.org>
2011-02-20 23:37   ` Sean McAfee
2011-02-21  1:32     ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).