< Back to IRCAM Forum

Function autocompletion for external ibraries

Hi All,

I have noticed that in some libraries like OMTristan and OMChroma it is possible to do double-clic, starting to write the nome of a function and to have suggestion for it, exactly like in OM functions.

I would like to add this feature to my library, but I can not undersand how. To try to be clear: when I load into OM my library, FDSDB_XXth_CT, for shortcutting the retrograde function I must write, for example, “fdsdb_xxth_ct::retrograde”, I would like to write only “retrograde”.

I suppose I must add some code in my FDSDB_XXth_CT.lisp file, but I don’t know how to do it.

If ueful the link to download my library is the following:

Many thanks in advance, ciao

Fabio

Dear Fabio,

I will see what i can do. The problem here is you have your own package. So in order to invoke a function/method you should type it preceding it by the name of your package which is a really long string! And nicknames will not work in the completion unless i find a way to import them.

Will let you know ASAP

Best
K

Dear Karim,

Thank you very much for reply. But please, if it should be a little complicated don’t waste your time: I don’t know in Paris, but here August is too hot… I am not in a hurry :slight_smile:
Thank you again, ciao

Fabio

Just for updating: I am using deepseek for code help, and, observing also the code of other libraries, I have added a nickname to my library:

(defpackage FDSDB_XXth_CT (:use “COMMON-LISP” “OpenMusic” “CL-USER”) (:nicknames :xx))

So now I can write xx:: instead of fdsdb_xxth_ct:: …

That was no difficult, but according to deepseek tab completion for an external package could be not possible in OpenMusic, if not importing manually the name of all functions.

If I realize some other thing I will update. This is my summer play for keeping alive my brain…

Fabio

1 Like

Dear Fabio,

Yes. No need of deepseek or whatever AI :slight_smile:
I know that you can use nicknames in packages. But here the problem is that the LW/OM system queries the method name from its original package name in the completion display. Of course you can type the nickname instead but unfortunately the completion process doesn’t take into account the nickname. I was looking into that, and i am afraid, unless we change totally the LW/OM system of packaging, this is not possible.

There is a possible solution (very lousy one) that is to change your package’s name, but the drawback here is compatibility with all the patches you’ve done. So forget about this.
Will see if i can find a bypassing solution, but this looks to me somehow very tricky…

Best
K

Dear Karim,

Thank you for your explanation, indeed AI is everythnimg but Intelligence…

Anyway, the possibility to use the nickname is a step forward, even without tab completion. About my next library, I will remeber to use a shorter name…

Have a good time, ciao

Fabio

Dear Fabio.

Wait a minute…
I am finding a solution that will work. give me some little time and will send you the library…
:slight_smile:
K

Dear Fabio,

Can you test this version of the library:

I took the liberty to choose for you a nickname but you can still change it:
fds::

Tell me if completion now work for you…
Maybe found a good solution for other libraries and nickname thanx to your suggestion…

Best
K

Dear Karim,

Your solution is simple and elegant, for what I can understand. I have tested it on Fedora 32 and OsX High Sierra, 10.13.6, and it runs perfectly. It fastens the work very much, thank you a lot. I have only changed the nickname in “XX”, just for pressing fasterly the computer keys :slight_smile: and not to be so autoreferential :slight_smile:

Thank you again, All my Best, ciao

Fabio

Great to hear that.

Just make sure there is not another package in another library with the same nickname! But i doubt it :slight_smile:

Good composing and hope the weather will be kind with you.

Best
K