Skip to main content
1 of 2
chen bin
  • 5k
  • 21
  • 36

There is easy and generic solution.

You are actually calling message-send which calls y-or-n-p to ask you confirm.

So you want to automatically answer when being asked the question"Already sent message via mail; resend? (y or n)".

Here is code,

(defvar my-default-yes-no-answer nil
    "Usage: (setq my-default-answer '(t . \"question1 pattern\"))")
(defadvice y-or-n-p (around y-or-n-p-hack activate)
  (let* ((prompt (car (ad-get-args 0))))
    (message "prompt=%s" prompt)
    (cond
     ((and my-default-yes-no-answer
           (consp my-default-yes-no-answer )
           (string-match-p (cdr my-default-yes-no-answer) prompt))
      (setq ad-return-value (car my-default-yes-no-answer)))
     (t
      ad-do-it))))

Usage is simple. Only one liner, (setq my-default-yes-no-answer '(t . "Already sent message vial mail")).

chen bin
  • 5k
  • 21
  • 36