<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <author>
    <name>Sébastien Wilmet</name>
  </author>
  <id>https://wilmet-software.be/blog/feed.atom.xml</id>
  <link rel="self" type="application/atom+xml" href="https://wilmet-software.be/blog/feed.atom.xml" />
  <link type="text/html" href="https://wilmet-software.be/blog/index.html" />
  <title>Sébastien Wilmet</title>
  <updated>2024-08-11T10:00:00Z</updated>

<entry>
  <title>How to avoid gnome-software from running in the background</title>
  <id>https://wilmet-software.be/blog/2024-08-11-how-to-avoid-gnome-software-from-running-in-the-background.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2024-08-11-how-to-avoid-gnome-software-from-running-in-the-background.html" />
  <published>2024-08-11T10:00:00Z</published>
  <updated>2024-08-11T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  I wanted to share a tip about making
  <a href="https://www.gnome.org/">GNOME</a> lighter for old computers, by
  avoiding <a href="https://apps.gnome.org/Software/">gnome-software</a> from
  running as a background process (to use less memory).
</p>
<p>
  By default, gnome-software runs in the background in order to check for
  updates and sends notifications about it. If you complete this tutorial, you
  will need to check for updates manually.
</p>
<p>
  The steps below have been tested on
  <a href="https://www.opensuse.org/">openSUSE</a> Leap 15.6 with GNOME 45, but
  it should be easy to adapt to other Linux/Unix distributions.
</p>
<p>
  The old computer has 4 GB of RAM, which is a bit too few for a modern GNOME,
  especially with Firefox and LibreOffice launched at the same time. As
  alternatives, it would be possible to install e.g.
  <a href="https://xfce.org/">Xfce</a> (a lighter desktop environment) or to add
  a RAM stick.
</p>

<h3>Checking with the System Monitor</h3>
<p>
  GNOME has a nice application called
  <a href="https://apps.gnome.org/SystemMonitor/">System Monitor</a> to check
  the memory used and the processes that are running, among other pieces of
  information.
</p>
<p>
  Alternatively, there are lots of tools available in the terminal. For example
  <code>htop</code> and a <code>ps</code> command like:
</p>
<pre>
$ ps aux | grep -i soft
</pre>

<h3>First step: disable the gnome-software autostart</h3>
<p>
  For this step, we need to refer to the
  <a href="https://specifications.freedesktop.org/autostart-spec/latest/">autostart documentation</a>.
</p>
<p>
  In fact, gnome-software is auto-started because there is a
  <code>*.desktop</code> file placed in one of the autostart directories. In our
  case, the file is located at:
  <code>/etc/xdg/autostart/org.gnome.Software.desktop</code>
</p>
<p>
  The autostart documentation explains a clean solution to overwrite an
  autostart decision, by placing a <code>*.desktop</code> file with the <em>same
  name</em> but in a directory that has a higher priority. And it explains that
  by adding <code>Hidden=true</code>, it disables the autostart.
</p>
<p>
  So in our case the solution is simple:
</p>
<pre>
$ mkdir -p ~/.config/autostart/
$ cp /etc/xdg/autostart/org.gnome.Software.desktop ~/.config/autostart/
$ echo 'Hidden=true' >> ~/.config/autostart/org.gnome.Software.desktop
</pre>

<h3>Second step: disable the gnome-shell search provider</h3>
<p>
  The above step is not enough, because when searching something in the
  gnome-shell's <em>Activities Overview</em>, it launches a set of search
  providers ... including the gnome-software one. And once the gnome-software
  process runs, it will keep running in the background.
</p>
<p>
  So, you also need to disable the gnome-software search provider. Or to disable
  <em>all</em> search providers altogether, because it will make GNOME even
  lighter.
</p>
<p>
  To do that, open the Settings (gnome-control-center) application, go to the
  Search panel, and disable what you don't need.
</p>
<p>
  It's possible to achieve the same with a <code>gsettings</code> command in the
  terminal.
</p>

<h3>Last step</h3>
<p>
  Just log out and log in again, or reboot.
</p>
    </div>
  </content>
</entry>

<entry>
  <title>File loading and saving in GtkSourceView, finally</title>
  <id>https://wilmet-software.be/blog/2014-07-09-file-loading-and-saving-in-gtksourceview.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2014-07-09-file-loading-and-saving-in-gtksourceview.html" />
  <published>2014-07-09T10:00:00Z</published>
  <updated>2014-07-09T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  Last year
  <a href="https://gitlab.gnome.org/GNOME/gtksourceview" target="_blank">GtkSourceView</a>
  saw a new
  <a href="https://wilmet-software.be/blog/2013-08-19-regex-search-in-gedit-and-gtksourceview-finally.html" target="_blank">search and replace API</a>.
  This year it's the file loading and saving that has just landed! It is in the
  continuity of
  <a href="https://wiki.gnome.org/Apps(2f)Gedit(2f)Attic(2f)ReusableCode.html" target="_blank">making the gedit source code more reusable</a>
  for other text editors.
</p>

<p>
  In short, the back-end part of the file loading and saving in
  <a href="https://gedit-text-editor.org/" target="_blank">gedit</a>
  has been moved to GtkSourceView, with a new and more flexible API to better
  wrap the feature. The code has been modified to follow GIO conventions for
  asynchronous operations, to use GTask internally, and replace the uses of
  GSettings by properties, among other things.
