all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: Sean McAfee <eefacm@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Possible to hook into Emacs's buffer name generation?
Date: Fri, 18 Feb 2011 02:37:52 +0100	[thread overview]
Message-ID: <87y65ektqn.fsf@wanadoo.es> (raw)
In-Reply-To: <bp8r5b66vac.fsf@usca1uw-JZWWPM1.sanmateo.corp.akamai.com> (Sean McAfee's message of "Thu, 17 Feb 2011 16:28:11 -0800")

Sean McAfee <eefacm@gmail.com> writes:

[snip]

> 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.

See if this helps:

C-h v uniquify-buffer-name-style

> 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.

The mechanism proposed above advises `create-file-buffer':

(defadvice create-file-buffer (after create-file-buffer-uniquify activate)
  "Uniquify buffer names with parts of directory name."
...

That is in the last lines of lisp/uniquify.el



  parent reply	other threads:[~2011-02-18  1:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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=87y65ektqn.fsf@wanadoo.es \
    --to=ofv@wanadoo.es \
    --cc=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.