Rather than flood a pull request with non-review discussion, I've created an issue here. (That seems better for me than the devel mailing list as we get notifications on replies, markup, links etc).
@elextr So GBO is for the old menu commands (before your work to make them very flexible). GeanyBuildType is a list of IDs corresponding to those commands.
However, the GBO_TO_ macros accept values >= GEANY_GBO_COUNT, so it seems the macros take something more than an old command ID. I'm not sure what those larger values would be, could you explain please?
Originally the commands were one array indexable by the enumerators, but as its now several separate groups of variable size (at startup time). The macros are intended to map the old enumerator names to the new organisation, the group and the command within that group.
I don't remember that long ago, but since C enum values are not limited to the values of the enumerators I suspect testing for out of range values was just ensuring a known return for out of range inputs.
Ref #2268 Changing the name of GBO is fine if you really want to, hardly worth it IMO.
I don't think GBO_TO_CMD actually needs to do anything.
(Execute, Project File) and (Execute, Preferences) - the project independent execute and preferences independent execute commands can only be set by hand editing the appropriate file, see Preferences file format and Project file format.
How do I do this? The manual doesn't explain or give an example.
I don't think GBO_TO_CMD actually needs to do anything.
IMHO it maps the old options to the index of the group: ``` GEANY_GBO_COMPILE --> Index 0 in group GEANY_GBG_FT GEANY_GBO_BUILD --> Index 1 in group GEANY_GBG_FT GEANY_GBO_MAKE_ALL --> Index 2 in group GEANY_GBG_FT
GEANY_GBO_CUSTOM --> Index 0 in group GEANY_GBG_NON_FT GEANY_GBO_MAKE_OBJECT --> Index 1 in group GEANY_GBG_NON_FT
GEANY_GBO_EXEC --> Index 0 in group GEANY_GBG_EXEC ```
How do I do this? The manual doesn't explain or give an example.
I think you e.g. have to edit the section in the filetypes files. E.g. find below the ```build-menu``` section from ```filetypes.c```: ``` [build-menu] # %f will be replaced by the complete filename # %e will be replaced by the filename without extension # (use only one of it at one time) FT_00_LB=_Compile FT_00_CM=gcc -Wall -c "%f" FT_00_WD= FT_01_LB=_Build FT_01_CM=gcc -Wall -o "%e" "%f" FT_01_WD= FT_02_LB=_Lint FT_02_CM=cppcheck --language=c --enable=warning,style --template=gcc "%f" FT_02_WD= EX_00_LB=_Execute EX_00_CM="./%e" EX_00_WD= ```
@larsgit223 I know how to do it for filetypes.*.
I assume I just add EX_00_CM etc to geany.conf or the project file, I'll look into it.
@LarsGit223 thanks, the macro makes sense now.
I don't think GBO_TO_CMD actually needs to do anything.
It maps from a continuous enum (GeanyBuildGroup) to an index within the separate and variable length groups of commands.
How do I do this? The manual doesn't explain or give an example.
Did you read the wiki? https://wiki.geany.org/howtos/configurebuildmenu
It was either you or Enrico that objected to making the manual section on build __even bigger__ so I wrote the Wiki article.
It was either you or Enrico that objected to making the manual section on build even bigger
It wasn't me, the manual needs to explain how to use Geany's features concisely but completely. There perhaps is too much information in the manual.
@elextr
Did you read the wiki? https://wiki.geany.org/howtos/configurebuildmenu
Which bit of that page describes the filetype-independent execute behaviour? I paged through it quickly and didn't notice anything, YMMV.
@elextr Under [here](https://wiki.geany.org/howtos/configurebuildmenu#implementation_how_flexibil...), it says:
3. settings from the user preferences file 4. settings from a user configured filetype file for the type of file selected in the editor 5. settings independent of filetype from the open project file 6. settings for a specific filetype for the type of file selected in the editor which come from the open project file
But in build.h we have this order: ```c GEANY_BCS_HOME_FT, /**< Filetypes in ~/.config/geany/filedefs */ GEANY_BCS_PREF, /**< Preferences file ~/.config/geany/geany.conf */ GEANY_BCS_PROJ_FT, /**< Project file filetype command */ GEANY_BCS_PROJ, /**< Project file if open. */ ``` The wiki and source don't match for any of these enum values. I also notice that GEANY_BCS_PROJ_FT doesn't get used for GEANY_GBG_FT in get_next_build_cmd, is that a bug?
Then it says: "in reality there are only three sources, system, user and project settings". Might it be possible to have the build sources enum just have those three sources (plus default if it can't be merged with system)?
GEANY_BCS_PROJ_FT doesn't get used for GEANY_GBG_FT in get_next_build_cmd
With #2307, I think GEANY_BCS_PROJ_FT can be removed and we just use GEANY_BCS_PROJ.
Also in get_next_build_cmd: for the filetype build group, GEANY_BCS_PREF is used for `ftp->homefilecmds`. Shouldn't that correspond to GEANY_BCS_HOME_FT, as it does in get_build_group_pointer?
Another difference: for (filetype) execute, get_next_build_cmd uses GEANY_BCS_FT for `ft->priv->homeexeccmds, but in get_build_group_pointer, GEANY_BCS_HOME_FT is used, which seems the correct source.
Quick but possibly incorrect response since I havn't the time just now to try to dig deeply into code written nearly 10 years ago. Will dig when I can, maybe next weekend.
I am not sure that the whole priority thing is extant in one piece of code and the sections of the menu select between filetype specific and filetype independent commands so they don't need priority selection (except for execute which is where GEANY_BCS_PROJ_FT is used).
"in reality there are only three sources, system, user and project settings"
Because as above, the menu distinguishes between them (except for execute).
With #2307, I think GEANY_BCS_PROJ_FT can be removed
So given above, conceptually yes might be able to, have to look at the detail of #2307 yet though. And note its in the plugin API so a period of deprecation might be appropriate.
Some of the messiness of the build stuff is trying to map the more general configuration system into the original menu system so it was retained. Adding an extra section as per #2307 will hopefully make it simpler and allow some cleanup.
Also in get_next_build_cmd: for the filetype build group, GEANY_BCS_PREF is used for ft->priv->homefilecmds. Shouldn't that correspond to GEANY_BCS_HOME_FT, as it does in get_build_group_pointer?
Depends what the caller provides, maybe we just left some existing code passing the same GEANY_BCS_PREF as it did before.
Another difference: for (filetype) execute, get_next_build_cmd uses GEANY_BCS_FT for `ft->priv->homeexeccmds, but in get_build_group_pointer, GEANY_BCS_HOME_FT is used, which seems the correct source.
Also (without having time to check in detail) be careful that project stuff both filetype and non-filetype commands load from the one file but for other sources the filetype and non-filetype loads from differing files, but both are distributed across the filetype files data structures. So it may depend on if the particular function is accessing the file locations or the in memory data structures.
github-comments@lists.geany.org