[Geany-devel] Patches required by gproject

Jiří Techet techet at xxxxx
Sun Jun 20 15:24:48 UTC 2010

On Fri, Jun 18, 2010 at 13:26, Nick Treleaven
<nick.treleaven at btinternet.com> wrote:
> On Thu, 17 Jun 2010 22:56:06 +0200
> Jiří Techet <techet at gmail.com> wrote:
>> >> [PATCH 1/3] Add a signal that is emitted before build starts
>> I want to be able to save all project files before the build starts.
>> Currently geany saves only the active file but does nothing with the
>> other open files, so you may be compiling the old version. I think
>> emitting the signal before build might be useful for other plugins too
>> (e.g. if they pre-process the files before the build and so on)
> OK, I'll add the signal.
>> >> [PATCH 2/3] Make it possible to fill some fields of find in files dialog by plugins
>> There are two fields that I find it useful to pre-set in the find in
>> files dialog:
>> * the path - my plugin displays a project file tree in the sidebar and
>> right-clicking a folder and selecting "find in directory" pre-fills
>> the directory in the dialog for the user. This saves a lot of time
>> especially when the directory structure is deep.
> (The File Browser also does this).

I know, I just needed a function that sets both of them.

>> * extra options - in my plugin the project files are defined by a set
>> of patterns, so by providing a base path and patterns like
>> *.c;*.h;*.am he defines the files he'll see in the sidebar and that
>> are "inside" the project. Search in project files applies only to
>> these files (and for big projects you really don't want to search *.o
>> and others) so you need to restrict grep by something like
>> --include=*.c --include=*.h --include=*.am
>> Unfortunately the more file types you have, the more typing it
>> involves so the plugin does this for you.
> I like the idea, but I'd rather not allow plugins to override the
> 'extra options' field - this is a user setting.
> I think this feature could be part of Geany - we already have a
> (currently unused & hidden) 'patterns' field which is meant to hold
> something like "*.c;*.h;*.am".
> Then we could add a FIF dialog checkbox 'Use project patterns'. That
> also allows the user to still do normal searches outside the project.
> That option would also be useful to search files with no extension -
> README, ChangeLog, NEWS, etc without having to add all those filenames
> to the pattern.

Yes, my patch was a quick hack how to introduce the functionality into
geany without changing much of the code.

I like your idea in general, the only thing I don't like about it is
that you wouldn't see the patterns in the FIF dialog, which would make
it a bit unclear what you are searching for. I would propose to have a
"file types" edit box that would be editable by the user even if no
project is opened - this makes sense because users might want to
search for restricted set of files even if they don't use any project.
By default the pattern could be * to search in every file like now
(empty edit box should do the same too). Then there would be the 'Use
project patterns' you propose (not active when no project is open).
When checked, the "file types" edit box would become inactive but
filled with the project patterns so it would be visible directly in
the dialog what the user is searching for. What do you think about it?

>> I can imagine that other plugins might find it useful to change the
>> "search for" field and that the "extra options" checkbox might be also
>> plugin-settable so I could add those too if you wish.
> I'd prefer to only add things when there is a good use case for them.
>> >> [PATCH 3/3] Open files from msgwindow even if find_in_files_dir is not set
>> Currently if you want to open a file by double clicking the filename
>> in the msgwindow (e.g. after searching in files), the file is opened
>> only after the project had been opened for the first time (subsequent
>> closing the project doesn't matter). The reason is that
>> find_in_files_dir is initialized to NULL and only set when you open a
>> project and if the project is not open because
>> msgwin_parse_grep_line() stops on
>>       if (string == NULL || msgwindow.find_in_files_dir == NULL)
>>               return;
>> even though it might try to find the file when the provided path is
>> absolute. I don't see any reason in this behaviour and the patch is
>> pretty trivial.
> I think the bug might be that msgwindow.find_in_files_dir
> somewhere didn't get set - I'll look into it.

It's not a bug that msgwindow.find_in_files_dir is not set - I think
it's correct that it's not set before you open a project. The problem
is that when it's not set, the file in the msgwindow doesn't open when
you click it even if there is a full path to that file (which doesn't
require the find_in_files_dir)



> Regards,
> Nick
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

More information about the Devel mailing list