Which file saving method are you using? Atomic file saving creates a new file and renames it over the old one, so it gets the new-file permissions of the directory, see [here](https://wiki.geany.org/config/all_you_never_wanted_to_know_about_file_saving) for more info.