[Geany-devel] [Bug] When saving a modified file, a new empty line is added

Maxime Pacary mpacary at xxxxx
Mon Dec 14 10:14:48 UTC 2009


>
> I still don't see what's the problem with simply deactiviting the feature
> if it causes troubles for you.
The problem is the *default value*. Each time a PHP developer installs 
Geany, he must keep in mind to disable this feature to avoid weird 
problems when using the *header()* function (frequent).

It would be convenient for PHP developers to have this feature disabled 
*by default*, but since it is necessary for other languages 
(http://www.linuxquestions.org/questions/programming-9/no-new-line-at-end-of-file-what-does-this-mean-281830/), 
then other users will complain about it.
I hope this helps to better understand the problem...

> A better implementation of your suggested solution would be to read the
> setting from the filetype definition files so the user can really set
> it for those filetypes he/she wants and is not limited to a hardcoded
> list.
Yep, hardcoding doesn't sounds good, and I wasn't suggesting that. I 
agree with your solution (setting the "new line at end of file" option 
in the filetype definitions), but the default value for each filetype 
will have to be very accurate in order to avoid headaches to users.

If I have some free time I may propose a patch for that during the next 
weeks.

Anyway thanks for your attention and reactivity,
Maxime


Enrico Tröger a écrit :
> On Tue, 01 Dec 2009 16:04:08 +0100, Maxime wrote:
>
>   
>> Thanks for your answers.
>>
>> I totally agree that a popup dialog for that would be ugly and
>> annoying. However, I think that this issue is quite important, since
>> enabling that feature by default can be strongly distrurbing for PHP
>> development.
>>
>>
>> After some thinking, I would suggest that :
>>
>>  - the feature "*new line at end of file*" would be a drop-down list 
>> instead of a checkbox, with options "*according to file type*" 
>> (default), "*always*", "*never*"
>>
>>  - when option "*according to file type*" is selected :
>>      - when (for example) a C/C++ file is saved, a new empty line is 
>> automatically added if necessary
>>      - when a PHP (or Javascript, CSS, HTML, SQL, XML, YML...) file
>> is 
>> saved, no new empty line is added
>>
>>  - details about file types requiring a "final empty line" or not, 
>> would be available in the manual.
>>
>>
>> This way, Geany's default behavior would be convenient for all 
>> programming languages (but user can "force" the behavior to whatever
>> he prefers), and the user wouldn't be annoyed by any warning message.
>>     
>
> IMO this is too complicated.
> Also having a hardcoded list of filetypes which use and don't use empty
> new lines at end of file, isn't much better than the current status.I
> still don't see what's the problem with simply deactiviting the feature
> if it causes troubles for you.
>
> A better implementation of your suggested solution would be to read the
> setting from the filetype definition files so the user can really set
> it for those filetypes he/she wants and is not limited to a hardcoded
> list. If anyone finds this important enough, go ahead and write a patch.
>
>
> Regards,
> Enrico
>



More information about the Devel mailing list