Hi,
It seems there's no way to start geany to open a file in a "read-only" mode.
Would it be a lot of work to add such a command line option? Don't bother if it is. :-)
Regards, ST --
On Wed, 03 Mar 2010 16:27:35 +0800, LUK wrote:
Hi,
It seems there's no way to start geany to open a file in a "read-only" mode.
Would it be a lot of work to add such a command line option? Don't bother if it is. :-)
Adding the option itself probably wouldn't be the biggest problem. The challenge is to implement it properly. How to handle the case when the option is specified and multiple files are opened at once, should it work for the first file or for all? Should it be possible to specificy the option multiple times placing it before those filenames which should opened read-only?
Regards, Enrico
Am Mittwoch, den 03.03.2010, 21:11 +0100 schrieb Enrico Tröger:
On Wed, 03 Mar 2010 16:27:35 +0800, LUK wrote:
Hi,
It seems there's no way to start geany to open a file in a "read-only" mode.
Would it be a lot of work to add such a command line option? Don't bother if it is. :-)
Adding the option itself probably wouldn't be the biggest problem. The challenge is to implement it properly. How to handle the case when the option is specified and multiple files are opened at once, should it work for the first file or for all? Should it be possible to specificy the option multiple times placing it before those filenames which should opened read-only?
Very simple example as suggestion:
geany -ro file1.txt # opens file1.txt read-only geany -ro file1.txt file2.txt # opens both files read-only
and so on...
Regards, Dominic
Very simple example as suggestion:
geany -ro file1.txt # opens file1.txt read-only geany -ro file1.txt file2.txt # opens both files read-only
and so on...
So does 'geany file1.txt -ro file2.txt' open the first read/write the second read only?
Does 'geany -ro' make all files opened later read only? This normally opens with a blank file -- how do you save it at all?
What is the behaviour of 'geany -ro file1.txt' then later from the file menu opening file2.txt?
What about 'geany file1.txt -ro file2.txt' then from the menu open file3.txt -- status of file3?
If geany is set to open all files that were open last time, but now you expressly open one read only, and it is one of those files, what happens.
Or what about geany file*txt -ro file2.txt? -- in essence one file is specified twice on the command line. which takes precidence?
It's not clear to me what the best behaviour should be.
Respectfully,
Sherwood of Sherwood's Forests
Sherwood Botsford Sherwood's Forests -- http://Sherwoods-Forests.com 780-848-2548 50042 Range Rd 31 Warburg, Alberta T0C 2T0
On 4 March 2010 12:20, Sherwood Botsford sgbotsford@gmail.com wrote:
Very simple example as suggestion:
geany -ro file1.txt # opens file1.txt read-only geany -ro file1.txt file2.txt # opens both files read-only
and so on...
Numbered for reference
1.
So does 'geany file1.txt -ro file2.txt' open the first read/write the second read only?
Does 'geany -ro' make all files opened later read only? This normally opens with a blank file -- how do you save it at all?
What is the behaviour of 'geany -ro file1.txt' then later from the file menu opening file2.txt?
What about 'geany file1.txt -ro file2.txt' then from the menu open file3.txt -- status of file3?
If geany is set to open all files that were open last time, but now you expressly open one read only, and it is one of those files, what happens.
Or what about geany file*txt -ro file2.txt? -- in essence one file is specified twice on the command line. which takes precidence?
It's not clear to me what the best behaviour should be.
Respectfully,
Sherwood of Sherwood's Forests
Sherwood Botsford Sherwood's Forests -- http://Sherwoods-Forests.com 780-848-2548 50042 Range Rd 31 Warburg, Alberta T0C 2T0
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.
Cheers Lex
Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
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
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.
Thanks very much, ST --
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.