Bug 105459 - [PATCH] switch to Read Only Mode for files that are read only
Summary: [PATCH] switch to Read Only Mode for files that are read only
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: part (other bugs)
Version First Reported In: 4.0
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 111493 154896 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-05-11 14:34 UTC by Volker Kaiser
Modified: 2022-08-17 21:35 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch for the wish above mentioned.. (1.03 KB, patch)
2008-12-04 18:18 UTC, Krishna Bharadwaj
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Kaiser 2005-05-11 14:34:15 UTC
Version:           3.2 (using KDE KDE 3.4.0)
Installed from:    Compiled From Sources
Compiler:          gcc-3.2.3 
OS:                Linux

IMHO it would make sense if the "Tools -> Read Only Mode" gets activated when opening a file that is in fact read only. Otherwise it is possible that you first realize the write protection after 15 minutes of precious work. 

There are certainly some users out there who would like that kind of self-protection :-)

This behavior should at least be configurable.
Comment 1 Andreas Pakulat 2008-06-29 23:07:50 UTC
this should be done by kate in fact.
Comment 2 Krishna Bharadwaj 2008-12-04 18:18:56 UTC
Created attachment 29039 [details]
Patch for the wish above mentioned.. 

Checks a file for write permission and warns the user if it is not writable. It locks the editor in read only mode. The user can unlock it from the Tools Menu.
Comment 3 Dominik Haumann 2011-06-29 15:59:22 UTC
*** Bug 154896 has been marked as a duplicate of this bug. ***
Comment 4 Dominik Haumann 2011-06-29 21:15:09 UTC
*** Bug 111493 has been marked as a duplicate of this bug. ***
Comment 5 Christoph Cullmann 2011-08-12 09:33:55 UTC
I dislike that a lot. Normally, I want to type stuff and if it is read-only, I can still change where to save the file or make it read-write per konsole/save-dialog. This is just annoying behaviour if kate doesn't allow to type only because you can't save the file there.
Comment 6 Roc Vallès 2022-08-15 19:40:18 UTC
This annoyed me today (17 years later).

If it can't just be the default, please at least consider making it a setting.
Comment 7 Waqar Ahmed 2022-08-17 20:21:44 UTC
I don't think this is likely to get fixed. 

The argument that you realize some time later that the file is read only is not true. The work is not lost, you can still save it in many ways including copy pasting and save as etc.

Further more, it will likely clash with the feature where we ask the user for password on Save if the file is read only.

Thus I think we can close this.
Comment 8 Christoph Cullmann 2022-08-17 20:58:28 UTC
Yeah, I am not sure how helpful this is, either.
You can save the file with a different file name, you can just want to type stuff there and not even save ever.
To auto make such files read-only will just be extra effort for a lot of people that then need to make it read-write again.
Comment 9 Roc Vallès 2022-08-17 21:05:30 UTC
> The argument that you realize some time later that the file is read only is
> not true. The work is not lost, you can still save it in many ways including
> copy pasting and save as etc.

The patch does something unnecessary (loud warning about read-only). This is not what is being asked for. The important part of the patch is the part that enables read-only mode for read-only files.

It is a matter of correct behavior. If the file is read-only, then the editor opens it in read-only mode, and this can be overridden as needed. Dealing with read-only headers and read-only documentation gets very tiring as they get unintentionally edited simply because the editor refuses to honor read-only file permissions.

We already have a read-only mode. Editing a read-only file in the fixed scenario, where read-only mode gets auto-enabled, would be as easy as disabling read-only mode. And we would still be able to save these files, the same way we already do.

It is not by chance this bug has so many duplicates: This is the expected behavior.
Comment 10 Christoph Cullmann 2022-08-17 21:14:15 UTC
(In reply to Roc Vallès from comment #9)
> > The argument that you realize some time later that the file is read only is
> > not true. The work is not lost, you can still save it in many ways including
> > copy pasting and save as etc.
> 
> The patch does something unnecessary (loud warning about read-only). This is
> not what is being asked for. The important part of the patch is the part
> that enables read-only mode for read-only files.
> 
> It is a matter of correct behavior. If the file is read-only, then the
> editor opens it in read-only mode, and this can be overridden as needed.
> Dealing with read-only headers and read-only documentation gets very tiring
> as they get unintentionally edited simply because the editor refuses to
> honor read-only file permissions.
> 
> We already have a read-only mode. Editing a read-only file in the fixed
> scenario, where read-only mode gets auto-enabled, would be as easy as
> disabling read-only mode. And we would still be able to save these files,
> the same way we already do.
> 
> It is not by chance this bug has so many duplicates: This is the expected
> behavior.

As said, it creates additional work for people that want to edit the files, even without a warning.
Without any hint, it will even be more confusing.
Why shall I not write into that buffer?

And no, it is not expected behavior.

Other editors like "Visual Studio Code" behave exactly like we do.

Naturally not all behave that way, Emacs for example seems to go to some read-only mode.

But if I want to follow an example, then rather that of a modern GUI editor.
Comment 11 Roc Vallès 2022-08-17 21:26:19 UTC
> Without any hint, it will even be more confusing.
> Why shall I not write into that buffer?

All I am reading is that adding such a hint would resolve any possible confusion.

Which is, in any event, a separate issue.

Read-only mode does already exist, so this issue does already exist. It would just become more prominent as we'd see read-only mode enabled more often.

That's about it from me; Annoying as this issue is, it is not a hill worth dying on.
Comment 12 Christoph Cullmann 2022-08-17 21:35:13 UTC
(In reply to Roc Vallès from comment #11)
> > Without any hint, it will even be more confusing.
> > Why shall I not write into that buffer?
> 
> All I am reading is that adding such a hint would resolve any possible
> confusion.
> 
> Which is, in any event, a separate issue.
> 
> Read-only mode does already exist, so this issue does already exist. It
> would just become more prominent as we'd see read-only mode enabled more
> often.
> 
> That's about it from me; Annoying as this issue is, it is not a hill worth
> dying on.

Yeah, we have read-only mode, but actually more or less only because that was required to be an read-only component.

We use that normally nowhere automatically.

And as said, the current behavior is consistent with what other popular editors do, therefore I fail to see why we should alter this.