Merge pull request #527 from techee/eol_undo
[geany-mirror.git] / HACKING
blob210d2686d4d8e25ec92d744dc51fc1e9d8cc5d48
1 =============
2 Hacking Geany
3 =============
4 .. contents::
6 General
7 =======
9 About this file
10 ---------------
11 This file contains information for anyone wanting to work on the Geany
12 codebase. You should be aware of the open source licenses used - see
13 the README file or the documentation. It is reStructuredText; the
14 source file is HACKING.
16 You can generate this file by:
18 * Passing the *--enable-html-docs* option to ``configure``.
19 * Running ``make`` from the doc/ subdirectory.
21 Writing plugins
22 ---------------
23 * src/plugindata.h contains the plugin API data types.
24 * See plugins/demoplugin.c for a very basic example plugin.
25 * src/plugins.c loads and unloads plugins (you shouldn't need to read
26   this really).
27 * The API documentation contains a few basic guidelines and hints to
28   write plugins.
30 You should generate and read the plugin API documentation, see below.
32 Plugin API documentation
33 ^^^^^^^^^^^^^^^^^^^^^^^^
34 You can generate documentation for the plugin API using the doxygen
35 tool:
37 * Pass the *--enable-api-docs* option to ``configure``.
38 * Run ``make`` from the doc/ subdirectory.
40 The documentation will be output to doc/reference/index.html.
41 Alternatively you can view the API documentation online at
42 http://www.geany.org/manual/reference/.
44 Pull requests
45 -------------
46 Making pull requests on Github is the preferred way of contributing for geany.
48 .. note:: For helping you to get started: https://help.github.com/articles/fork-a-repo
50 See `Rules to contribute`_ for more information.
52 Patches
53 -------
54 We are happy to receive patches, but the preferred way is to make a pull
55 request on our Github repository. If you don't want to make a pull request,
56 you can send your patches on the devel mailing list, but the rules are the same:
57 see `Rules to contribute`_ for more information.
59 In general it's best to provide git-formatted patches made from the
60 current Git (see `Committing`_)::
62     $ git commit -a
63     $ git format-patch HEAD^
65 We also accept patches against other releases, but it's more work for us.
67 If you're not using Git, although you're strongly suggested to use it,
68 you can use the diff command::
70     $ diff -u originalpath modifiedpath > new-feature.patch
72 However, such a patch won't contain the authoring information nor the
73 patch's description.
75 .. note::
76     Please make sure patches follow the style of existing code - In
77     particular, use tabs for indentation. See `Coding`_.
79 Rules to contribute
80 -------------------
82 Keep in mind this is best to check with us by email on mailing list
83 whether a new feature is appropriate and whether someone is already
84 working on similar code.
86 Please, make sure contributions you make follow these rules:
88 * changes should be made in a dedicated branch for pull requests.
89 * only one feature should be in each pull request (or patch).
90 * pull requests (or patches) should not contain changes unrelated to the feature,
91   and commits should be sensible units of change.
92 * the submitter should squash together corrections that are part of
93   the development process, especially correcting your own mistakes.
94 * Please make sure your modifications follow the style of existing code:
95   see `Coding`_ for more information.
97 See `Committing`_ for more information.
99 Windows tools
100 -------------
101 * Git: http://git-scm.com/ and http://msysgit.github.io/
102 * diff, grep, etc: http://mingw.org/ or http://unxutils.sourceforge.net/
104 See also the 'Building on Windows' document on the website.
106 File organization
107 -----------------
108 callbacks.c is just for Glade callbacks.
109 Avoid adding code to geany.h if it will fit better elsewhere.
110 See the top of each ``src/*.c`` file for a brief description of what
111 it's for.
113 Plugin API code
114 ---------------
115 Please be aware that anything with a doc-comment (a comment with an
116 extra asterix: ``/**``) is something in the plugin API. Things like
117 enums and structs can usually still be appended to, ensuring that all
118 the existing elements stay in place - this will keep the ABI stable.
120 .. warning::
122     Some structs like GeanyCallback cannot be appended to without
123     breaking the ABI because they are used to declare structs by
124     plugins, not just for accessing struct members through a pointer.
125     Normally structs should never be allocated by plugins.
127 Keeping the plugin ABI stable
128 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129 Before the 1.0 release series, the ABI can change when necessary, and
130 even the API can change. An ABI change just means that all plugins will
131 not load and they must be rebuilt. An API change means that some plugins
132 might not build correctly.
134 If you're reordering or changing existing elements of structs that are
135 used as part of the plugin API, you must increment GEANY_ABI_VERSION
136 in plugindata.h. This is usually not needed if you're just appending
137 fields to structs. The GEANY_API_VERSION value should be incremented
138 for any changes to the plugin API, including appending elements.
140 If you're in any doubt when making changes to plugin API code, just ask us.
142 Plugin API/ABI design
143 ^^^^^^^^^^^^^^^^^^^^^
144 You should not make plugins rely on the size of a struct. This means:
146 * Don't let plugins allocate any structs (stack or heap).
147 * Don't let plugins index any arrays of structs.
148 * Don't add any array fields to structs in case we want to change the
149   array size later.
151 Doc-comments
152 ^^^^^^^^^^^^
153 * The @file tag can go in the source .c file, but use the .h header name so
154   it appears normally in the generated documentation. See ui_utils.c for an
155   example.
156 * Function doc-comments should always go in the source file, not the
157   header, so they can be updated if/when the implementation changes.
159 Glade
160 -----
161 Add user-interface widgets to the Glade 3 file ``data/geany.glade``.
162 Callbacks for the user-interface should go in ``src/callbacks.c``.
164 Use Glade 3.8.5. The 3.8 series still supports GTK+ 2, and earlier
165 point releases did not preserve the order of XML elements, leading to
166 unmanageable diffs.
168 GTK versions & API documentation
169 --------------------------------
170 Geany requires GTK >= 2.24 and GLib >= 2.28. API symbols from newer
171 GTK/GLib versions should be avoided or made optional to keep the source
172 code building on older systems.
174 It is recommended to use the 2.24 API documentation of the GTK
175 libs (including GLib, GDK and Pango) has the advantages
176 that you don't get confused by any newer API additions and you
177 don't have to take care about whether you can use them or not.
179 You might want to pass the ``-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28`` C
180 preprocessor flag to get warnings about newer symbols from the GLib.
182 On the contrary, you might also want to get deprecation warnings for symbols
183 deprecated in newer versions, typically when preparing a dependency bump or
184 trying to improve forward compatibility.
185 To do so, use the ``-UGLIB_VERSION_MIN_REQUIRED`` flag for GLib deprecations,
186 and ``-UGDK_DISABLE_DEPRECATION_WARNINGS`` for GTK and GDK ones.
187 To change the lower deprecation bound for GLib (and then get warnings about
188 symbols deprecated more recently) instead of simply removing it entirely, use
189 ``-UGLIB_VERSION_MIN_REQUIRED -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_X_YY``.
191 See `Compiler options & warnings`_ for how to set such flags.
193 Coding
194 ------
195 * Don't write long functions with a lot of variables and/or scopes - break
196   them down into smaller static functions where possible. This makes code
197   much easier to read and maintain.
198 * Use GLib types and functions - gint not int, g_free() not free().
199 * Your code should build against GLib 2.27.3 and GTK 2.24. At least for the
200   moment, we want to keep the minimum requirement for GTK at 2.24 (of
201   course, you can use the GTK_CHECK_VERSION macro to protect code using
202   later versions).
203 * Variables should be declared before statements. You can use
204   gcc's -Wdeclaration-after-statement to warn about this.
205 * Don't let variable names shadow outer variables - use gcc's -Wshadow
206   option.
207 * Do not use G_LIKELY or G_UNLIKELY (except in critical loops). These
208   add noise to the code with little real benefit.
210 Compiler options & warnings
211 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
212 Use ``CFLAGS='-Wfoo' ./configure`` or ``CFLAGS='-Wfoo' ./autogen.sh``
213 to set warning options (as well as anything else e.g. -g -O2).
215 * Enable warnings - for gcc use '-Wall -W' (and optionally
216   -Wno-unused-parameter to avoid unused parameter warnings in Glade
217   callbacks).
218 * You should try to write ISO C99 code for portability, so always
219   use C ``/* */`` comments and function_name(void) instead of
220   function_name(). This is for compatibility with various Unix-like
221   compilers. You should use -std=c99 to help check this.
223 .. tip::
224     Remember for gcc you need to enable optimization to get certain
225     warnings like uninitialized variables, but for debugging it's
226     better to have no optimization on.
228 Style
229 ^^^^^
230 * We use a tab width of 4 and indent completely with tabs not spaces.
231   Note the documentation files use (4) spaces instead, so you may want
232   to use the 'Detect from file' indent pref.
233 * Do not add whitespace at the end of lines, this adds to commit noise.
234   When editing with Geany set preference files->Strip trailing spaces
235   and tabs.
236 * Use the multiline comment ``/* */`` to comment small blocks of code,
237   functions descriptions or longer explanations of code, etc. The more
238   comments are in your code the better. (See also
239   ``scripts/fix-cxx-comments.pl`` in Git).
240 * Lines should not be longer than about 100 characters and after 100
241   characters the lines should be wrapped and indented once more to
242   show that the line is continued.
243 * We don't put spaces between function names and the opening brace for
244   argument lists.
245 * Variable declarations come first after an opening brace, then one
246   newline to separate declarations and code.
247 * 2-operand operators should have a space each side.
248 * Function bodies should have 2 blank newlines after them.
249 * Align braces together on separate lines.
250 * Don't put assignments in 'if/while/etc' expressions except for loops,
251   for example ``for (int i = 0; i < some_limit; i++)``.
252 * if statements without brace bodies should have the code on a separate
253   line, then a blank line afterwards.
254 * Use braces after if/while statements if the body uses another
255   if/while statement.
256 * Try to fit in with the existing code style.
258 .. note::
259     A few of the above can be done with the Git
260     ``scripts/fix-alignment.pl``, but it is quite dumb and it's much better
261     to write it correctly in the first place.
262     ``scripts/rstrip-whitespace.py`` just removes trailing whitespace.
265 .. below tabs should be used, but spaces are required for reST.
267 Example::
269     struct Bar;
271     typedef struct Foo  /* struct names normally are the same as typedef names */
272     {
273         gint    foo;    /* names are somewhat aligned visually */
274         gint    bar;    /* fields don't share the same line */
275         SomeLongTypeName baz; /* alignment is not strict */
276         gchar   *ptr;   /* pointer symbol must go next to variable name, not type */
277         Bar     public; /**< only plugin API fields have a doc-comment */
278     }
279     Foo;
282     gint some_func(void);
284     gint some_other_func(void);
287     /* optional function comment explains something important */
288     gint function_long_name(gchar arg1, <too many args to fit on this line>,
289             gchar argN)
290     {
291         /* variable declarations always go before code in each scope */
292         /* variable names should NOT be aligned at all */
293         gint foo, bar;  /* variables can go on the same line */
294         gint baz;       /* but often don't */
295         gchar *ptr;     /* pointer symbol must go next to variable name, not type */
296         gchar *another; /* pointers should normally go on separate lines */
298         /* Some long comment block
299          * taking several different
300          * lines to explain */
301         if (foo)
302         {
303             /* variables only used in one scope should normally be declared there */
304             gint dir = -1;
306             bar = foo;
307             if ((bar & (guint)dir) != 7)
308                 some_code(arg1, <too many args to fit on this line>,
309                     argN - 1, argN);
311             some_func();
312         }
313     }
316     /** Explains using doc-comments for plugin API functions.
317      * First line should be short and use the third person tense - 'explains',
318      * not 'explain'.
319      *
320      * @return Some number.
321      * @since 1.22. */
322     gint another_function(void)
323     {
324         ...
326 Header Includes
327 ---------------
329 In order to make including various headers in Geany more convenient, each
330 file should include what it uses. If there is a file named ``foo.c``, and a
331 file named ``foo.h``, it should be possible to include ``foo.h`` on its own
332 without depending on stuff in ``foo.c`` that is included for the first time
333 before ``foo.h``.
335 Private Headers
336 ^^^^^^^^^^^^^^^
338 If there is some data that needs to be shared between various parts of the
339 core code, put them in a "private header", that is, if the public header is
340 called ``foo.h``, then make a ``fooprivate.h`` header that contains the
341 non-public functions, types, globals, etc that are needed. Other core source
342 files can then just include the ``foo.h`` and/or ``fooprivate.h`` depending
343 what they need, without exposing that stuff to plugins.
345 Order of Includes
346 ^^^^^^^^^^^^^^^^^
348 Inside a source file the includes section should be ordered like this:
350 1. Always include the ``config.h`` file at the start of every source file,
351    for example::
353     #ifdef HAVE_CONFIG_H
354     # include "config.h"
355     #endif
357    This allows the Autotools and other build systems use the ``./configure``
358    time settings. If you don't do this, there's likely to be a number of
359    macros that you'll have to define in the build system or custom headers.
361    Warning: Never include ``config.h`` in headers, and especially in "public"
362    headers that plugins might include.
364 2. Then include the header that has the same name as the source file (if
365    applicable). For example, for a source file named ``foo.c``, include
366    the ``foo.h`` below the ``config.h`` include. If there is a
367    ``fooprivate.h``, ``foo.c`` will most likely want to include that too,
368    put it in with includes in #3.
370 3. At this point, it should be safe to include all the headers that declare
371    whatever is needed. If everything generally "includes what it uses" and
372    all files included contain the appropriate multiple-declaration guards
373    then the order of includes is fairly arbitrary. Prefer to use English
374    alphabetic order if possible.
376 4. By now it doesn't really matter about the order, nothing below here is
377    "our problem". Semi-arbitrarily, you should use an include order like this:
379     1. Standard C headers
380     2. Non-standard system headers (eg. ``windows.h`` or ``unistd.h``)
381     3. GLib/GTK+ or related headers
383 5. Everything else that should not influence 1-4.
385 Including in Header Files
386 ^^^^^^^^^^^^^^^^^^^^^^^^^
388 Headers should also include what they use. All of the types should defined in
389 order to allow the header to be included stand-alone. For example, if a
390 header uses a ``GtkWidget*``, it should ``#include <gtk/gtk.h>``. Or, if a
391 headers uses a ``GPtrArray*``, it should ``#include <glib.h>`` to ensure that
392 all of the types are declared, whether by pointers/opaquely or fully, as
393 required. Since all headers will use a ``G_BEGIN_DECLS`` and ``G_END_DECLS``
394 guard for C++, the bare minimum for a header is to include ``glib.h`` or
395 ``<gtk/gtk.h>`` or ``gtkcompat.h`` or some other header that makes those
396 macros available.
399 Committing
400 ----------
402 * Commit one thing at a time, do small commits.  Commits should be
403   meaningful and not too big when possible; multiple small commits are
404   good if there is no good reason to group them.
405 * Use meaningful name and email in the Author and Committer fields.
406   This helps knowing who did what and allows to contact the author if
407   there is a good reason to do so (unlikely, but can happen).
408 * When working on a new feature, create a new branch for it.  When
409   merging it, use the --no-ff option to make sure a merge commit will
410   be created to better track what happened.  However, if the feature
411   only took one commit you might merge it fast-forward since there is
412   not history to keep together.
414 Commit messages
415 ^^^^^^^^^^^^^^^
416 Follow the standard Git formatting:
418 * No line should use more than about 80 characters (around 72 is best).
419 * The first line is the commit's summary and is followed by an empty
420   line.  This summary should be one line and one line only, thus less
421   than 80 characters.  This summary should not include any punctuation
422   unless really needed.  See it as the subject of an email: keep it
423   concise and as precise as you can, but not tool long.
424 * Following lines are optional detailed commit information, with
425   paragraphs separated by blank lines.  This part should be as long as
426   needed to describe the commit in depth, should use proper
427   punctuation and should include any useful information, like the
428   motivation for the patch and/or any valuable details the diff itself
429   don't provide or don't make clear.  Make it as complete as you think
430   it makes sense, but don't include an information that is better
431   explained by the commit's diff.
433   It is OK to use ASCII formatting like bullet list using "*" or "-",
434   etc. if useful, but emphasis (bold, italic, underline) should be
435   avoided.
437 Example::
439     Ask the user if spawn fails in utils_open_browser()
441     Ask the user to configure a valid browser command if spawning it
442     fails rather than falling back to some arbitrary hardcoded defaults.
444     This avoid spawning an unexpected browser when the configured one is
445     wrong, and gives the user a chance to correctly fix the preference.
448 Testing
449 -------
450 * Run with ``-v`` to print any debug messages.
451 * You can use a second instance (``geany -i``).
452 * To check first-run behaviour, use an alternate config directory by
453   passing ``-c some_dir`` (but make sure the directory is clean first).
454 * For debugging tips, see `GDB`_.
456 Bugs to watch out for
457 ---------------------
458 * Forgetting to check *doc->is_valid* when looping through
459   *documents_array* - instead use *foreach_document()*.
460 * Inserting fields into structs in the plugin API instead of appending.
461 * Not breaking the plugin ABI when necessary.
462 * Using an idle callback that doesn't check main_status.quitting.
463 * Forgetting to call vStringTerminate in CTags code.
464 * Forgetting CRLF line endings on Windows.
465 * Not handling Tabs & Spaces indent mode.
467 Libraries
468 ---------
469 We try to use an unmodified version of Scintilla - any new lexers or
470 other changes should be passed on to the maintainers at
471 http://scintilla.org. We normally update to a new Scintilla release
472 shortly after one is made. See also scintilla/README.
474 Tagmanager was originally taken from Anjuta 1.2.2, and parts of it
475 (notably c.c) have been merged from later versions of Anjuta and
476 CTags. The independent Tagmanager library itself ceased development
477 before Geany was started. It's source code parsing is mostly taken from
478 Exuberant CTags (see http://ctags.sf.net). If appropriate it's good to
479 pass language parser changes back to the CTags project.
482 Notes
483 =====
484 Some of these notes below are brief (or maybe incomplete) - please
485 contact the geany-devel mailing list for more information.
487 Using pre-defined autotools values
488 ----------------------------------
489 When you are use macros supplied by the autotools like GEANY_PREFIX,
490 GEANY_LIBDIR, GEANY_DATADIR and GEANY_LOCALEDIR be aware that these
491 might not be static strings when Geany is configured with
492 --enable-binreloc. Then these macros will be replaced by function calls
493 (in src/prefix.h). So, don't use anything like
494 printf("Prefix: " GEANY_PREFIX); but instead use
495 printf("Prefix: %s", GEANY_PREFIX);
497 Adding a source file foo.[hc] in src/ or plugins/
498 -------------------------------------------------
499 * Add foo.c, foo.h to SRCS in path/Makefile.am.
500 * Add foo.o to OBJS in path/makefile.win32.
501 * Add path/foo.c to po/POTFILES.in (for string translation).
503 Adding a filetype
504 -----------------
505 You can add a filetype without syntax highlighting or tag parsing, but
506 check to see if those features have been written in upstream projects
507 first (scintilla or ctags).
509 **Custom:**
511 If you want to reuse an existing lexer and/or tag parser, making a
512 custom filetype is probably easier - it doesn't require any
513 changes to the source code. Follow instructions in the manual:
514 http://geany.org/manual/index.html#custom-filetypes. Don't forget to
515 update the ``[Groups]`` section in ``filetype_extensions.conf``.
517 .. warning::
518   You should use the newer `[build-menu]` section for default build
519   commands - the older `[build_settings]` may not work correctly for
520   custom filetypes.
522 **Built-in:**
524 * Add GEANY_FILETYPES_FOO to filetypes.h.
525 * Initialize GEANY_FILETYPES_FOO in init_builtin_filetypes() of
526   filetypes.c.
527 * Update data/filetype_extensions.conf.
529 The remaining notes relate mostly to built-in filetypes.
531 filetypes.* configuration file
532 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
533 All languages need a data/filetypes.foo configuration file. See
534 the "Filetype definition files" section in the manual and/or
535 data/filetypes.c for an example.
537 Programming languages should have:
539 * [keywords] if the lexer supports it.
540 * [settings] mostly for comment settings.
541 * [build-menu] (or [build_settings]) for commands to run.
543 For languages with a Scintilla lexer, there should be a [styling] section,
544 to correspond to the styles used in highlighting_styles_FOO[] in
545 highlightingmappings.h - see below.
547 Don't forget to add the newly created filetype file to data/Makefile.am.
549 Syntax highlighting
550 ^^^^^^^^^^^^^^^^^^^
551 It may be possible to use an existing Scintilla lexer in the scintilla/
552 subdirectory - if not, you will need to find (or write) one,
553 LexFoo.cxx. Try the official Scintilla project first.
555 .. warning::
556     We won't accept adding a lexer that conflicts with one in
557     Scintilla. All new lexers should be submitted back to the Scintilla
558     project to save duplication of work.
560 When adding a lexer, update:
562 * scintilla/Makefile.am
563 * scintilla/makefile.win32
564 * scintilla/src/Catalogue.cxx - add a LINK_LEXER command *manually*
566 For syntax highlighting, you will need to edit highlighting.c and
567 highlightingmappings.h and add the following things:
569 1. In highlightingmappings.h:
571    a. define ``highlighting_lexer_FOO`` to the Scintilla lexer ID for
572       this filtype, e.g. ``SCLEX_CPP``.
573    b. define the ``highlighting_styles_FOO`` array that maps Scintilla
574       style states to style names in the configuration file.
575    c. define ``highlighting_keywords_FOO`` to ``EMPTY_KEYWORDS`` if the
576       filtype has no keywords, or as an ``HLKeyword`` array mapping
577       the Scintilla keyword IDs to names in the configuration file.
578    d. define ``highlighting_properties_FOO`` to ``EMPTY_PROPERTIES``, or
579       as an array of ``HLProperty`` if the filetype requires some lexer
580       properties to be set.  However, note that properties should
581       normally be set in the ``[lexer_properties]`` section of the
582       configuration file instead.
584    You may look at other filtype's definitions for some examples
585    (Ada, CSS or Diff being good examples).
587 2. In highlighting.c:
589    a. Add ``init_styleset_case(FOO);`` in ``highlighting_init_styles()``.
590    b. Add ``styleset_case(FOO);`` in ``highlighting_set_styles()``.
592 3. Write data/filetypes.foo configuration file [styling] section. See
593    the manual and see data/filetypes.d for a named style example.
595 .. note::
596     Please try to make your styles fit in with the other filetypes'
597     default colors, and to use named styles where possible (e.g.
598     "commentline=comment"). Filetypes that share a lexer should have
599     the same colors. If not using named styles, leave the background color
600     empty to match the default color.
602 Error message parsing
603 ^^^^^^^^^^^^^^^^^^^^^
604 New-style error message parsing is done with an extended GNU-style regex
605 stored in the filetypes.foo file - see the [build_settings] information
606 in the manual for details.
608 Old-style error message parsing is done in
609 msgwin_parse_compiler_error_line() of msgwindow.c - see the ParseData
610 typedef for more information.
612 Other features
613 ^^^^^^^^^^^^^^
614 If the lexer has comment styles, you should add them in
615 highlighting_is_comment_style(). You should also update
616 highlighting_is_string_style() for string/character styles. For now,
617 this prevents calltips and autocompletion when typing in a comment
618 (but it can still be forced by the user).
620 For brace indentation, update lexer_has_braces() in editor.c;
621 indentation after ':' is done from on_new_line_added().
623 If the Scintilla lexer supports user type keyword highlighting (e.g.
624 SCLEX_CPP), update document_update_tags() in document.c.
626 Adding a TagManager parser
627 ^^^^^^^^^^^^^^^^^^^^^^^^^^
628 This assumes the filetype for Geany already exists.
630 First write or find a CTags compatible parser, foo.c. Check this fork:
631 https://github.com/fishman/ctags
633 There may be some unmerged language patches for CTags at:
634 http://sf.net/projects/ctags - see the tracker.
636 (You can also try the Anjuta project's anjuta-tags codebase.)
638 .. note::
639     From Geany 1.22 GLib's GRegex engine is used instead of POSIX
640     regex, unlike CTags. It should be close enough to POSIX to work
641     OK.
642     We no longer support regex parsers with the "b" regex flag
643     option set and Geany will print debug warnings if it's used.
644     CTags supports it but doesn't currently (2011) include any
645     parsers that use it. It should be easy to convert to extended
646     regex syntax anyway.
648 Method
649 ``````
650 * Add foo.c to SRCS in Makefile.am.
651 * Add foo.o to OBJS in makefile.win32.
652 * Add Foo to parsers.h
653 * Add TM_PARSER_FOO to tagmanager/src/tm_parser.h.  The list here must follow
654   exactly the order in parsers.h.
656 In foo.c:
657 Edit FooKinds 3rd column to match a s_tag_type_names string in tm_tag.c.
658 (You may want to make the symbols.c change before doing this).
660 In filetypes.c, init_builtin_filetypes():
661 Set the 2nd argument of the FT_INIT() macro for this filetype to FOO.
663 In symbols.c:
664 Unless your parser uses C-like tag type kinds, update
665 add_top_level_items() for foo, calling tag_list_add_groups(). See
666 get_tag_type_iter() for which tv_iters fields to use.
668 Tests
669 `````
670 The tag parser tests checks if the proper tags are emitted
671 for a given source. Tests for tag parsers consist of two files: the
672 source to parse, and the expected output. Tests are run using ``make
673 check``.
675 The source to parse should be in the file ``tests/ctags/mytest.ext``,
676 where ``mytest`` is the name you choose for your test, and ``ext`` is an
677 extension recognized by Geany as the language the test file is for.
678 This file should contain a snippet of the language to test for.
679 It can be either long or short, depending on what it tests.
681 The expected output should be in the file ``tests/ctags/mytest.ext.tags``
682 (which is the same name as the source, but with ``.tags`` appended), and
683 should be in the format generated by ``geany -g``. This file contains
684 the tag information expected to be generated from the corresponding
685 source file.
687 When you have these two files, you have to list your new test along the
688 other ones in the ``test_source`` variable in ``tests/ctags/Makefile.am``.
689 Please keep this list sorted alphabetically.
691 Upgrading Scintilla
692 -------------------
694 To upgrade the local Scintilla copy, use the ``scripts/update-scintilla.sh``
695 script.
697 To use it, you need to first obtain a copy of the Scintilla sources you want
698 to update to.  This will generally mean checking out a release tag from the
699 Scintilla Mercurial repository, or extracting a tarball.
701 Then, just run the script from Geany's to source directory passing the path
702 to the Scintilla source directory as first argument, and follow the
703 instructions, if any::
705     ./scripts/update-scintilla.sh /path/to/scintilla/
710 Stop on warnings
711 ^^^^^^^^^^^^^^^^
712 When a GLib or GTK warning is printed, often you want to get a
713 backtrace to find out what code caused them. You can do that with the
714 ``--g-fatal-warnings`` argument, which will abort Geany on the first
715 warning it receives.
717 But for ordinary testing, you don't always want your editor to abort
718 just because of a warning - use::
720     (gdb) b handler_log if level <= G_LOG_LEVEL_WARNING
723 Running with batch commands
724 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
725 Use::
727     $ gdb src/geany -x gdb-commands
729 Where ``gdb-commands`` is a file with the following lines::
731     set pagination off
732     b handler_log if level <= G_LOG_LEVEL_WARNING
733     r -v
736 Loading a plugin
737 ^^^^^^^^^^^^^^^^
738 This is useful so you can load plugins without installing them first.
739 Alternatively you can use a symlink in ~/.config/geany/plugins or
740 $prefix/lib/geany (where $prefix is /usr/local by default).
742 The gdb session below was run from the toplevel Geany source directory.
743 Start normally with e.g. "gdb src/geany".
744 Type 'r' to run.
745 Press Ctrl-C from the gdb window to interrupt program execution.
747 Example::
749     Program received signal SIGINT, Interrupt.
750     0x00d16402 in __kernel_vsyscall ()
751     (gdb) call plugin_new("./plugins/.libs/demoplugin.so")
752     ** INFO: Loaded:   ./plugins/.libs/demoplugin.so (Demo)
753     $1 = (Plugin *) 0x905a890
754     (gdb) c
755     Continuing.
757     Program received signal SIGINT, Interrupt.
758     0x00d16402 in __kernel_vsyscall ()
759     (gdb) call plugin_free(0x905a890)
760     ** INFO: Unloaded: ./plugins/.libs/demoplugin.so
761     (gdb) c
762     Continuing.
764 Building Plugins
765 ^^^^^^^^^^^^^^^^
767 The geany-plugins autotools script automatically detects the
768 installed system Geany and builds the plugins against that.
770 To use plugins with a development version of Geany built with
771 a different prefix, the plugins will need to be compiled against
772 that version if the ABI has changed.
774 To do this you need to specify both --prefix and --with-geany-libdir
775 to the plugin configure.  Normally the plugin prefix is the
776 same as the Geany prefix to keep plugins with the version of Geany
777 that they are compiled against, and with-geany-libdir is the Geany
778 prefix/lib.
780 Whilst it is possible for the plugin prefix to be different to
781 the prefix of the libdir (which is why there are two settings),
782 it is probably better to keep the version of Geany and its plugins
783 together.