Hi all,
I'm looking for some API calls within the plugin API. I would like to write a plugin which reads emacs mode-lines. I have some sources where C++ headers uses the extension .h! In this cases I've added a
// -*- Mode: C++ -*-
to the header.
(1) Is it possible to change the document type?
(2) Can I get the some informations of the current line? It would be easier to know if a line is within a comment or not. Geany already knows this.
Thanks...
Hi,
Plugin API documentation is at
http://www.geany.org/manual/reference/
Cheers Lex
2009/8/27 Joerg Desch jd.vvd@web.de:
Hi all,
I'm looking for some API calls within the plugin API. I would like to write a plugin which reads emacs mode-lines. I have some sources where C++ headers uses the extension .h! In this cases I've added a
// -*- Mode: C++ -*-
to the header.
(1) Is it possible to change the document type?
(2) Can I get the some informations of the current line? It would be easier to know if a line is within a comment or not. Geany already knows this.
Thanks...
Email: Joerg Desch <jd DOT vvd AT web DOT de> _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Hi again,
I'm not an experienced plugin programmer but quick look at the API shows document _set_filetype which is what you want.
IIRC the markers are supposed to be in line 1, so just get line 1 with sci_get_line and then parse it yourself is probably simpler.
There has in the past been some discussion about parsing Emacs and VIM filetype markers to help with the C++ .h file problem but no one was concerned enough to write the code :-)
Of course I assume these are old .h files and you are using .hpp for all your new C++ headers which will not only get the filetype right in Geany but tell humans that they don't need to wrap this header in extern C { } constructs.
Cheers Lex
2009/8/27 Lex Trotman elextr@gmail.com:
Hi,
Plugin API documentation is at
http://www.geany.org/manual/reference/
Cheers Lex
2009/8/27 Joerg Desch jd.vvd@web.de:
Hi all,
I'm looking for some API calls within the plugin API. I would like to write a plugin which reads emacs mode-lines. I have some sources where C++ headers uses the extension .h! In this cases I've added a
// -*- Mode: C++ -*-
to the header.
(1) Is it possible to change the document type?
(2) Can I get the some informations of the current line? It would be easier to know if a line is within a comment or not. Geany already knows this.
Thanks...
Email: Joerg Desch <jd DOT vvd AT web DOT de> _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
On Thu, 27 Aug 2009 20:51:48 +1000 Lex Trotman elextr@gmail.com wrote:
Hi.
In Germany we would say "I had tomatoes on my eyes".
I'm not an experienced plugin programmer but quick look at the API shows document _set_filetype which is what you want.
Thanx. I don't know why but I've tried only the links on the main page. Sorry for the traffic...
There has in the past been some discussion about parsing Emacs and VIM filetype markers to help with the C++ .h file problem but no one was concerned enough to write the code :-)
Yes I can remember.
Of course I assume these are old .h files and you are using .hpp for all your new C++ headers which will not only get the filetype right in Geany but tell humans that they don't need to wrap this header in extern C { } constructs.
You are right, but these file are not mine. I'm using www.fltk.org, where all C++ headers use .H !
2009/8/27 Joerg Desch jd.vvd@web.de:
On Thu, 27 Aug 2009 20:51:48 +1000 Lex Trotman elextr@gmail.com wrote:
Hi.
In Germany we would say "I had tomatoes on my eyes".
I'm not an experienced plugin programmer but quick look at the API shows document _set_filetype which is what you want.
Thanx. I don't know why but I've tried only the links on the main page. Sorry for the traffic...
There has in the past been some discussion about parsing Emacs and VIM filetype markers to help with the C++ .h file problem but no one was concerned enough to write the code :-)
Yes I can remember.
Of course I assume these are old .h files and you are using .hpp for all your new C++ headers which will not only get the filetype right in Geany but tell humans that they don't need to wrap this header in extern C { } constructs.
You are right, but these file are not mine. I'm using www.fltk.org, where all C++ headers use .H !
If they are actually a capital H maybe you could try adding that to the C++ line in filetype_extensions.conf. Doubt it would work on windows but should on Linux.
Cheers Lex
-- Email: Joerg Desch <jd DOT vvd AT web DOT de> _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
On Thu, 27 Aug 2009 21:29:43 +1000 Lex Trotman elextr@gmail.com wrote:
If they are actually a capital H maybe you could try adding that to the C++ line in filetype_extensions.conf. Doubt it would work on windows but should on Linux.
Yes, that works. I've just added it to the default C++ extensions.
Regards, Nick
On Thu, 27 Aug 2009 13:14:44 +0200 Joerg Desch jd.vvd@web.de wrote:
In Germany we would say "I had tomatoes on my eyes".
Hehe ;-)
I'm not an experienced plugin programmer but quick look at the API shows document _set_filetype which is what you want.
Thanx. I don't know why but I've tried only the links on the main page. Sorry for the traffic...
No problem, I just added a note about seeing the Files link at the top to the main page (web should get auto-updated by tomorrow).
Regards, Nick
On Thu, 27 Aug 2009 13:14:44 +0200, Joerg wrote:
Hey,
In Germany we would say "I had tomatoes on my eyes".
Haha and it reads a bit strange in English, at least in German it sounds better, I think :).
(2) Can I get the some informations of the current line? It would be easier to know if a line is within a comment or not. Geany already knows this.
Yo.
Use sci_get_style_at() to get the style at a certain position in the document like on the first or second column of the line you want to examine. The returned style is an integer referring to the one of the styles defined in scintila/include/SciLexer.h (SCE_XXX_YYYY with XXX being the lexer name) and is related to the used Scintilla lexer (which is chosen by the used filetype in Geany).
In src/editor.c we have a helper function to check whether a certain style value is a comment style for a certain lexer: is_comment_style(). Currently, this is a stati helper function, so you can't use it from a plugin but we could add it to the public API if it helps. For the meantime and testing, you might want to copy the code for now.
HTH, Enrico
Hi Enrico,
On Sat, 29 Aug 2009 12:05:35 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
In Germany we would say "I had tomatoes on my eyes".
Haha and it reads a bit strange in English, at least in German it sounds better, I think :).
Yes, that's true.
Use sci_get_style_at() to get the style at a certain position in the document like on the first or second column of the line you want to examine.
In src/editor.c we have a helper function to check whether a certain style value is a comment style for a certain lexer: is_comment_style().
Thanks for the tips. I'll try this (hopefully) next week.
OMG, too many ideas and no spare time to try.....
Bye
On Sat, 29 Aug 2009 12:05:35 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
On Thu, 27 Aug 2009 13:14:44 +0200, Joerg wrote:
Hey,
In Germany we would say "I had tomatoes on my eyes".
Haha and it reads a bit strange in English, at least in German it sounds better, I think :).
(2) Can I get the some informations of the current line? It would be easier to know if a line is within a comment or not. Geany already knows this.
Yo.
Use sci_get_style_at() to get the style at a certain position in the document like on the first or second column of the line you want to examine. The returned style is an integer referring to the one of the styles defined in scintila/include/SciLexer.h (SCE_XXX_YYYY with XXX being the lexer name) and is related to the used Scintilla lexer (which is chosen by the used filetype in Geany).
In src/editor.c we have a helper function to check whether a certain style value is a comment style for a certain lexer: is_comment_style (). Currently, this is a stati helper function, so you can't use it from a plugin but we could add it to the public API if it helps. For the meantime and testing, you might want to copy the code for now.
I think this would be very helpful for all of the plugin programmes. At least I could make some usage of it ;)
Thanks, Frank