フォーラム: ヘルプ (スレッド #21732)

a before-save hook in easypg? (2009-02-18 20:14 by melagin #41966)

Dear developers,

I am using easypg to encrypt my diary. I edit the diary in the longlines-mode so no hard newlines are inserted. However, after saving the file and loading it back hard newlines appear where they are not supposed to.

I think the way to go is to disable line wrapping by the longlines mode just before saving and reenable it back afterwards. However, I failed to find a suitable hook in easypg. Is there one?

If not, I think it would be great to have one in the next version :)

Thanks in advance
Mstislav

RE: a before-save hook in easypg? (2009-02-18 21:53 by melagin #41970)

well, I decided to scratch my own itch. Here is the patch against epg 0.0.16

67,72d66
< (defcustom epa-save-before-hook nil ""
< :group 'epa-file :type 'hook)
<
< (defcustom epa-save-after-hook nil ""
< :group 'epa-file :type 'hook)
<
240d233
< (run-hooks 'epa-save-before-hook)
279,280c272
< (message "Wrote %s" buffer-file-name)))
< (run-hooks 'epa-save-after-hook))
---
> (message "Wrote %s" buffer-file-name))))

This is necessary, since epg uses write-region and not save-buffer, thus circumventing standard hooks.

Greetings
Mstislav
#41966 への返信