emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [yasnippet] can not creating links with description


From: Bianca Lutz
Subject: Re: [O] [yasnippet] can not creating links with description
Date: Tue, 9 Aug 2011 17:05:26 +0200

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 <address@hidden> 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
>
>
>



reply via email to

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