Introducing gspell, a new spell checking library

As part of the LaTeXila project and its fundraiser, I’m working on a new spell checking library called gspell.

Some background

At first I wanted to contribute to GtkSpell so that GtkSpell and GtkSourceView work well together, without a dependency on each other. GtkSourceView defines a no-spell-check region. For LaTeX, the region includes the LaTeX command’s names, for example. But GtkSpell didn’t read that region, and the region was available only through the GtkSourceView API. Adding a dependency on GtkSourceView in GtkSpell was not desirable, because many applications use GtkSpell only. Also, a library like GtkSpell could potentially add the support for GtkEntry too, so if there is a dependency on GtkSourceView, it isn’t nice for an application that wants only the spell checking for a GtkEntry. The solution was actually really simple: the no-spell-check region is a GtkTextTag. After setting a name to the tag and expose it in the API, it was possible for GtkSpell to lookup the tag and read the region.

So the patches for GtkSourceView and GtkSpell have been merged, to remark only later that there was a quite annoying text responsiveness problem on long lines (e.g. a wrapped line that takes 5 lines on the screen). And… there was exactly the same problem with the gedit spell plugin. The typed text appeared with a noticeable delay. Fixing that problem was more complicated. The text needs to be spell checked after a timeout. But adding a timeout function means that the remaining region to spell check needs to be tracked, which was not the case, neither in GtkSpell nor in gedit. And another problem is that GtkSpell anyway needed some code clean-ups. On the other hand the gedit code was in a slightly better shape and, more importantly, it had more features. For example gedit has a dialog window to spell check an entire document, one (misspelled) word at a time, whereas GtkSpell only has an “in-line” checker. An in-line checker is not convenient in the case of a very long document with very few misspelled words, in that case the dialog window is more convenient (btw it could also be an horizontal bar above or below the text, to not hide the text by the dialog window).

So, since the gedit spell plugin’s code had more features, I’ve decided to improve that code base instead. The gedit plugin code also needed some code clean-ups, but at least the code architecture was for the most part good. After those code refactorings and bug fixes, it was easier to fix the responsiveness problem. Then, after some more “spell shaking” (haha) the code was re-usable for other text editors.

Enters gspell

The gedit spell plugin’s code has then been copied into its own repository, called gspell. The library is still under construction, but I hope to get a first version available when GNOME 3.18.0 is released (September 21, according to the schedule). That first version will not have a guaranteed stable API, be warned! It is currently available on my GitHub account, but if things go well, I’ll ask during the next development cycle to get it hosted on gnome.org!

Update: gspell is now hosted on gnome.org, the links above have been updated. The project page is now at https://wiki.gnome.org/Projects/gspell.

What it means for LaTeXila

Basically, the LaTeX command’s names won’t be highlighted anymore with a red wavy underline. And there will be a dialog window to spell check an entire file. Also, on the LaTeXila side, settings will be stored on a file-by-file basis (to remember the language and whether the in-line checker is activated), and there will be settings in the preferences dialog for the default configuration.

I already have a branch in LaTeXila that uses gspell, and it works pretty well. There is still a bit of work to do, but it should be ready soon. Since it would be a pity to not have it for LaTeXila 3.18, I’ll delay the release of LaTeXila 3.18.0 for a few weeks to let translators have the time to update the translations.

This entry was posted in gedit, gspell, GtkSourceView, LaTeXila. Bookmark the permalink.

5 Responses to Introducing gspell, a new spell checking library

  1. Chris says:

    Kinda off-topic with regards to gspell… I think your fundraiser needs more visibility. I donated quite a bit in March but somehow not a lot more has happened since then. With only about one small donation a month (judging from the recent donations list) it will take ages to reach even your first milestone.

    • swilmet says:

      Yeah, the first (and maybe unique) wave is already finished. The first milestone was not reached. It’s maybe because LaTeXila is quite a niche application? And because GNOME contributors have already donated for gnome-builder, which is also an IDE. But at least people that actually use LaTeXila are now normally aware of the fundraiser, or they will be when they will upgrade to a newer version, where a dialog window appears with the “Did you know…” (it just appears once). Anyway, thanks for your support!

      Although 800€ is not a lot for what I’ve done with gspell, I don’t critically need more money *right now*, but having other financial sources other than my day job (I work part time) would allow me to continue my activity in GNOME and free software in the long run (e.g. if I want to have a car, live in a bigger apartment and have children, etc).

      So yes, it would be nice to have a second wave of financial support for LaTeXila. But I’m not good at marketing, and it requires a lot of time to do that correctly.

      Btw I have also earned some money with Bountysource for GtkSourceView:
      https://www.bountysource.com/

      What would be nice is an app store for Linux where it would be really easy to pay for an app. The code source would still be available, it would still be a free software, but installing the binaries easily would require to pay a small amount. But such system doesn’t exist yet on Linux. Maybe with xdg-app, GNOME Software and a payment system with Bitcoin?

  2. Willo says:

    Just expanding a bit on what Chris has said:
    Looking on https://wiki.gnome.org/Apps/LaTeXila the link to the fundraiser is as hidden as possible. I think a bit more in-your-face promotion wouldn’t harm :)

    Maybe you could reinforce the relevance of your efforts beyond LaTeXila itself.

    Anyway, thank you for your efforts!

    • swilmet says:

      Is it better now? I’ve re-targeted the fundraiser to focus more on the usefulness for other text editors.

      If you have improvements ideas, don’t hesitate! (you or anyone reading this comment).

  3. Pingback: LaTeXila 3.18 + need of a graphics designer for the app icon | Sébastien Wilmet

Comments are closed.

Leave a Reply

Your email address will not be published.