Hi Karl, I do not know how to accomplish this with a single field but the following workaround might be sufficient:
,----[ ~/snippets/org-mode/vkcomp ] | # name : expand link to company | # -- | [[file:~/share/all/org-mode/contacts.org::*$1][${2:$$(unless yas/modified-p | (let ((field (nth 0 (yas/snippet-fields (first (yas/snippets-at-point)))))) | (concat "companie: " | (and field (buffer-substring | (yas/field-start field) | (yas/field-end field))))))]] $0 `---- As long as the first field is active the second one is empty, thus, no troublesome link hiding will occur. As I said, this isn't exactly what you were asking for, since you have to press TAB a second time to actually exit the snippet. Best regards, Bianca. On Mon, Aug 8, 2011 at 10:46 PM, Karl Voit <devn...@karl-voit.at> wrote: > Hi! > > I'd like to create a link like > > [[file:~/share/all/org-mode/contacts.org::*foo][company:foo]] > > ... and therefore I created: > > ,----[ ~/snippets/org-mode/vkcomp ] > | # name : expand link to company > | # -- > | [[file:~/share/all/org-mode/contacts.org::*$1][company:$1]] $0 > `---- > > But: unfortunately my Org-mode behaves strangely when applying the > snippet: "company:" with blinking cursor in the «c» which does not > let me enter the string which replaces «$1». > > I guess this is related to «hiding the actual link when a > description is set». > > Can I define a snippet which behaves like following? After entering > the snippet command and pressing TAB, I get the chance to type «foo» > part and after another TAB, the link as stated above is finished and > the cursor is at the end. > > Thanks! > > -- > Karl Voit > > >