all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sean McAfee <eefacm@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Possible to hook into Emacs's buffer name generation?
Date: Thu, 17 Feb 2011 16:28:11 -0800	[thread overview]
Message-ID: <bp8r5b66vac.fsf@usca1uw-JZWWPM1.sanmateo.corp.akamai.com> (raw)

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	other threads:[~2011-02-18  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18  0:28 Sean McAfee [this message]
2011-02-18  1:37 ` Possible to hook into Emacs's buffer name generation? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bp8r5b66vac.fsf@usca1uw-JZWWPM1.sanmateo.corp.akamai.com \
    --to=eefacm@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.