From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.help Subject: Re: Possible to hook into Emacs's buffer name generation? Date: Fri, 18 Feb 2011 09:37:35 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1297993100 23625 80.91.229.12 (18 Feb 2011 01:38:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Feb 2011 01:38:20 +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 02:38:16 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 1PqFIW-0003Nz-3p for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Feb 2011 02:38:16 +0100 Original-Received: from localhost ([127.0.0.1]:46268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqFIV-00019P-DB for geh-help-gnu-emacs@m.gmane.org; Thu, 17 Feb 2011 20:38:15 -0500 Original-Received: from [140.186.70.92] (port=46248 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqFI8-00018O-Gm for help-gnu-emacs@gnu.org; Thu, 17 Feb 2011 20:37:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PqFI7-0002Hh-BK for help-gnu-emacs@gnu.org; Thu, 17 Feb 2011 20:37:52 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:44809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PqFI6-0002HC-VD for help-gnu-emacs@gnu.org; Thu, 17 Feb 2011 20:37:51 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PqFI4-0003AP-E9 for help-gnu-emacs@gnu.org; Fri, 18 Feb 2011 02:37:48 +0100 Original-Received: from 117.28.17.59 ([117.28.17.59]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Feb 2011 02:37:48 +0100 Original-Received: from sdl.web by 117.28.17.59 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Feb 2011 02:37:48 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 22 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 117.28.17.59 Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/ xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.94 (Mac OS X 10.6.6) Cancel-Lock: sha1:8ICX1EyAShbPvovSRxWgXBFBq+M= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:79202 Archived-At: On 2011-02-18 08:28 +0800, Sean McAfee wrote: > 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? Maybe you can build on top of uniquify.el? Leo