</p>

<p>
  The file loader auto-detects encodings, newline types and compression type
  (yes gedit can open gzip files). Invalid characters can also be displayed
  with their corresponding hexadecimal value, because GtkTextBuffer accepts
  only valid UTF-8 text. And progress information is reported during the
  operation.
</p>

<p>
  The API is stateful: the file parameters (encoding etc) are remembered
  between a file loading and a file saving in a GtkSourceFile object.
  Unfortunately the new API is still quite low-level. The application must
  configure the file loader and the file saver, and some errors are returned to
  the application.
</p>

<p>
  So the front-end and errors handling is still implemented in gedit. Errors
  and progress information are displayed in an info bar, above the
  GtkSourceView widget. For some errors, gedit proposes different actions to
  the user, like choosing another encoding.
</p>

<h3>API design</h3>

<p>
  If you are a text editor developer, don't hesitate to have a look at the
  <a href="https://gedit-text-editor.org/developer-docs/libgedit-gtksourceview-300/file-loading-and-saving.html" target="_blank">GtkSourceFile API</a>.
  The API can still change during this 3.13 development cycle. The notes about
  the API design are available
  <a href="https://bugzilla.gnome.org/show_bug.cgi?id=721016" target="_blank">on bugzilla</a>
  (there has been four iterations). Here is a summary.
</p>

<p>
  The API is a bit heavy, with the following classes: GtkSourceEncoding,
  GtkSourceFile, GtkSourceFileLoader and GtkSourceFileSaver. There are good
  reasons for having two class' names derived from a verb ("to load" and "to
  save"), which is generally a hint that those classes should be replaced by a
  method (i.e. an action). The reasons are partly similar with the new
  <a href="https://docs.gtk.org/gio/class.SubprocessLauncher.html" target="_blank">GSubprocessLauncher</a>
  in GIO: the FileLoader and FileSaver classes are there not only for launching
  the operation, but also for configuring it with a nicer and more extensible
  API than one function with a dozen parameters. With the FileLoader and
  FileSaver, we can add properties, functions and even signals. And the
  FileLoader and FileSaver classes are quite useful in gedit: when an error
  occurs and the user clicks on a button in the info bar, the loader or saver
  object is reconfigured and the operation is relaunched, without the need to
  keep the initial configuration around. Also, the FileLoader or FileSaver
  properties are applied to the GtkSourceFile object only on a successful
  operation, so the GtkSourceFile state is (normally) consistent with the
  underlying file on the disk, at least at the time of the last load or save
  operation done with GtkSourceView.
</p>

<h3>Possible follow-ups work</h3>

<p>
  A possible follow-up is to make the front-end code more reusable, either by
  creating higher-level classes in GtkSourceView, or by creating a git
  submodule, like the
  <a href="https://gitlab.gnome.org/GNOME/libgd" target="_blank">libgd</a>
  (without API stability guarantees in the latter case).
</p>

<p>
  Another possible follow-up is to analyze and improve the performances, which
  are currently quite bad. For short files it is not visible of course, but
  opening a very big log file takes more time than with other popular text
  editors.
</p>

<p>
  There are other possible improvements, like unescaping invalid characters
  when saving, or avoid blocking the GtkTextBuffer when (auto-)saving a short
  remote file on a slow network connection.
</p>

<h3>Changes for gedit plugins</h3>

<p>
  Unfortunately there are some changes in the gedit API for plugins, mainly in
  GeditDocument. Fortunately the changes are
  <a href="https://wiki.gnome.org/Apps(2f)Gedit(2f)Attic(2f)Old_API_Changes.html" target="_blank">well documented</a>,
  and most plugins should still work without any modification.
</p>

<h3>Conclusion</h3>

<p>
  The file loading and saving can quickly become a fairly complex beast. Now
  this code is available for other GTK+ text editors.
</p>

<p>
  Thanks to
  <a href="http://blogs.gnome.org/pbor/" target="_blank">Paolo Borelli</a>
  for the reviews!
</p>

<p>
  TL;DR:
</p>
<ul>
  <li>In GtkSourceView: 29 files changed, 7909 insertions(+), 3 deletions(-)</li>
  <li>In gedit: 49 files changed, 1888 insertions(+), 8819 deletions(-)</li>
  <li>In gedit-plugins: 11 files changed, 22 insertions(+), 31 deletions(-)</li>
</ul>

<p>
  This is a 12% code increase in GtkSourceView, and a 6% code decrease in
  gedit.
</p>

<p>
  PS: As usual, some tests would be more than welcome before the stable version
  in September.
</p>

