On Mon, 08 Nov 2010 20:12:21 +0100% Colomban Wendling email@example.com wrote:
Le 08/11/2010 10:55, Eugene Arshinov a écrit :
On Fri, 22 Oct 2010 13:38:42 +0100% Nick Treleaven firstname.lastname@example.org wrote:
On Fri, 22 Oct 2010 12:51:10 +0400 Eugene Arshinov email@example.com wrote:
The suggestion is to make use of snippets: if "table" or "<table>" snippet is specified in [HTML] section of snippets.conf, the snippet is automatically inserted, otherwise
<table> tag is just closed, like other tags now. This should also work for any other tag.
Though, you can just define a snippet (say, "table") and use it when you want to insert a table. I doubt it's worth implementing the suggestion if everything it gives is the ability to type "<table>" instead of typing "table" and pressing complete-snippet keybinding.
Perhaps the behaviour could be moved to the 'HTML chars' plugin, which could be renamed HTML or Markup.
Geany will have to notify the plugin about every char added. Won't it be too "heavy" to send a signal in this case?
Actually, this is already done for that plugin. See the editor-notify signal.
Extracting this into a plugin was a good idea. I decided to add a new one instead of extending HTML Chars because their functions are pretty different (though both related to XML and HTML). If I extended HTML Chars, I would need to add a checkbox to separately turn the completion-based-on-snippets on/off. In a separate plugin user achieve the same result by enabling/disabling the whole plugin, which is simpler and more obvious.
Am I right that the simple automatic tag closing is not part of the plugin but still in Geany itself?
If so, I think it's confusing, because these are really close concepts, and it can be viewed as some "default snippets".
This said, I like the idea of moving this to a plugin; having this kind of specific stuff on the core is convenient but not that clean IMO :)
Yes, maybe it is confusing. But, at least, it works :)
I called the new plugin "XML snippets". It's not pretty obvious, but I couldn't think of anything better and short enough. If you have an idea, feel free to rename it.
So, the patches to add the tiny plugin are attached:
- the first adds/exports some necessary functions;
editor_get_snippets_for_file_type() seems to lack a return statement.
Seems that I forgot to use my custom CFLAGS with warnings… Anyway, it is strange because I tested the plugin and it worked. Maybe I accidently removed the return statement later…
- the second adds the plugin itself;
I think that plugins/geanyfunctions.h changes should be in 1, not 2. Right? Also, I can't see the update of the po/POTFILES.in, is it missing?
I would personally mark the "gchar *completion" variable in the plugin's editor_notify_cb() as const since it must not me modified/freed/etc., but it's a perhaps personal taste.
Agree. Recently one "const gchar*" helped me to fix a possible bug with freeing.
- the third contains the changelog for the above two.
In the second patch I included some user documentation. Unfortunately, my rst2html is much more recent, so the most of geany.html got changed. Maybe it will be easier for you to ignore the changes in geany.html from the patch and regenerate it yourself from updated geany.txt. If my English is not good enough, please rewrite the documentation as you wish.
Also in the second patch there is a patch for ru.po to add Russian localisation for the plugin. I know there's a separate process for updating localisation, so it isn't my responsibility and you should probably ignore this change.
If you have any objections about the code or the functionality of the plugin, please write. I will update the code as needed.
See above :)
Thank you very much for reviewing. Updated patches are attached.
Regards, Colomban _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany