From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Aaron Maxwell Newsgroups: gmane.emacs.help Subject: (source) Anything like this exist already? (buffer name intelligence) Date: Fri, 11 Jan 2008 11:01:27 -0800 Message-ID: <200801111101.27609.amax@redsymbol.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1200078117 22157 80.91.229.12 (11 Jan 2008 19:01:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2008 19:01:57 +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 Jan 11 20:02:17 2008 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.50) id 1JDP8w-0004hX-R2 for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Jan 2008 20:02:15 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDP8Z-0006hk-6F for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Jan 2008 14:01:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDP8J-0006dl-0w for help-gnu-emacs@gnu.org; Fri, 11 Jan 2008 14:01:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDP8H-0006aT-8t for help-gnu-emacs@gnu.org; Fri, 11 Jan 2008 14:01:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDP8H-0006a8-4W for help-gnu-emacs@gnu.org; Fri, 11 Jan 2008 14:01:33 -0500 Original-Received: from smtp-gw30.mailanyone.net ([208.70.128.56]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JDP8G-0007ME-VI for help-gnu-emacs@gnu.org; Fri, 11 Jan 2008 14:01:33 -0500 Original-Received: from mailanyone.net by smtp-gw30.mailanyone.net with esmtpsa (TLSv1:AES256-SHA:256) (MailAnyone extSMTP redsymbol) id 1JDP8C-0001rd-2p for help-gnu-emacs@gnu.org; Fri, 11 Jan 2008 13:01:32 -0600 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:50662 Archived-At: Here's the defun I refered to in my post a moment ago: ; Better handle similar buffer names (defun extend-buffer-name (arg) "Extend the current buffer's name according to to its full file path. With prefix arg, extend by N levels. Default is one level." (interactive "P") (let ((path (buffer-file-name)) (sep "/") (n (prefix-numeric-value arg))) (cond ((or (null path) (equal "" path)) path) (t (let ((parts (reverse (split-string path sep)))) (defun extend-once (sofar parts n) (cond ((or (< n 1) (null parts)) sofar) (t (extend-once (concatenate 'string (car parts) sep sofar) (cdr parts) (1- n))))) (rename-buffer (extend-once (car parts) (cdr parts) n))))))) -- Aaron Maxwell http://redsymbol.net Business Owners and Self-Employed: You're NOT Alone! The Business Butler - http://businessbutler.us