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

2011-08-09 Thread Bianca Lutz
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






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

2011-08-09 Thread Bianca Lutz
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 bia...@googlemail.com 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/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.



Re: [O] [yasnippet] Symbol's function definition is void: yas/next-field-group

2011-08-09 Thread Bianca Lutz
Hi Karl,

On Tue, Aug 9, 2011 at 1:34 PM, Karl Voit devn...@karl-voit.at wrote:
 Whenever I try to expand a snippet containing $1, $2, ... I just get
 to $1 and then there I get «Symbol's function definition is void:
 yas/next-field-group» in the *Messages* buffer.

 Pressing «Tab» does not jump to $2 or $0.

 Does anybody have a clue, what is going on?

The org info seems to be outdated: yas/next-field-group is called
yas/next-field nowadays. A simple rename should solve the issue.

BTW: Are you sure you need both calls to add-hook? The way I
understand the org manual is that you need either of them (not both at
the same time).

Bianca.



Re: [O] Problems with search

2011-08-03 Thread Bianca Lutz
 No, it's not the autopair-post-command-handler that I wondered about[fn:1],
 it's that *t*, the first element of the list: how did it get there?

 Nick

 Footnotes:

 [fn:1] Well, I did wonder about it, but only because I never heard of
 it; but I am more suspicious of that t.


Concerning that suspicious t I found the following in the
documentation of add-hook:

(add-hook HOOK FUNCTION optional APPEND LOCAL)

[...]

The optional fourth argument, LOCAL, if non-nil, says to modify
the hook's buffer-local value rather than its default value.
This makes the hook buffer-local if needed, and it makes t a member
of the buffer-local value.  That acts as a flag to run the hook
functions in the default value as well as in the local value.

Best regards, Bianca.