From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: Converting filenames Date: Wed, 30 Jun 2010 23:31:33 -0500 Message-ID: References: <722c8495-60f9-4a06-9c36-2226dc942390@5g2000yqz.googlegroups.com> <4C2C18CE.5020109@nihilo.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1291848043 28479 80.91.229.12 (8 Dec 2010 22:40:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 22:40:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 08 23:40:38 2010 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 1PQSge-0005dm-SA for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 23:40:37 +0100 Original-Received: from localhost ([127.0.0.1]:33873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQSgd-0003KL-W6 for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 17:40:36 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!news4.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.sysmatrix.net!news.sysmatrix.net.POSTED!not-for-mail Original-NNTP-Posting-Date: Wed, 30 Jun 2010 23:31:21 -0500 User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) Original-Newsgroups: gnu.emacs.help In-Reply-To: <4C2C18CE.5020109@nihilo.net> X-No-Archive: yes Original-Lines: 26 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 12.73.132.77 Original-X-Trace: sv3-Oa450x5GhOHU0lxmylzhl0Qin9nzKxsOu2A0XDkHSWKwqJa3nnlje8Q+XTewfFMnuH3O18EuudPT02a!XSKj4mR2aUg/xrfija3gTJd5OVQ5uFA19fuK9+DpIL3wQHO2TQl8HIu+5jG6AVAuSE/jK3uLKtaV!hP3NoEtczuZMO+Zzfo7UpaPkp6Qm+A== Original-X-Complaints-To: abuse@sysmatrix.net 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 Original-Xref: usenet.stanford.edu gnu.emacs.help:179392 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 X-Gmane-Expiry: 2010-12-22 Xref: news.gmane.org gmane.emacs.help:76146 Archived-At: B. T. Raven wrote: > Nordlöw wrote: >> Is there an opposite function of expand-file-name() that converts "/ >> home/per/" to "~/" if I am user per? >> >> Thanks in advance, >> Nordlöw > > I don't think that a general inverse function would be useful since "~/" > is probably not a symlink or hard link but just string somehow hard > coded to expand to the fully qualified home path. What would the > putative abbrev-file-name do with dir/subdir/pic.jpg? The only sensible > thing is just to return its argument. > > Something like this: > > (if (equal (getenv "home") "/home/per") (print "~/")) > > illustrates what should happen if the Emacs process belongs to per. > > Ed Oops, abbreviate-file-name actually exists but returns only "~". You could wrap it in something that concats the "/" Ed