kate: set buffer read-only
J Leslie Turriff
jlturriff at mail.com
Fri May 7 21:41:08 BST 2021
On 2021-05-07 14:54:01 rhkramer at gmail.com wrote:
> On Friday, May 07, 2021 03:41:03 PM J Leslie Turriff wrote:
> > The only thing I can find for this in Kate is Menu => Tools => Read-Only
> > Mode. There is no command-line switch for this, nor can I find a DCOP
> > function that toggles the setting; so one would have to first open the
> > document, then use the Tools menu to disable writing, which seems quite
> > error-prone. :-(
> > It is, of course, possible that I've overlooked something.
> Another option, that might or might not be acceptable, would be to take
> away write permission on the underlying file -- you would still be able to
> edit the buffer, but you would not be able to save those changes.
Yes, possibly a wrapper script could simulate a --read-only switch to issue chmod
commands before and after Kate invocation. A script, perhaps
named /usr/local/bin/ro-kate, containing these basic steps
| # Remember the current privileges for the file(s) passed
| # Use chmod to turn off writability for the file(s)
| # Invoke Kate upon the file(s)
| # Restore the original privileges for the file(s)
ought to work*. Such a script could be called automagically by creating an icon for it in
one's Menu Editor.
*Input argument filtering might be desirable.
More information about the kde