From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bianca Lutz Subject: Re: [yasnippet] can not creating links with description Date: Tue, 9 Aug 2011 17:40:40 +0200 Message-ID: References: <2011-08-08T22-31-55@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqoQ7-0003lb-Ry for emacs-orgmode@gnu.org; Tue, 09 Aug 2011 11:40:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqoQ6-0005gY-Sx for emacs-orgmode@gnu.org; Tue, 09 Aug 2011 11:40:43 -0400 Received: from mail-iy0-f175.google.com ([209.85.210.175]:53116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqoQ6-0005gT-KR for emacs-orgmode@gnu.org; Tue, 09 Aug 2011 11:40:42 -0400 Received: by iyn15 with SMTP id 15so135547iyn.6 for ; Tue, 09 Aug 2011 08:40:41 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: news1142@karl-voit.at Cc: emacs-orgmode@gnu.org I just realized that the test for field being non-nil is superfluous in the example below -- the usual copy and paste mess got me. Thus, you may omit it, i.e. use (concat "companie: " (buffer-substring ...)) instead of (concat "companie: " (and field (buffer-substring ...))) Bianca. On Tue, Aug 9, 2011 at 5:05 PM, Bianca Lutz wrote: > 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/modifi= ed-p > | =A0(let ((field (nth 0 (yas/snippet-fields (first (yas/snippets-at-poin= t)))))) > | =A0 =A0(concat "companie: " > | =A0 =A0 =A0 =A0 =A0 =A0(and field (buffer-substring > | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (yas/field-start fi= eld) > | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (yas/field-end fiel= d))))))]] $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.