<p>
  <strong>Edit:</strong> update most of the links (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Making the gedit source code more reusable</title>
  <id>https://wilmet-software.be/blog/2014-05-20-making-the-gedit-source-code-more-reusable.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2014-05-20-making-the-gedit-source-code-more-reusable.html" />
  <published>2014-05-20T10:00:00Z</published>
  <updated>2014-05-20T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  On IRC I see some developers working on other text editors based on
  <a href="https://docs.gtk.org/gtk4/section-text-widget.html" target="_blank">GtkTextView</a>/<a href="https://gitlab.gnome.org/GNOME/gtksourceview" target="_blank">GtkSourceView</a>.
  It is a good thing in my opinion to have specialized text editors. They are
  easier to use and configure. A specialized application has a potentially
  better usability. A general-purpose text editor like
  <a href="https://gedit-text-editor.org/" target="_blank">gedit</a>
  is of course still needed for languages not covered by a specialized text
  editor or IDE.
</p>

<p>
  The problem is that creating a new text editor based on GtkSourceView is
  still quite a lot of work. Instead of reinventing the wheel, the idea is to
  make the gedit source code more reusable by moving it to GtkSourceView or to
  a git submodule.
  <a href="https://wiki.gnome.org/Apps(2f)Gedit(2f)Attic(2f)ReusableCode.html" target="_blank">This wiki page</a>
  has all the details, it keeps track of the progress made (see also the
  <a href="https://wiki.gnome.org/Apps(2f)Gedit(2f)Attic(2f)OldRoadMap.html" target="_blank">RoadMap</a>),
  more details on the "why?", and a paragraph on
  <a href="https://gitlab.gnome.org/Archive/anjuta" target="_blank">Anjuta</a>.
</p>

<p>
  This blog post was to make developers aware of this initiative. If you are
  interested, join us on the #gedit channel or the
  <a href="https://mail.gnome.org/archives/gedit-list/" target="_blank">mailing list</a>!
</p>

<p>
  <strong>Edit:</strong> update all the links (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>{specialized, general-purpose} x {text editors, IDEs}</title>
  <id>https://wilmet-software.be/blog/2014-02-11-specialized-general-purpose-text-editors-ides.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2014-02-11-specialized-general-purpose-text-editors-ides.html" />
  <published>2014-02-11T10:00:00Z</published>
  <updated>2014-02-11T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  Some thoughts about text editors, IDEs, specialized or general-purpose
  applications.
</p>

<table>
<tr>
  <td></td>
  <td>Several languages</td>
  <td>Other tasks</td>
  <td>Plugins</td>
</tr>
<tr>
  <td>Specialized text editor</td>
  <td>No</td>
  <td>No</td>
  <td>?</td>
</tr>
<tr>
  <td>General-purpose text editor</td>
  <td>Yes</td>
  <td>No</td>
  <td>Yes</td>
</tr>
<tr>
  <td>Specialized IDE</td>
  <td>No</td>
  <td>Yes</td>
  <td>?</td>
</tr>
<tr>
  <td>General-purpose IDE</td>
  <td>Yes</td>
  <td>Yes</td>
  <td>Yes</td>
</tr>
</table>

<p>
  The above table summarizes how I view the text editors and IDEs field.
</p>

<h3>Several languages</h3>

<p>
  A specialized application focus only on one programming language, or several
  languages used together. A general-purpose application can support completely
  different programming languages and platforms.
</p>

<h3>Other tasks</h3>

<p>
  A text editor focus only on editing text or source code, while simplifying as
  most as possible the writing of this code. An IDE integrates other features
  like building the source code, running it, writing commits, integrate a
  debugger, and so forth.
</p>

<h3>Plugins</h3>

<p>
  For obvious reasons, a general-purpose application should have a plugin
  system. For a specialized application, the need for plugins is less obvious.
</p>

<h3>Two extremes</h3>

<p>
  The general-purpose IDE with plugins is one extreme. The user interface must
  be generic enough to suit plugins and different programming languages. And it
  takes more time to learn and configure the application.
</p>

<p>
  The specialized text editor without plugins is the other extreme. Its
  developer has full control on the user interface, so the application has a
  potentially better usability. Users of the application require less time to
  learn and configure it. Ideally, it should Just Work.
</p>

<h3>Not reinventing the wheel for specialized applications</h3>

<p>
  Write libraries for the common features! Or at least ensure that your code is
  reusable. This is not limited to text editors and IDEs, I'm sure you can
  apply the same principles on your favorite field.
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Search and replace behavior for a text editor</title>
  <id>https://wilmet-software.be/blog/2013-12-08-search-and-replace-behavior-for-a-text-editor.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2013-12-08-search-and-replace-behavior-for-a-text-editor.html" />
  <published>2013-12-08T10:00:00Z</published>
  <updated>2013-12-08T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  The search and replace is one of those features that have a wide variety of
  different implementations and behaviors across applications. The nice thing
  with my work I did this summer on
  <a href="https://gitlab.gnome.org/GNOME/gtksourceview" target="_blank">GtkSourceView</a>,
  is that you can build whatever behavior you want by using
  <a href="https://developer.gnome.org/gtksourceview/unstable/GtkSourceSearchContext.html">the new search and replace API</a>.
  And that's exactly what I did for
  <a href="https://gitlab.gnome.org/World/gedit/enter-tex">LaTeXila</a>,
  which has a new behavior for the replace button.
</p>

<p>
  <em>Screenshot of the search and replace in LaTeXila</em> (image lost)
</p>

<p>
  When we replace an occurrence, we generally have the time and we don't have a
  train to take (or we are already in the train). And it's better to see how
  the content looks like with the replacement text, to see if everything is
  fine and make adjustments if required. As a consequence, when you click on
  the replace button, it just replaces the search match without moving to the
  next occurrence (which can be far away, so we would not be able to see the
  replaced text).
</p>

<p>
  When you have just replaced an occurrence, no text is selected. If you click
  a second time on the replace button, it goes to the next occurrence, and
  selects it, to repeat the process. Nice, isn't it?
</p>

<p>
  Voilà, that's all, I just wanted to share this information. It can be
  interesting for other applications.
</p>

<p>
  <strong>Edit:</strong> update some links (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>The GSoC on GtkSourceView/gedit comes to an end</title>
  <id>https://wilmet-software.be/blog/2013-09-21-the-gsoc-on-gtksourceview-gedit-comes-to-an-end.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2013-09-21-the-gsoc-on-gtksourceview-gedit-comes-to-an-end.html" />
  <published>2013-09-21T10:00:00Z</published>
  <updated>2013-09-21T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  A small update on my GSoC.
</p>

<p>
  The first part took a little longer than expected. But I'm happy with the
  results, the search and replace API is simple and flexible, there were not a
  lot of bugs to fix, and gedit users will be happy with the improvements
  (including
  <a href="2013-08-19-regex-search-in-gedit-and-gtksourceview-finally.html">the regex search</a>).
</p>

<p>
  I've changed a little what was initially planned for the second part of the
  GSoC. Ideally, it was to rework the color schemes to use CSS, and investigate
  GtkTextTag to modernize it. For the color schemes, it was not really a
  high-priority issue for
  <a href="https://gitlab.gnome.org/GNOME/gtksourceview">GtkSourceView</a>,
  writing them in XML works fine. And the GtkTextTag investigation would have
  been the logical follow-up. But with the remaining time, I have found other
  interesting and smaller tasks instead.
</p>

<p>
  The past few weeks I worked on various things in other parts of GtkSourceView
  and gedit: better document the API, fix some bugs, improve the code here and
  there, and investigate two longer projects: the code folding and making the
  gedit source code more reusable.
</p>

<p>
  I've written a
  <a href="https://bugzilla.gnome.org/show_bug.cgi?id=707703">utility class</a>
  to navigate quickly through a set of GtkTextMarks. It is a cleaner
  implementation of GtkSourceMarks, and it will be useful for the code folding.
</p>

<h3>Making the gedit source code more reusable</h3>

<p>
  For making the gedit source code more reusable, I've created a git submodule
  called
  <a href="https://github.com/swilmet/libgedit">libgedit</a>.
  Like the
  <a href="https://gitlab.gnome.org/GNOME/libgd">libgd</a>,
  the API/ABI stability is not guaranteed. The purpose is to try to move as
  most code as possible in the libgedit, iterate the API if needed until it is
  good enough to be included in GtkSourceView. So the libgedit would be a
  staging area between gedit and GtkSourceView. There is a problem though:
  gedit has an API for its plugins. And if possible, it's better to not break
  the plugins… If the code moves from gedit to the libgedit, and then from the
  libgedit to GtkSourceView, there can be several API breaks. On the other
  hand, if the code goes directly in GtkSourceView, there is at most one API
  break (that can be avoided if the gedit functions are simply deprecated, not
  removed). With the second solution, the risk is to discover problems too
  late.
</p>

<p>
  Maintaining the gedit plugins API in the libgedit is one problem. There are
  other problems: it would be nice to share the translations; have an API
  documentation only for the libgedit (with GTK-Doc, I mean); working with a
  git submodule is less convenient; having the same namespace ("Gedit") for
  gedit and libgedit is a problem when trying to make the code more reusable; a
  headers nightmare, some headers are private, others are public, and others
  are split between gedit and libgedit; and so on.
</p>

<p>
  So I think it will be simpler to move the code directly to GtkSourceView. The
  API must be well thought. The developers must have enough time during the
  6-months development cycle to iterate the API if needed. And ideally the API
  must be tested on other applications than gedit. If it is done slowly but
  surely, by small steps every cycle, it should be doable.
</p>

<p>
  That's all folks. Thanks to
  <a href="http://blogs.gnome.org/nacho/">Ignacio Casal Quinteiro</a> (nacho)
  and
  <a href="http://blogs.gnome.org/pbor/">Paolo Borelli</a> (pbor)
  for their reviews, advices and (sometimes late ;-) ) testing. Thanks to
  Garrett Regier (gregier) for having well tested the new search and replace in
  gedit. And thanks to Google and GNOME, for accepting me as a GSoC student.
</p>

<p>
  <strong>Edit:</strong> update some links (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Regex search in gedit and GtkSourceView, finally</title>
  <id>https://wilmet-software.be/blog/2013-08-19-regex-search-in-gedit-and-gtksourceview-finally.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2013-08-19-regex-search-in-gedit-and-gtksourceview-finally.html" />
  <published>2013-08-19T10:00:00Z</published>
  <updated>2013-08-19T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  <em>Screenshot of regex search in gedit</em> (image lost)
</p>

<p>
  Although regular expression searches were possible with plugins, it is now
  available by default in gedit. The search and replace works too, and you can
  use backreferences (<code>\0</code>, <code>\1</code>, …) in the replacement
  text.
</p>

<p>
  All this work has been merged upstream, just in time before the freeze.
</p>

<h3>Reworked search and replace API in GtkSourceView</h3>

<p>
  Behind the scene, the regex search is implemented in GtkSourceView. For most
  cases, it scales well for big text buffers, since multi-segment matching is
  done: when a partial match is returned, we take a bigger segment. Read the
  <a href="https://git.gnome.org/browse/gtksourceview/tree/gtksourceview/gtksourcesearchcontext.c">lengthy implementation overview</a>
  at the top of <code>gtksourcesearchcontext.c</code> for more details.
</p>

<p>
  Besides the regex search, the API is now more flexible. Roughly speaking, it
  was initially a one-to-one relationship: only one search was possible at a
  time in a text buffer. It is now a many-to-many relationship: several
  searches can execute at the same time in the same text buffer (it can be
  useful for non-highlighted, background searches). And the search settings can
  be shared between several buffers.
</p>

<p>
  Next step for my GSoC: rework the GtkSourceView style schemes to use CSS.
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Aligning parameters of a C function declaration, with lineup-parameters</title>
  <id>https://wilmet-software.be/blog/2013-07-25-aligning-parameters-of-a-c-function-declaration-with-lineup-parameters.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2013-07-25-aligning-parameters-of-a-c-function-declaration-with-lineup-parameters.html" />
  <published>2013-07-25T10:00:00Z</published>
  <updated>2013-07-25T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  Renaming a GObject class can involve a lot of manual work. Once the type is
  renamed, the parameters of the function declarations are no longer aligned.
  In the following example, GtkSourceSearch has been renamed to
  GtkSourceSearchContext:
</p>

<pre>
guint
_gtk_source_search_replace_all (GtkSourceSearchContext *search,
                                const gchar     *replace,
                                gint             replace_length)
{
        /* ... */
}
</pre>

<p>
  It is a GNOME convention to align the parameters, so the code must be fixed:
</p>

<pre>
 guint
 _gtk_source_search_replace_all (GtkSourceSearchContext *search,
                                 const gchar            *replace,
                                 gint                    replace_length)
{
        /* ... */
}
</pre>

<p>
  As programmers, we don't like doing such a manual work, and even less when we
  are renaming a big class. Unfortunately, the
  <a href="https://www.gnu.org/software/indent/">Indent</a>
  program doesn't have an option for that. If you use Vim, there is the
  <a href="http://www.vim.org/scripts/script.php?script_id=294">Align plugin</a>,
  that have the <code>\afnc</code> alignment mapping. But it doesn't align the
  parameters on the parenthesis.
</p>

<p>
  So I wrote a script! The result is in my
  <a href="https://gitlab.gnome.org/swilmet/gdev-c-utils">gnome-c-utils repository</a>
  (containing only the lineup-parameters script for the moment).
</p>

<p>
  To detect the parameters, a few regular expressions are used. There are quite
  a lot of restrictions, but it should work for most GNOME software. To have a
  perfect script, libclang could be used, but I've never used it, so regular
  expressions was a quicker solution.
</p>

<p>
  The script can be used to convert an entire file, or can be used from a text
  editor (stdin is read, and the output is written to stdout). I've documented
  how to add a key binding in Vim. So by pressing a single key, the parameters
  are correctly aligned!
</p>

<p>
  This is just a small step to improve the developer experience in GNOME. But I
  hope this will be useful for other developers. I dream of a GNOME C IDE that
  handles the boilerplate (for renaming classes too), that aligns the
  parameters and the function prototypes in the headers, with auto-completion
  for signals and properties names, and so on.
</p>

<p>
  <strong>Edit:</strong> update the links (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Search and replace in gedit and GtkSourceView</title>
  <id>https://wilmet-software.be/blog/2013-07-15-search-and-replace-in-gedit-and-gtksourceview.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2013-07-15-search-and-replace-in-gedit-and-gtksourceview.html" />
  <published>2013-07-15T10:00:00Z</published>
  <updated>2013-07-15T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  My GSoC on GtkSourceView/gedit/… is coming along nicely. Here is a screenshot
  of the new search in gedit:
</p>

<p>
  <em>New gedit search</em> (screenshot lost)
</p>

<p>
  The visible new thing is the "298 of 703" in the search entry, that shows the
  position of the current search match, and the total number of occurrences.
  This is just the tip of the iceberg, as much of the work has been done under
  the hood.
  <a href="http://blogs.gnome.org/nacho/">Ignacio</a> (nacho),
  my mentor, has improved GdTaggedEntry, and I worked on the new API in
  GtkSourceView, and adapted gedit to use the new API.
</p>

<p>
  Note: almost all my work has already been merged upstream, but not the new
  search entry.
</p>

<h3>Search and replace API in GtkSourceView</h3>

<p>
  The new API in GtkSourceView
  <a href="https://developer.gnome.org/gtksourceview/unstable/GtkSourceBuffer.html">is available</a>.
  One thing is missing though: regex search.
</p>

<p>
  Why you should use this API:
</p>
<ul>
  <li>
    It is asynchronous, i.e. the user interface is normally not blocked when
    the <code>GtkTextBuffer</code> is scanned. And the asynchronous overhead is
    small;
  </li>
  <li>
    The search matches are highlighted;
  </li>
  <li>
    You can get the total number of occurrences and the position of a certain
    occurrence easily;
  </li>
  <li>
    For each search, the buffer is scanned at most once. Once the search
    occurrences are found, navigating through them doesn't require to re-scan
    the buffer, thanks to <code>gtk_text_iter_forward_to_tag_toggle()</code>.
    As a result, most operations are really fast;
  </li>
  <li>
    The regex search (still to come) will normally do multi-segment matching,
    also called incremental matching: when a partial match is returned, we take
    a bigger segment. No need to waste memory space to retrieve the entire
    buffer contents.
  </li>
</ul>

<p>Nice, isn't it?</p>
    </div>
  </content>
</entry>

<entry>
  <title>Developing graphical IDEs the UNIX way</title>
  <id>https://wilmet-software.be/blog/2013-07-03-developing-graphical-IDEs-the-unix-way.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2013-07-03-developing-graphical-IDEs-the-unix-way.html" />
  <published>2013-07-03T10:00:00Z</published>
  <updated>2013-07-03T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<h3>Introduction</h3>
<p>
  Programming on a UNIX environment typically involves the use of CLI (Command
  Line Interface) tools and TUI (Terminal User Interface) programs. What is
  really nice about these tools is that they do only one thing, but do it well.
</p>
<p>
  An advantage of a GUI (Graphical User Interface) application is that it can
  have features that are almost impossible to implement as a TUI. So a GUI
  program is sometimes more convenient to use.
</p>
<p>
  An IDE is an integrated development environment. What people think about this
  "environment" is generally a single program. But what if the environment is
  not one big application, but several small programs? The small programs can
  interact a little together through an Inter-Process Communication system like
  D-Bus.
</p>

<h3>The different tools and their interactions</h3>
<p>
  So, the idea is to create development tools as several small GUI applications.
  You need a text editor, a tool for git, something to compile and run the
  project, a debugger, a documentation browser, a terminal of course, and so on.
</p>
<p>
  All these could interact. IDEs usually have the concept of projects. We can
  imagine the same with small apps, by having for instance a hub application to
  create and open projects, and then it opens the other apps with the current
  project.
</p>
<p>
  Or just being able to launch another tool from the text editor, with a given
  context so that the other tool is directly opened with the right content.
</p>

<h3>Conclusion</h3>
<p>
  Such an "IDE" would feel more lightweight than a single application. It would
  be interesting to explore and experiment this idea.
</p>

<p>
  <strong>Revisions:</strong><br />
  July 2013: first version, contained too many details and a troll about
  Eclipse.<br />
  April 2024: new version, almost entirely rewritten.
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Hi, planet GNOME! GSoC on (mainly) GtkSourceView</title>
  <id>https://wilmet-software.be/blog/2013-06-23-hi-planet-gnome-gsoc-on-mainly-gtksourceview.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2013-06-23-hi-planet-gnome-gsoc-on-mainly-gtksourceview.html" />
  <published>2013-06-23T10:00:00Z</published>
  <updated>2013-06-23T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  My blog has just been added to the planet GNOME!
</p>

<p>
  I'm now a GSoC student, working mainly on
  <a href="https://gitlab.gnome.org/GNOME/gtksourceview">GtkSourceView</a>
  (<a href="https://wiki.gnome.org/Outreach(2f)SummerOfCode(2f)2013(2f)Projects(2f)GtkSourceView.html">my proposal</a>).
</p>

<p>
  I'm implementing a higher-level asynchronous API for the search and replace.
  I hope to finish this task in two weeks.
</p>
<p>
  Then: regex search, adapt gedit, modernize the color schemes and ideally
  GtkTextTag to use CSS.
</p>

<h3>Search API, some progress</h3>

<p>
  The highlighting of search matches works fine, there was a flickering issue
  that I fixed.
</p>

<p>
  A property contains the total number of search occurrences. So while the user
  is typing the text to search, the buffer is scanned to highlight and count
  the number of matches. What will be really nice is that, once the buffer is
  entirely scanned, going to the previous/next occurrence will be a O(log n)
  operation, thanks to <code>gtk_text_iter_forward_to_tag_toggle()</code>
  (that's why the matches must be highlighted even if they are not visible on
  the screen). It was more difficult to implement than always using
  <code>gtk_text_iter_forward_search()</code> and
  <code>backward_search()</code> to navigate through the occurrences, but I
  think it was worth the effort.
</p>

<p>
  If you want to read more details, I've written a quite long implementation
  overview, with the problems to avoid,
  <a href="https://git.gnome.org/browse/gtksourceview/tree/gtksourceview/gtksourcesearch.c?h=wip/search">at the top of gtksourcesearch.c</a>
  (it will also be useful to future maintainers).
</p>

<p>
  I'll continue to blog to explain my progress, so stay tuned!
</p>

<p>
  <strong>Edit:</strong> update some links (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>My work on GtkSourceView so far</title>
  <id>https://wilmet-software.be/blog/2013-03-19-my-work-on-gtksourceview-so-far.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2013-03-19-my-work-on-gtksourceview-so-far.html" />
  <published>2013-03-19T10:00:00Z</published>
  <updated>2013-03-19T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  During the GNOME 3.7 development cycle I've been busy working on
  <a href="https://gitlab.gnome.org/GNOME/gtksourceview">GtkSourceView</a>,
  a library used by
  <a href="https://gedit-text-editor.org/">gedit</a>,
  <a href="https://gitlab.gnome.org/Archive/anjuta">Anjuta DevStudio</a>,
  <a href="https://gitlab.gnome.org/World/gedit/enter-tex">LaTeXila</a>,
  and other applications.
</p>

<p>
  The main change is that <strong>the completion system has been revamped,
  mainly under the hood</strong>.
</p>

<h3>Completion: user-visible changes</h3>
<p>
  The only user-visible changes are the <strong>bug fixes</strong> and the
  <strong>new <em>calltip</em> window sizing</strong>, also used for displaying
  extra pieces of information for proposals. In GtkSourceView 2 there was a
  function for tuning the calltip sizing, but this function has been removed
  when porting GtkSourceView to GTK+ 3. Now the sizing works correctly without
  any tuning function, the window simply fits the natural size of its child
  widget.
</p>

<p>
  Now the user-comprehensible explanation:
</p>

<p>
  Screenshot <em>before</em> (<strong>Update:</strong> no longer available).
</p>
<p>
  Screenshot <em>after</em> (<strong>Update:</strong> no longer available).
</p>

<p>
  You see that the main completion window is still quite big when there are
  only a few proposals. For now it's not possible to change that, but a more
  compact completion window should be possible in the future.
</p>

<h3>Completion: developer-visible changes</h3>

<p>
  The completion system is now better documented. A few functions have been
  deprecated. The code has been simplified (two classes have been almost
  completely rewritten). There are also some performance improvements, but it
  was not really an issue previously. Some statistics on the number of lines:
</p>

<p>Before:</p>
<pre>
$ wc -l gtksourcecompletion*.{c,h} | tail -1
  8012 total
</pre>

<p>After:</p>
<pre>
$ wc -l gtksourcecompletion*.{c,h} | tail -1
  6728 total
</pre>

<blockquote>
  <q>Perfection is achieved not when there is nothing more to add, but rather
  when there is nothing more to take away.</q> (Antoine de Saint-Exupéry)
</blockquote>

<h3>Other enhancements to GtkSourceView</h3>

<p>
  <a href="http://blogs.gnome.org/pbor/">Paolo</a> and I wrote more
  <strong>unit tests</strong>, and code coverage support has been added, to
  have statistics with nice colors.
</p>

<p>
  Lots of <strong>compilation warnings have been fixed</strong>, especially for
  the API documentation. For example, the links to GLib or GTK+ symbols work
  now. Compilation warnings are generally easy to fix, it's a good way to get
  involved in a project I think, if there are no easy bugs to fix.
</p>

<p>
  That's all folks. Thanks to
  <a href="http://blogs.gnome.org/pbor/">Paolo</a>,
  <a href="http://blogs.gnome.org/nacho/">Ignacio</a>
  and
  <a href="http://blogs.gnome.org/jessevdk/">Jesse</a>
  for their advices and reviews!
</p>

<p>
  <strong>Edit:</strong> update the links (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Switch from CMake to Autotools</title>
  <id>https://wilmet-software.be/blog/2012-09-05-switch-from-cmake-to-autotools.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2012-09-05-switch-from-cmake-to-autotools.html" />
  <published>2012-09-05T10:00:00Z</published>
  <updated>2012-09-05T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  Last week I've migrated the build system of
  <a href="https://gitlab.gnome.org/World/gedit/enter-tex">LaTeXila</a>
  from CMake to the Autotools. Here are the reasons.
</p>

<h3>The GNU Coding Standards</h3>

<p>
  With CMake, some important make's targets are missing, for example
  <code>make uninstall</code>. The main problem is that CMake doesn't follow
  the
  <a href="https://www.gnu.org/prep/standards/">GNU Coding Standards</a>
  (GCS). The purposes of the GCS, with regard to a build system, is to make a
  program portable, easy to install, and consistent with the way other
  softwares are built and installed.
</p>

<p>
  The GCS has several decades of experience, the standards are well
  established, and we can trust the GNU hackers for having well conceived them.
  Those that don't follow them are devoted to reinvent the wheel: they will be
  faced sooner or later by the same problems already solved by the GCS and the
  Autotools…
</p>

<p>
  Following standards is important both for users and packagers. If every
  software uses a different build system, with different options etc, it is a
  nightmare.
</p>

<h3>Available macros for GNOME applications</h3>

<p>
  Another reason to use the Autotools, for a GNOME application, is to use the
  available macros: for the translations (intltool, ITS Tool), the
  documentation (yelp), the settings (gsettings), …
</p>

<h3>Creating a tarball</h3>

<p>
  With the Autotools it is as simple as running <code>make distcheck</code>,
  and putting some files in <code>EXTRA_DIST</code> or prefixing Automake
  variables with the <code>dist</code> modifier.
</p>

<p>
  It is more complicated with CMake. CPack can be used, but it is far from
  automatic. When reading the CPack documentation, I changed my mind and wrote
  a shell script instead.
</p>

<h3>Learning the Autotools</h3>

<p>
  The Autotools are not as Autopain as people generally say. The learning curve
  is maybe steeper, but with a good book
  (<a href="https://nostarch.com/autotools2e"><em>Autotools - A Practitioner's Guide to GNU Autoconf, Automake, and Libtool</em>, by John Calcote</a>),
  there are no reasons to be afraid.
</p>

<p>
  That said, there are certainly problems in LaTeXila, so some tests before the
  stable release would be more than welcome ;)
</p>

<h3>Quick 2026 update and thoughts</h3>
<p>
  While resurrecting this article, my thoughts on this are that switching to
  Autotools was done primarily to benefit from the GNOME macros instead of
  re-implementing them with CMake. Learning the Autotools permitted me to more
  easily contribute to GtkSourceView and gedit afterwards. And nowadays in 2026,
  it's actually CMake that I recommend instead of Autotools. I also recommend
  CMake over Meson, because with CMake it's possible to write our own functions
  and macros while Meson lacks that support: with Meson it's often required to
  copy/paste snippets of code from one project to another.
</p>
<p>
  I've also updated the links (there is now a second edition of the Autotools
  book).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Some principles for the user experience of a LaTeX editor</title>
  <id>https://wilmet-software.be/blog/2012-08-19-some-principles-for-the-user-experience-of-a-latex-editor.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2012-08-19-some-principles-for-the-user-experience-of-a-latex-editor.html" />
  <published>2012-08-19T10:00:00Z</published>
  <updated>2012-08-19T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  This blog post is now available as a PDF article instead:
</p>
<p>
  <a href="https://gitlab.gnome.org/swilmet/enter-tex-extra/-/blob/main/articles/pdf/latex-editor-some-principles.pdf" target="_blank">latex-editor-some-principles.pdf</a>
</p>
<p>
  <strong>Edit:</strong> replace content by a link (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>About code quality and maintainability</title>
  <id>https://wilmet-software.be/blog/2012-08-01-about-code-quality-and-maintainability.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2012-08-01-about-code-quality-and-maintainability.html" />
  <published>2012-08-01T10:00:00Z</published>
  <updated>2012-08-01T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  It can be difficult to write clean code, that is easy to understand, split in
  nice and well-defined functions that do one thing but do it well, with good
  variables names, and so on. For the maintainability, it is really important.
</p>
<p>
  In fact, a code is read far more often than it is written. For fixing a bug,
  adding a feature, or simply see how it is implemented.
</p>

<h3>General Advices</h3>
<p>
  There are some general advices, for example:
</p>
<ul>
  <li>
    A function's name should be sufficient to know all what the function really
    does.
  </li>
  <li>
    Hide implementation details, and use the domain-specific vocabulary, no
    technical words, if possible. An extreme example:
    <code>get_last_document()</code> is better than
    <code>get_top_stack()</code>.
  </li>
  <li>
    Avoid focusing on performance from the beginning. About 10% of the code is
    responsible of 90% of the execution time. An optimized code is more
    difficult to understand, so it is better to optimize only the 10%.
  </li>
</ul>

<h3>Every Details Matters</h3>
<p>
  Small details can also improve the code readability. Take for example this
  line:
</p>
<pre>
g_return_if_fail (foo &gt;= min_value &amp;&amp; foo &lt;= max_value);
</pre>
<p>
  And compare it with this one:
</p>
<pre>
g_return_if_fail (min_value &lt;= foo &amp;&amp; foo &lt;= max_value);
</pre>
<p>
  Which one do you prefer? In the second sample, we can visually see the
  <code>foo</code> variable between the minimum and maximum values.
</p>
<p>
  Many such small improvements, taken together, make the code more enjoyable to
  read.
</p>

<h3>Code Complete</h3>
<p>
  We can learn these and other advices by reading some (good) existent code, by
  working with more experienced developers, AND by sitting in a comfortable
  sofa with a cup of coffee or tea while reading a book.
</p>
<p>
  I personally have read
  <a href="https://stevemcconnell.com/books/">Code Complete</a>
  (by Steve McConnell) last year. It seems the reference on the subject. But
  there are other similar books, for instance
  <a href="https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/">The Pragmatic Programmer</a>
  (by David Thomas and Andrew Hunt).
</p>
<p>
  Although the editor of Code Complete is Microsoft Press, the book is not
  related to Microsoft or Windows. The author explains sometimes stuff related
  to open source, UNIX and Linux, but one can regret the total absence of the
  mention "free software" and all the benefits of freedom: be able to learn by
  reading other's code, etc. But if you are here, you already know all of this,
  because you are on the good side ;)
</p>
<p>
  <strong>Edit:</strong> update links (in 2026).
</p>
    </div>
  </content>
</entry>

<entry>
  <title>Introduce myself</title>
  <id>https://wilmet-software.be/blog/2012-07-31-introduce-myself.html</id>
  <link type="text/html" href="https://wilmet-software.be/blog/2012-07-31-introduce-myself.html" />
  <published>2012-07-31T10:00:00Z</published>
  <updated>2012-07-31T10:00:00Z</updated>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
<p>
  This is my first blog post.
</p>
<p>
  My name is Sébastien Wilmet. I live in Belgium, and I currently study
  computer science at the university (in Louvain-la-Neuve).
</p>
<p>
  I'm the maintainer of
  <a href="https://gitlab.gnome.org/World/gedit/enter-tex">LaTeXila</a>,
  an integrated LaTeX environment written in Vala. I also contribute to other
  modules, like
  <a href="https://gitlab.gnome.org/GNOME/gtksourceview">GtkSourceView</a>.
</p>
<p>
  I'm not a GSoC student, but maybe next year ;)
</p>
<p>
  <strong>Edit:</strong> update links (in 2026).
</p>
    </div>
  </content>
</entry>

</feed>
