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?

Thanks,
Cesar Cananassa

Question information

Language:
English Edit question
Status:
Answered
For:
Scribes Edit question
Assignee:
No assignee Edit question
Last query:
2011-01-24
Last reply:
2011-01-24
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?

Thanks!

Mystilleef (mystilleef) said : #3

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

http://mystilleef.blogspot.com/2010/12/scribes-plugins-in-60-seconds.html

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

https://bugs.launchpad.net/scribes/+bug/706933

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.