From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sean McAfee Newsgroups: gmane.emacs.help Subject: Possible to hook into Emacs's buffer name generation? Date: Thu, 17 Feb 2011 16:28:11 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1297989660 9842 80.91.229.12 (18 Feb 2011 00:41:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Feb 2011 00:41:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 18 01:40:56 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PqEOz-0006ZZ-Tp for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Feb 2011 01:40:54 +0100 Original-Received: from localhost ([127.0.0.1]:34075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqEOz-0004rv-AI for geh-help-gnu-emacs@m.gmane.org; Thu, 17 Feb 2011 19:40:53 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Thu, 17 Feb 2011 18:28:36 -0600 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:9Hhu+uJX4nqqp72HUEgBIVe757E= Original-Lines: 17 Original-X-Trace: sv3-GEsfQYzVW8IJCVcT5aN966XB61hTpONDiK4A3uwGA8n3axqhZhxM7S/g0kRTKBUDRIeAcLcwpv6jj7J!zA5p6KZGJ8L0EwIdQaq9diHTGqRcV6j318uv8Y2Y49qPD7XqpPq4NHpalfSuKXWo/qm6tY8rerGo!GtmxLzbvnURV/QpcX3pduKSX Original-X-Complaints-To: www.supernews.com/docs/abuse.html X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2032 Original-Xref: usenet.stanford.edu gnu.emacs.help:185042 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79200 Archived-At: 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 "" 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?