Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* delayed sending of mail
@ 2012-08-22 13:06 Kevin Brubeck Unhammer
  2012-08-22 21:00 ` Adam Sjøgren
  2012-08-22 21:01 ` Reiner Steib
  0 siblings, 2 replies; 6+ messages in thread
From: Kevin Brubeck Unhammer @ 2012-08-22 13:06 UTC (permalink / raw)
  To: info-gnus-english


[-- Attachment #1.1: Type: text/plain, Size: 1400 bytes --]

Hi, 

someone on IRC asked about how to make a function that delays sending of
email, so as to have a chance to edit/cancel within 2 minutes or so. I
came up with

  (defun message-wait-send-and-exit (&optional arg)
    "Bury the buffer and wait a bit, then send message like
  `message-send-and-exit'."
    (interactive "P")
    (let ((timeout "2 minutes")
          (buf (current-buffer)))
      (message "Sending %s in %s" buf timeout)
      (bury-buffer)
      (run-at-time timeout
  		 nil
  		 (lambda (arg buf)
  		   (when (buffer-live-p buf)
  		     (with-current-buffer buf
  		       (let ((inhibit-quit nil)) ; avoid hang if e.g. server is slow/down
  		                                 ; though this makes C-g dangerous
  			 (message-send-and-exit arg)))))
  		 arg
  		 buf)))
  
but I know it's fraught with problems (missing headers cause
interactive questions to pop up out of nowhere, a C-g at the wrong
moment will cancel sending).

Has anyone attempted something like this before? I guess to avoid the
problem of interactive questions you'd have to write your own version of
`message-send' and do the `run-at-time' there. Perhaps `with-timeout'
could be used along with inhibit-quit to avoid stray C-g's while still
not hanging on server trouble? (Or is this a much bigger project than
that?)

-- 
Kevin Brubeck Unhammer

GPG: 0x766AC60C

[-- Attachment #1.2: Type: application/pgp-signature, Size: 489 bytes --]

[-- Attachment #2: Type: text/plain, Size: 162 bytes --]

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-23 10:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22 13:06 delayed sending of mail Kevin Brubeck Unhammer
2012-08-22 21:00 ` Adam Sjøgren
2012-08-22 21:04   ` Adam Sjøgren
2012-08-23  9:04   ` Kevin Brubeck Unhammer
2012-08-23 10:25     ` Adam Sjøgren
2012-08-22 21:01 ` Reiner Steib

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).