[Geany-Users] Defining Functions for Geany “Filetype”

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Geany-Users] Defining Functions for Geany “Filetype”

Gil Hornung

Hi,

I am using Geany as my text editor. I have started working on snakemake, which, from a syntax point-of-view, is Python with a few modifications. Python functions are defined by:

def bla:

    bunch_of_code

 

snakemake adds the definition of "rules" in a similar way:

rule bla:

    bunch_of_code

 

Geany presents in the side bar all the Python functions, but I also want it to present all the rules. However, I was not able to find how to define the keywords for a function in the file geany/filetypes.python (I want to add the keyword rule).

 

Does anyone have any idea?

 

Dr. Gil Hornung

Bioinformatics Analyst

The Nancy and Stephen Grand Israel National Center for Personalized Medicine

Weizmann Institute of Science


_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Defining Functions for Geany “Filetype”

Matthew Brush-2
On 2017-01-04 06:07 AM, Gil Hornung wrote:

> Hi, I am using Geany as my text editor. I have started working on
> snakemake, which, from a syntax point-of-view, is Python with a few
> modifications. Python functions are defined by: def bla:
> bunch_of_code
>
> snakemake adds the definition of "rules" in a similar way: rule bla:
> bunch_of_code
>
> Geany presents in the side bar all the Python functions, but I also
> want it to present all the rules. However, I was not able to find how
> to define the keywords for a function in the file
> geany/filetypes.python (I want to add the keyword rule).
>
> Does anyone have any idea?
>

It's baked into the ctags parser[0]. Adding a new keyword like this
would require modifying the existing (or adding a new) parser.

Regards,
Matthew Brush

[0]: https://github.com/geany/geany/blob/1.29.0/ctags/parsers/python.c

_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Defining Functions for Geany “Filetype”

Gil Hornung
Thank you Matthew,

So I need to copy python.c into some other file (e.g. snakemake.c) and make changes to it?

What should I do after that? How do I compile it and where so I store it such that Geany will use it?

Thank you,

Gil

-----Original Message-----
From: Users [mailto:[hidden email]] On Behalf Of Matthew Brush
Sent: 04 January 2017 17:15
To: [hidden email]
Subject: Re: [Geany-Users] Defining Functions for Geany “Filetype”

On 2017-01-04 06:07 AM, Gil Hornung wrote:

> Hi, I am using Geany as my text editor. I have started working on
> snakemake, which, from a syntax point-of-view, is Python with a few
> modifications. Python functions are defined by: def bla:
> bunch_of_code
>
> snakemake adds the definition of "rules" in a similar way: rule bla:
> bunch_of_code
>
> Geany presents in the side bar all the Python functions, but I also
> want it to present all the rules. However, I was not able to find how
> to define the keywords for a function in the file
> geany/filetypes.python (I want to add the keyword rule).
>
> Does anyone have any idea?
>

It's baked into the ctags parser[0]. Adding a new keyword like this would require modifying the existing (or adding a new) parser.

Regards,
Matthew Brush

[0]: https://github.com/geany/geany/blob/1.29.0/ctags/parsers/python.c

_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Defining Functions for Geany “Filetype”

Lex Trotman
On 5 January 2017 at 20:19, Gil Hornung <[hidden email]> wrote:
> Thank you Matthew,
>
> So I need to copy python.c into some other file (e.g. snakemake.c) and make changes to it?
>
> What should I do after that? How do I compile it and where so I store it such that Geany will use it?

The tag parsers are compiled into Geany, so you need to be able to
build Geany from source.  The HACKING file documents adding tag
parsers.

>
> Thank you,
>
> Gil
>
> -----Original Message-----
> From: Users [mailto:[hidden email]] On Behalf Of Matthew Brush
> Sent: 04 January 2017 17:15
> To: [hidden email]
> Subject: Re: [Geany-Users] Defining Functions for Geany “Filetype”
>
> On 2017-01-04 06:07 AM, Gil Hornung wrote:
>> Hi, I am using Geany as my text editor. I have started working on
>> snakemake, which, from a syntax point-of-view, is Python with a few
>> modifications. Python functions are defined by: def bla:
>> bunch_of_code
>>
>> snakemake adds the definition of "rules" in a similar way: rule bla:
>> bunch_of_code
>>
>> Geany presents in the side bar all the Python functions, but I also
>> want it to present all the rules. However, I was not able to find how
>> to define the keywords for a function in the file
>> geany/filetypes.python (I want to add the keyword rule).
>>
>> Does anyone have any idea?
>>
>
> It's baked into the ctags parser[0]. Adding a new keyword like this would require modifying the existing (or adding a new) parser.
>
> Regards,
> Matthew Brush
>
> [0]: https://github.com/geany/geany/blob/1.29.0/ctags/parsers/python.c
>
> _______________________________________________
> Users mailing list
> [hidden email]
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
> _______________________________________________
> Users mailing list
> [hidden email]
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Defining Functions for Geany “Filetype”

Matthew Brush-2
In reply to this post by Gil Hornung
On 2017-01-05 02:19 AM, Gil Hornung wrote:
> Thank you Matthew,
>
> So I need to copy python.c into some other file (e.g. snakemake.c) and make changes to it?
>
> What should I do after that? How do I compile it and where so I store it such that Geany will use it?
>

It would be a lot easier just to tweak python.c to add your keywords and
then make a patch you can apply locally before building Geany from
source. Adding a whole new parser and filetype is significantly more
work compared to modifying the existing one and creating a "custom
filetype" (see user manual).

Regards,
Matthew Brush

>
> -----Original Message-----
> From: Users [mailto:[hidden email]] On Behalf Of Matthew Brush
> Sent: 04 January 2017 17:15
> To: [hidden email]
> Subject: Re: [Geany-Users] Defining Functions for Geany “Filetype”
>
> On 2017-01-04 06:07 AM, Gil Hornung wrote:
>> Hi, I am using Geany as my text editor. I have started working on
>> snakemake, which, from a syntax point-of-view, is Python with a few
>> modifications. Python functions are defined by: def bla:
>> bunch_of_code
>>
>> snakemake adds the definition of "rules" in a similar way: rule bla:
>> bunch_of_code
>>
>> Geany presents in the side bar all the Python functions, but I also
>> want it to present all the rules. However, I was not able to find how
>> to define the keywords for a function in the file
>> geany/filetypes.python (I want to add the keyword rule).
>>
>> Does anyone have any idea?
>>
>
> It's baked into the ctags parser[0]. Adding a new keyword like this would require modifying the existing (or adding a new) parser.
>
> Regards,
> Matthew Brush
>
> [0]: https://github.com/geany/geany/blob/1.29.0/ctags/parsers/python.c
>
> _______________________________________________
> Users mailing list
> [hidden email]
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
> _______________________________________________
> Users mailing list
> [hidden email]
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
>

_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Loading...