[Geany] The plugin - Re: Use snippets for HTML autocompletion?

Eugene Arshinov earshinov at xxxxx
Mon Nov 8 09:55:23 UTC 2010


On Fri, 22 Oct 2010 13:38:42 +0100%
Nick Treleaven <nick.treleaven at btinternet.com> wrote:

> On Fri, 22 Oct 2010 12:51:10 +0400
> Eugene Arshinov <earshinov at gmail.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.

Hi.

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.

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;
- the second adds the plugin itself;
- 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.

Best regards,
Eugene.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.functions.r5380.patch
Type: text/x-patch
Size: 26334 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20101108/699f4737/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.plugin.r5380.patch
Type: text/x-patch
Size: 267119 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20101108/699f4737/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3.changelog.r5380.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20101108/699f4737/attachment-0002.bin>


More information about the Users mailing list