[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Abbreviated filenames for display

From: Michael Mauger
Subject: Abbreviated filenames for display
Date: Tue, 26 Apr 2005 18:31:24 +0000 (UTC)
User-agent: Loom/3.14 (

This is not a critical need but it has been bugging me for a while.

I have three locations of files that I use regularly.  One is local on my w32 
machine, the other two are on Unix machines.  I use Tramp and everything works 
beatifully.  I have something like the following in my .emacs:

   (putenv "D0" "~/My Documents/Projects/xyz")
   (putenv "D1" "/sshx:address@hidden:/home/myuser")
   (putenv "D2" "/sshx:address@hidden:/home/myuser")

This allows me to specify remote files easily at the C-x C-f prompt, with a 
string like:

    Find File: $D2/proj/xyz/src/x.sql

The "$D2" gets expanded and my fingers don't fall off for excess wear.

What I'd like to be able to do, especially in the recentf menu or buffer lists, 
is to replace the long Tramp prefix with a shorter string that allows me to see 
what machine the file is from quicker.  Ideally, I'd like to be able to replace 
the leading portion of the file path with environment variable names I use when 
entering the file name.

For example, rather than showing me


as the filename, I want:


Part of my problem is that the Unix host names are long and very similar and 
they hold two different but similarly structured directory trees (think, test 
and production files).  I've made the mistake of opening the file on the wrong 
host more than once because I didn't notice the host name difference in my 
haste.  (I'm a little ADHD as well, so I do it more often than I like to admit.)

I've played around with file name handlers, but quickly got lost.

Any ideas?  

-- Michael

PS. I'm on an up-to-date CVS HEAD build.  I'm elisp capable, so don't be shy.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]