🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99383

Suggestion to make sendmail prompt the user before sending

#99383
From: Andrew Oram
Date: Tue, 18 Sep 1990 15:21
58 lines
2966 bytes
I've made trivial changes to mail-send-and-exit and mail-send in sendmail.el,
so that accidentally pressing /C-c/C-c or /C-c/C-c will not cause mail to be
sent.  To ensure complete backward compatibility, I've even defined a flag.

Sending half-finished mail is even more irreversible (and potentially
embarrassing) than exiting emacs or gnus or doing various other things for
which you give a standard second-chance prompt.  So I am asking you to
consider making the changes I've included below in future releases.  Of
course, it would be easy for a user to redefine the functions in
mail-setup-hook, but we could save them the trouble.

Caveat: I'm the only one who's tested this, and I haven't tested for strange
errors that might abort mail-send.

------------------------------------------------------------

; User has to set in order to get new feature
(defconst mail-prompt-before-sending nil)

; Changed simply to check mail-send for return value and conditionally continue
(defun mail-send-and-exit (arg)
  "Send message like mail-send, then, if no errors, exit 
from mail buffer.  Prefix arg means don't delete this window."
  (interactive "P")
  (if (mail-send)
      (progn
	(bury-buffer (current-buffer))
	(if (and (not arg)
		 (not (one-window-p))
		 (save-excursion
		   (set-buffer (window-buffer (next-window (selected-window) 'not)))
		   (eq major-mode 'rmail-mode)))
	    (delete-window)
	  (switch-to-buffer (other-buffer (current-buffer)))))))

; Changed to prompt user and to return t or nil
(defun mail-send ()
  "Send the message in the current buffer.
If mail-prompt-before-sending is non-nil, prompt
the user to make sure the mail should be sent.
Depending on user's reply, return t or nil so that
mail-send-and-exit knows whether or not to exit.
If  mail-interactive  is non-nil, wait for success indication
or error messages, and inform user.
Otherwise any failure is reported in a message back to
the user from the mailer."
  (interactive)
  (if (or (not mail-prompt-before-sending)
	  (y-or-n-p "Do you want to send the message now? "))
      (progn
	(message "Sending...")
	(funcall send-mail-function)
	(set-buffer-modified-p nil)
	(delete-auto-save-file-if-necessary)
	(message "Sending...done")
	t)
    (message "")			;Erase "Yes or No" question.
    nil))
Technical Details
Message-ID: <9009181121.aa18198@nexus.westford.ccur.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!westford.ccur.com!andyo

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,4b4af26f6989292d,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-09-18 08:21:13 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!westford.ccur.com!andyo
From: andyo@westford.ccur.com (Andrew Oram)
Newsgroups: gnu.emacs.bug
Subject: Suggestion to make sendmail prompt the user before sending
Message-ID: <9009181121.aa18198@nexus.westford.ccur.com>
Date: 18 Sep 90 15:21:13 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 58
Posted: Tue Sep 18 16:21:13 1990