From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.help Subject: Re: Possible to hook into Emacs's buffer name generation? Date: Fri, 18 Feb 2011 02:37:52 +0100 Message-ID: <87y65ektqn.fsf@wanadoo.es> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1298155424 28744 80.91.229.12 (19 Feb 2011 22:43:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 19 Feb 2011 22:43:44 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Sean McAfee Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 19 23:43:40 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 1PqvWd-0003xj-Io for geh-help-gnu-emacs@m.gmane.org; Sat, 19 Feb 2011 23:43:39 +0100 Original-Received: from localhost ([127.0.0.1]:53230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqvWc-0004os-W9 for geh-help-gnu-emacs@m.gmane.org; Sat, 19 Feb 2011 17:43:39 -0500 Original-Received: from [140.186.70.92] (port=46316 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqFIF-0001Bi-Hu for help-gnu-emacs@gnu.org; Thu, 17 Feb 2011 20:38:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PqFIE-0002JH-2D for help-gnu-emacs@gnu.org; Thu, 17 Feb 2011 20:37:59 -0500 Original-Received: from impaqm2.telefonica.net ([213.4.138.18]:38332 helo=telefonica.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PqFID-0002IG-L5 for help-gnu-emacs@gnu.org; Thu, 17 Feb 2011 20:37:57 -0500 Original-Received: from IMPmailhost4.adm.correo ([10.20.102.125]) by IMPaqm2.telefonica.net with bizsmtp id 9Ddu1g00Z2iL0W23MDduax; Fri, 18 Feb 2011 02:37:54 +0100 Original-Received: from qcore ([83.59.3.121]) by IMPmailhost4.adm.correo with BIZ IMP id 9Dds1g00A2cfKiB1kDdtW7; Fri, 18 Feb 2011 02:37:54 +0100 X-Brightmail-Tracker: AAAAAA== X-original-sender: 981711563@telefonica.net In-Reply-To: (Sean McAfee's message of "Thu, 17 Feb 2011 16:28:11 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 213.4.138.18 X-Mailman-Approved-At: Sat, 19 Feb 2011 17:41:40 -0500 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:79237 Archived-At: Sean McAfee writes: [snip] > 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. 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