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:05:26 +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]:44627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qqns3-0007Vc-JF for emacs-orgmode@gnu.org; Tue, 09 Aug 2011 11:05:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qqnrz-0005Gp-Ph for emacs-orgmode@gnu.org; Tue, 09 Aug 2011 11:05:31 -0400 Received: from mail-gw0-f41.google.com ([74.125.83.41]:57786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qqnrz-0005Gh-MN for emacs-orgmode@gnu.org; Tue, 09 Aug 2011 11:05:27 -0400 Received: by gwaa20 with SMTP id a20so70843gwa.0 for ; Tue, 09 Aug 2011 08:05:26 -0700 (PDT) In-Reply-To: <2011-08-08T22-31-55@devnull.Karl-Voit.at> 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 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 wrote: > Hi! > > I'd like to create a link like > > =A0[[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 =ABc=BB which does not > let me enter the string which replaces =AB$1=BB. > > I guess this is related to =ABhiding the actual link when a > description is set=BB. > > Can I define a snippet which behaves like following? After entering > the snippet command and pressing TAB, I get the chance to type =ABfoo=BB > part and after another TAB, the link as stated above is finished and > the cursor is at the end. > > Thanks! > > -- > Karl Voit > > >