help-gnu-emacs
[Top][All Lists]
Advanced

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

Snippets with imports


From: andrea crotti
Subject: Snippets with imports
Date: Mon, 30 Nov 2009 17:42:08 +0100
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

I'm using a lot yasnippet and defining many snippets.
Now I was wondering what to do if some snippets needs function calls which are actually not in the base language, but need to be imported.

Firt option is just don't care about, I can add manually the import.

The second option is to check and add if needed and (for example in python) I see three alternatives:
1. I already have import X, where X is the module contaning my function Y
2. I already have from X import Z (Y != Z)
3. I already have from X import Y|* (not very likely)
4. I don't have anything

In case number 1 I probably want to use the
X.Y function call

In case 2 also have to add ", Y" after Z
In case 3 I'm fine already and in case 4 I can choose between importing the whole library or just one function.
In this case I think maybe I should prompt the user for what is best to do.


I'm I missing something?
Said that the actual snippet implementation is a bit harder, any advice on similar snippets which I can look for?





reply via email to

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