[Geany] A read-only command line option

Thomas Martitz thomas.martitz at xxxxx
Thu Nov 3 21:42:42 UTC 2011

Am 06.03.2010 12:15, schrieb LUK ShunTim:
> Enrico Tröger wrote:
>> On Thu, 4 Mar 2010 12:47:35 +1100, Lex wrote:
>> Hi,
>>> I'd suggest the simplest solutions,
>>> --readonly applies to all files on the command line irrespective of
>>> positioning and has no effect on any other files opened by session or
>>> menu. This answers 1,2,3,4 (Note POSIX says it must be before any
>>> files but GNU allows anywhere)
>>> Current behaviour on attempting to re-open a file with different
>>> read-only status is that nothing happens, the already open file is
>>> raised but not changed.  I would leave this as is irrespective of
>>> method of second opening (cli or menu)
>>> This answers 5,6.
>> I complete second this suggestion, not only because it would be simple
>> to implement but also because it is simple to understand and so use.
>> If there are no major objections, I'll implement this in the near
>> future (whatever this means in terms of my limited spare time). Of
>> course, if anyone is faster than me and posts a patch, that'd be much
>> appreciated :).
>> Regards,
>> Enrico
> It'd be a nice-to-have, convenient enhancement. No hurry. Please take
> your time.

As I need it myself now, I implemented it. It was indeed relatively easy 
to do. I've done it in the exact way as Lex suggested. You can find the 
according pull request here: https://github.com/geany/geany/pull/11

Please feel free to comment, I hope I did it correctly. It seems to work 
fine for me.

I didn't update the manual because I don't know how to do it.

On a related note: IMO the behavor of 5/6 should be changed in a 
separate patch. Especially if you open from the command line, but also 
with the file browser, you may get unwanted behavior (even data loss in 
the extreme case) if you opened a file in read-only mode but it didn't 
do it because it was already opened (I would switch to readonly for 
non-readonly files, but not the other way around, i.e. play safe).

Best regards.

More information about the Users mailing list