[Geany-Devel] Latex Plugin Build Commands

Lex Trotman elextr at xxxxx
Thu Aug 1 23:50:20 UTC 2013


Hi Frank,

Yes it should be possible to do what you want without any changes to Geany,
basically doing what you proposed on IRC.

Detailed algorithm: [n] refers to tl;dr notes at the end

1) Your plugin keeps a list of GeanyDocument pointers that have % master
and the master file path [1]

2) On plugin start, "document-open" signal, "document-reload" signal,
"document-save" signal search tex documents for %master [2] and store them
in the list % master or remove them from the list if they no longer have %
master in them.

3) On "document-close" signal remove the document from the list if its
present.

4) On "document-activate" signal or after updating the list at step 2, if
the current document filetype is latex check if it is in the list [3] and
set the command using:

    build_set_menu_item( GEANY_BCS_FT, GEANY_GBG_FT, 0 or 1,
               GEANY_BC_COMMAND, string) [4]

You may also wish to also set the menu text to alert the user to your
changes? just replace GEANY_BC_COMMAND with GEANY_BC_LABEL.

Cheers
Lex

[1] I assume the master file can be anything, not just master.tex
[2] These are slow operations anyway so the search won't affect them
significantly.  Use sci_findtext should be ok, limited to whichever lines
you want.
[3] searching a short list (say a few tens) of pointers should be fast, if
you have hundreds of subdocuments open at once use a g_tree or g_hash keyed
by the GeanyDocument pointer.
[4] GEANY_BCS_FT is the system filetype file value which is never written
out so your command can never be saved accidentally and user entered
commands will correctly override it. 0 is latex -> dvi command and 1 is
latex -> pdf command.  You can construct the "string" to be whatever you
need for an individual document or the master document.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130802/d540b467/attachment.html>


More information about the Devel mailing list