* yasnippet to expand abbreviation in dired/fileopen command?
@ 2012-05-10 8:44 David Belohrad
2012-05-10 14:10 ` Andrea Crotti
2012-05-10 14:29 ` XeCycle
0 siblings, 2 replies; 6+ messages in thread
From: David Belohrad @ 2012-05-10 8:44 UTC (permalink / raw)
To: help-gnu-emacs
Hi there,
any help would be appreciated:
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 I'm using already yasnippet for something else, using abbrev for this
seems to be just a duplication of what yasnippet does in more generic
way.
However, as yasnippet is using set of directories to identify major mode
and select appropriate snippet 'set', I'm not sure into what directory I
should put my snippets so they get expanded only when I have to specify
directory or file....
any comments?
thanks
d.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: yasnippet to expand abbreviation in dired/fileopen command?
2012-05-10 8:44 yasnippet to expand abbreviation in dired/fileopen command? David Belohrad
@ 2012-05-10 14:10 ` Andrea Crotti
2012-05-10 14:29 ` XeCycle
1 sibling, 0 replies; 6+ messages in thread
From: Andrea Crotti @ 2012-05-10 14:10 UTC (permalink / raw)
To: David Belohrad; +Cc: help-gnu-emacs
David Belohrad <david@belohrad.ch> writes:
> Hi there,
> any help would be appreciated:
>
> 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 I'm using already yasnippet for something else, using abbrev for this
> seems to be just a duplication of what yasnippet does in more generic
> way.
>
> However, as yasnippet is using set of directories to identify major mode
> and select appropriate snippet 'set', I'm not sure into what directory I
> should put my snippets so they get expanded only when I have to specify
> directory or file....
>
>
> any comments?
>
> thanks
> d.
>
I've never thought about this, but in general I think
1. this duplication is not the end of the world
2. bookmark (or bookmark+) are a better way to solve this problem.
What I do is normally just connect to a machine, open dired or the
desired file and C-x r m to store the bookmark..
--
GNU Emacs 24.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.1)
of 2012-04-29 on dell
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: yasnippet to expand abbreviation in dired/fileopen command?
2012-05-10 8:44 yasnippet to expand abbreviation in dired/fileopen command? David Belohrad
2012-05-10 14:10 ` Andrea Crotti
@ 2012-05-10 14:29 ` XeCycle
2012-05-10 16:04 ` Drew Adams
1 sibling, 1 reply; 6+ messages in thread
From: XeCycle @ 2012-05-10 14:29 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
David Belohrad <david@belohrad.ch> writes:
> Hi there,
> any help would be appreciated:
>
> 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 I'm using already yasnippet for something else, using abbrev for this
> seems to be just a duplication of what yasnippet does in more generic
> way.
>
> However, as yasnippet is using set of directories to identify major mode
> and select appropriate snippet 'set', I'm not sure into what directory I
> should put my snippets so they get expanded only when I have to specify
> directory or file....
>
>
> any comments?
That looks like expansion in minibuffer. Afraid yasnippet
doesn't handle it by now.
--
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: yasnippet to expand abbreviation in dired/fileopen command?
2012-05-10 14:29 ` XeCycle
@ 2012-05-10 16:04 ` Drew Adams
2012-05-11 9:31 ` David Belohrad
0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2012-05-10 16:04 UTC (permalink / raw)
To: 'XeCycle', help-gnu-emacs
> > 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: yasnippet to expand abbreviation in dired/fileopen command?
2012-05-10 16:04 ` Drew Adams
@ 2012-05-11 9:31 ` David Belohrad
0 siblings, 0 replies; 6+ messages in thread
From: David Belohrad @ 2012-05-11 9:31 UTC (permalink / raw)
To: Drew Adams, 'XeCycle', help-gnu-emacs
Dear All,
thanks for fruitful responses. I think I like this one below, because it
is very similar to what I use with tramp.
thanks
d.
Drew Adams <drew.adams@oracle.com> writes:
>> > 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
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.889.1336639663.855.help-gnu-emacs@gnu.org>]
* Re: yasnippet to expand abbreviation in dired/fileopen command?
[not found] <mailman.889.1336639663.855.help-gnu-emacs@gnu.org>
@ 2012-05-10 11:31 ` Xah Lee
0 siblings, 0 replies; 6+ messages in thread
From: Xah Lee @ 2012-05-10 11:31 UTC (permalink / raw)
To: help-gnu-emacs
On May 10, 1:44 am, David Belohrad <da...@belohrad.ch> wrote:
> Hi there,
> any help would be appreciated:
>
> 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 I'm using already yasnippet for something else, using abbrev for this
> seems to be just a duplication of what yasnippet does in more generic
> way.
>
> However, as yasnippet is using set of directories to identify major mode
> and select appropriate snippet 'set', I'm not sure into what directory I
> should put my snippets so they get expanded only when I have to specify
> directory or file....
>
> any comments?
>
> thanks
> d.
it looks like your expansion is static, so you don't really need
yasnippet for that. emacs abbrev feature will do.
here's examples of how
〈Using Emacs's Abbrev Mode for Abbreviation〉
http://xahlee.org/emacs/emacs_abbrev_mode.html
as to your specific question about yasnippet, i don't know the answer
but someone probably will answer.
Xah
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-11 9:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-10 8:44 yasnippet to expand abbreviation in dired/fileopen command? David Belohrad
2012-05-10 14:10 ` Andrea Crotti
2012-05-10 14:29 ` XeCycle
2012-05-10 16:04 ` Drew Adams
2012-05-11 9:31 ` David Belohrad
[not found] <mailman.889.1336639663.855.help-gnu-emacs@gnu.org>
2012-05-10 11:31 ` Xah Lee
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.