Help autocomplete

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Help autocomplete

Bruno Carlos Lugão

Based on the code of the following function
File code myfunction.m
Function y = myfunction (x)
y = x. ^ 2;
Endfunction

Assuming that the path where this function is already saved in octaverc, is it possible for the name myfunction to appear in autofill?


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Help autocomplete

Mike Miller-4
On Wed, May 10, 2017 at 21:15:18 +0000, Bruno Carlos Lugão wrote:
> Based on the code of the following function
> File code myfunction.m
> Function y = myfunction (x)
> y = x. ^ 2;
> Endfunction
>
> Assuming that the path where this function is already saved in
> octaverc, is it possible for the name myfunction to appear in
> autofill?

I assume you mean the autocomplete feature of the code editor? If so,
then yes, it is possible, but it doesn't work very reliably from what I
can tell.

The set of all known functions is cached in the file
~/.config/octave/VERSION/qsci/octave_kbf.pap. If you create a new
function file, it won't get added to the cache automatically. But if you
delete the cache, close the tab in the editor, and open it again, the
cache is recreated and should include your new function.

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Help autocomplete

Mike Miller-4
Hi Bruno, please do not reply directly to me, reply to the mailing list.

On Thu, May 11, 2017 at 13:09:47 +0000, Bruno Carlos Lugão wrote:
> Hi,  i am using windows 8, and i dont find the directory
> ~/.config/octave/VERSION/qsci/octave_kbf.pap. In windows what the
> path? I try search the file octave_kbf.pap, but i didint find.

The name ~ is a stand in for your user profile directory on Windows,
usually C:\Users\YourName. If you run tilde_expand('~') in Octave, it
will tell you what directory that is.

Since you are using 4.2.1, the file in question should be

  C:\Users\YourName\.config\octave\4.2.1\qsci\octave_kbf.pap

> You are rigth i am trying to complete the function name in the editor
> of octave.

As I said, this is only a workaround that seems to work for me. I don't
think what you want is fully supported. Is it something that is
important to you?

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Help autocomplete

Torsten-3
On 11.05.2017 18:29, Mike Miller wrote:

> Hi Bruno, please do not reply directly to me, reply to the mailing list.
>
> On Thu, May 11, 2017 at 13:09:47 +0000, Bruno Carlos Lugão wrote:
>> Hi,  i am using windows 8, and i dont find the directory
>> ~/.config/octave/VERSION/qsci/octave_kbf.pap. In windows what the
>> path? I try search the file octave_kbf.pap, but i didint find.
>
> The name ~ is a stand in for your user profile directory on Windows,
> usually C:\Users\YourName. If you run tilde_expand('~') in Octave, it
> will tell you what directory that is.
>
> Since you are using 4.2.1, the file in question should be
>
>   C:\Users\YourName\.config\octave\4.2.1\qsci\octave_kbf.pap
>
>> You are rigth i am trying to complete the function name in the editor
>> of octave.
>
> As I said, this is only a workaround that seems to work for me. I don't
> think what you want is fully supported. Is it something that is
> important to you?
>

While playing around with the autocompletion cache for answering this
request, I found out that octave crashes at startup when the file
octave_kbf.pap is not present and the last editor session is restored.
This is caused by the changed worker/gui timing at startup. I will push
a changeset this evening.

Moreover, I will change the preparation of octave_kbf.pap such that it
will be updated each time an m-file is opened. By now it is only updated
when package directories have changed.

Torsten

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Help autocomplete

Torsten-3
In reply to this post by Bruno Carlos Lugão
On 10.05.2017 23:15, Bruno Carlos Lugão wrote:
> Based on the code of the following function File code myfunction.m
> Function y = myfunction (x) y = x. ^ 2; Endfunction Assuming that the
> path where this function is already saved in octaverc, is it possible
> for the name myfunction to appear in autofill?
>

The data used for autocompletion is now updated (almost) each time you
open an octave file and therefore contains more actual information on
own functions. Please make sure you have checked the preference that
functions will also be considered for autocompletion.

Torsten

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave