unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Abbreviated filenames for display
Date: Tue, 26 Apr 2005 14:01:27 -0600	[thread overview]
Message-ID: <d4m6cp$db9$1@sea.gmane.org> (raw)
In-Reply-To: <loom.20050426T194348-267@post.gmane.org>

Michael Mauger wrote:
> 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:myuser@unix1.abc.def.com:/home/myuser")
>    (putenv "D2" "/sshx:myuser@unix2.abc.def.com:/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
> 
>     /sshx:myuser@unix2.abc.def.com:/home/myuser/proj/xyz/src/x.sql
> 
> as the filename, I want:
> 
>     $D2/proj/xyz/src/x.sql
> 
> 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.

Does it make sense to put environment variables in directory-abbrev-alist?

(setq directory-abbrev-alist
       (list (cons (getenv "D0") "D0")
             (cons (getenv "D1") "D1")
             (cons (getenv "D2") "D2")))

-- 
Kevin Rodgers

  reply	other threads:[~2005-04-26 20:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-26 18:31 Abbreviated filenames for display Michael Mauger
2005-04-26 20:01 ` Kevin Rodgers [this message]
2005-04-26 20:44 ` Michael Mauger
2005-04-26 20:51 ` Michael Albinus
  -- strict thread matches above, loose matches on Subject: below --
2005-04-26 21:57 Michael Mauger
     [not found] <mailman.3088.1114541205.2895.help-gnu-emacs@gnu.org>
2005-04-26 20:04 ` kin
2005-04-26 22:12 ` Peter Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='d4m6cp$db9$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).