This is my first attempt at making hashcash.el asynchronous. It doesn't address all the ideas brought up in the discussion here, but it's a good start. User-visible changes: * New function mail-add-payment-async takes all recipients in To and CC headers and starts generating hashcash tokens for them asynchronously. * New function hashcash-cancel-async stops all asynchronous hashcash processes for the current buffer. * New function hashcash-wait-async waits for all asynchronous hashcash processes in the current buffer to finish. * New function hashcash-wait-or-cancel does one of the above depending on user input. * hashcash-default-payment and hashcash-default-accept-payment are now 20 by default, as recommended near the end of http://www.hashcash.org/dev/ . Recommended hooks: (add-hook 'message-setup-hook 'mail-add-payment-async) (add-hook 'message-send-hook 'hashcash-wait-or-cancel) Unfeatures: * Asynchronous processes are not started automatically when you enter new addresses; you have to type M-x mail-add-payment-async yourself. It seems that an idle timer, checking for point being outside of the header (to prevent tokens for halfwritten addresses) would be the solution. * Incrementally increasing the collision length while the message is being written is not implemented. Strictly speaking this is impossible, as the collision length is part of the hashed string, but this could be emulated, calculating longer and discarding shorter tokens. I'm not sure it's worth it, though. Bugs: * If you call mail-add-payment{,-async} while a token is being generated asynchronously, you will get duplicate tokens. Tokens already generated and inserted in the buffer are not duplicated, though, using hashcash-already-paid-p. Changelog: 2004-11-02 Magnus Henoch * hashcash.el (hashcash-default-payment): Change default to 20 (hashcash-default-accept-payment): Change default to 20 (hashcash-process-alist): New variable (hashcash-generate-payment-async): Add (hashcash-already-paid-p): Add (hashcash-insert-payment): Don't generate payments twice (hashcash-insert-payment-async): Add (hashcash-insert-payment-async-2): Add (hashcash-cancel-async): Add (hashcash-wait-async): Add (hashcash-processes-running-p): Add (hashcash-wait-or-cancel): Add (mail-add-payment): New optional argument. Conditionally start asynchronous calculation. (mail-add-payment-async): Add What do you think about this? Regards, Magnus