RE: Auto-save

Stefan Riha <[email protected]>
Newsgroups gmane.comp.kde.devel.kwrite
Message-ID <0102017f979a6e87-bd757ee9-c393-469c-9aa0-7e2f25029794-000000@eu-west-1.amazonses.com>
Hi!

 
Thanks for your reply! I have been trying Sven Brauch's suggestion

 
qdbus org.kde.kate-$(pidof kate) /kate/MainWindow_1/actions/file_save_all trigger

 
and it seems to work!

 
You suggested to save perdiodically every x seconds and I can write a bash script to run the qdbus command every x seconds.

 
I'm curious, would it be possible/advantageous to monitor for changed files and selectively save only those? So make it event-driven instead of periodic, i.e. wait for the creation of a *.kate-swp file and then trigger a file save on that file?

 
The reason I'm asking is because I have open files which are build artifacts (output from a cpp preprocessor or other files edited by processes other than kate). I don't know how to mark entire folders as read-only in kate, so what I currently do is

 
> chmod -R u+w /path/to/readonlyfolder

> command_which_modifies_files_in_readonlyfolder

> chmod -R u-w /path/to/readonlyfolder

 
So the files are in fact writeable by kate during a brief moment while the command runs. Ideally I would not run the save-all command during that time.

 
But I think I should first try the simplest solution and see if that problem actually arises in practice. I'll get back later when it does.

 
Thanks again for your help!

 
 
 
 
-----Original message-----
From: Waqar Ahmed
Sent: Wednesday, March 16 2022, 8:39 pm
To: [email protected]; Stefan Riha
Subject: Re: Auto-save
 Sorry, I meant to say *internal script, not external ;p
 On Thu, Mar 17, 2022, 12:31 AM Waqar Ahmed <[email protected]> wrote:
Hi, 
 I don't this is possible via our external script. However, it is doable using a plugin and is really trivial to implement I think. One just needs a timer that fires every x seconds and saves all open documents. Or alternatively it can be implemented in the editor component. 
 On Wed, Mar 16, 2022, 11:39 PM Stefan Riha <[email protected]> wrote:

Hi,

I switched from vscode a couple of months ago and I'm quite happy with kate. However, I miss is auto-save which saved me dozens of identical key presses per hour.  Given that auto-save has apparently been a feature request for a decade [1] and not implemented, I assume it will not be implemented for some time.

What I mean by 'auto-save': 

Currently I do this:

1) Edit e.g. a python script
2) Save a file with shortcut, e.g. Ctrl-s
3) Switch to a terminal and run the python script

I want to do this


1) Edit e.g. a python script
2) Switch to a terminal and run the python script

 
without having to press Ctrl-s.

 

Having no idea about kwrite/kate (or Qt and KDE in general), I can think of the following options to solve my problem:

*) Modifying the source code (difficult)
*) Writing a plugin (don't know if possible/feasible?)
*) automation via a shell script (don't know if possible/feasible?)


I'd prefer the last option (shell script). Do you think this is feasible?


Can I somehow run a background process that would trigger a save-action, e.g. in the event that a *.kate-swp file is created for that file?

 
[1] https://forum.kde.org/viewtopic.php?f=83&t=102258

 
Thanks for your help!

 
Regards, Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.