[TxMt] Informative text for snippets

Édouard Gilbert edouard.gilbert at eleves.bretagne.ens-cachan.fr
Wed Aug 8 00:32:14 UTC 2007


Le 8 août 07 à 01:48, Charilaos Skiadas a écrit :

>> I was thinking about overriding the '(' key between the  
>> parenthesis in the right scope, i.e. between the parentheses  
>> around the parameters, but not in the parameters themselves, an  
>> replace it by a simple '($0)' snippet. Does it seems a feasible  
>> solution?
>
> I think that trying to override '(' in the right scope will not be  
> easy to do. I think your problem really arises from the fact that  
> you want the word "parameters" to be there. Why not simply use $2  
> instead of ${2:parameters}, like you have $3 with no default value?  
> It seems that would solve your problems, at the small cost of  
> having to remember what you are supposed to place at the second tab  
> stop. I think that any other solution would be too cumbersome  
> compared to this simple change.

Well, of course, it would be easy in that case. But even for a quite  
simple macro, that I use from time to time, which computes

{ f(x, y) | x \in A, y \in B when test(x,y) } — eventually with more  
variables, of course

and whose structure is

(make-comprehension (f x y) ((x A) (y B)) ((test x y)))

which would give a snippet such as

(make-comprehension $1 ($2) ($3))

I always spend some time searching through my code to spot an example  
to get the order right, forget one or two brackets and loose some  
time before spotting the misused structure until I get it right. In  
practice, I don't even use a snippet, copy-paste is more efficient. I  
could probably if it was written as, let's say

(make-comprehension ${1:expression} (${2:list of variables' spans}) ($ 
{3:list of tests}))

In the end, it's not a major problem, but it's quite annoying. And  
Lisp already make me loose my temper easily.

Édouard


More information about the textmate mailing list