custom pre/pos save actions?

Asked by Cesar Canassa on 2011-01-24

I would like to automatically execute some commands before every file save, e.g.: converting tabs to spaces or removing trailing spaces.

Is this possible in Scribes?

Cesar Cananassa

Question information

English Edit question
Scribes Edit question
No assignee Edit question
Last query:
Last reply:
Mystilleef (mystilleef) said : #1

It's possible to write a plugin that does that.

You just connect to the "save-file" and "saved-file" signals
and perform those operations in callbacks to those signals.

However those operations are expensive and block the GUI.
This means it will slow things down A LOT. The effects are
worse for large files. So I don't recommend it.

I'm thinking of removing trailing spaces by default on all
files. Some users have requested it in the past.

Also instead of converting tabs to spaces repeatedly, why
not just use spaces for indentation?

Cesar Canassa (cesar-canassa) said : #2

Thanks for the answer, removing trailing spaces by default would be very useful indeed. But if you decide to include that option, please make sure to include a checkbox to disable it too.

One final question: Is there any documentation/examples on writing plugins for Scribes?


Mystilleef (mystilleef) said : #3

There's a brief tutorial on how to write plugins here.

You might want to subscribe to this bug regarding trailing spaces.

Can you help with this problem?

Provide an answer of your own, or ask Cesar Canassa for more information if necessary.

To post a message you must log in.