help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: yasnippet to expand abbreviation in dired/fileopen command?


From: Drew Adams
Subject: RE: yasnippet to expand abbreviation in dired/fileopen command?
Date: Thu, 10 May 2012 09:04:02 -0700

> > I want to open a file on the remote machine. I've setup tramp to use
> > abbrev to expand an abbreviation to full path, e.g.:
> > xhs -> //ssh:xxx@xxxx#1222:/mnt/mp3/

As Andrea suggested, creating a bookmark is one (good) approach.

Here are two other approaches -

1. Option `directory-abbrev-alist'.
E.g., include an entry like this in the alist:
("\`xhs" . "//ssh:xxx@xxxx#1222:/mnt/mp3/")

Or in Customize:
 INS DEL From: \`xhs
           To: //ssh:xxx@xxxx#1222:/mnt/mp3/

Note that the doc for `directory-abbrev-alist' shows only examples where the
resulting directory names are shorter, but the reverse relation can be useful as
well: expand instead of contract - which is your case here.  The point is to
substitute one directory name for another that is more convenient in some way.
The symlink case is only one use case.

In vanilla Emacs, `C-x C-f xhs RET' will correctly expand the abbreviation if it
is in `directory-abbrev-alist'.  However, completion (`TAB') will not expand it.
If you use Icicles then completion will expand it, just like `RET' will.

See also: http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00666.html


2. Environment variables.  They are expanded even by vanilla Emacs during
completion (`TAB').  So you would define a variable `xhs' and then use `$xhs
TAB' in the minibuffer.


If you use Emacs on more than one machine, then using a bookmark or
`directory-abbrev-alist' is probably easier than using environment vars.  They
keep the customization within Emacs, not at the machine/OS level.

HTH - Drew




reply via email to

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