From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: how having the basename of a file or directory Date: Mon, 31 Jan 2011 17:30:30 +0900 Message-ID: <877hdl4grd.fsf@uwakimon.sk.tsukuba.ac.jp> References: <8739o9ilfs.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1296463389 13349 80.91.229.12 (31 Jan 2011 08:43:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 31 Jan 2011 08:43:09 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thierry Volpiatto Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 31 09:43:05 2011 Return-path: Envelope-to: ged-emacs-devel@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 1PjpLU-0007gH-4z for ged-emacs-devel@m.gmane.org; Mon, 31 Jan 2011 09:43:04 +0100 Original-Received: from localhost ([127.0.0.1]:42971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjpHy-0006pu-ME for ged-emacs-devel@m.gmane.org; Mon, 31 Jan 2011 03:39:10 -0500 Original-Received: from [140.186.70.92] (port=53745 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjpHs-0006pZ-U4 for emacs-devel@gnu.org; Mon, 31 Jan 2011 03:39:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PjpHk-0001Ms-L8 for emacs-devel@gnu.org; Mon, 31 Jan 2011 03:38:57 -0500 Original-Received: from mgmt2.sk.tsukuba.ac.jp ([130.158.97.224]:43274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PjpHk-0001L6-DV for emacs-devel@gnu.org; Mon, 31 Jan 2011 03:38:56 -0500 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt2.sk.tsukuba.ac.jp (Postfix) with ESMTP id 5A83D5110001; Mon, 31 Jan 2011 17:38:47 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 3CD941A3007; Mon, 31 Jan 2011 17:30:30 +0900 (JST) In-Reply-To: <8739o9ilfs.fsf@gmail.com> X-Mailer: VM undefined under 21.5 (beta29) "garbanzo" ed3b274cc037 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 130.158.97.224 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135279 Archived-At: Thierry Volpiatto writes: > (defun basename (fname) > (if (file-directory-p fname) > (let ((dirname (directory-file-name fname))) > (file-relative-name > dirname (file-name-directory dirname))) > (file-name-nondirectory fname))) (file-name-nondirectory (directory-file-name PATH)) should work (modulo I'm testing in XEmacs, but I can't imagine that we differ in this respect).