From: hmurata Date: Sat, 28 Jan 2006 09:03:41 +0000 (+0000) Subject: * wl-vars.el (wl-draft-send-confirm-type): New user option. X-Git-Tag: wl-2_15_3~15 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=b3084c46ef2a8c1392139a342031994f4c452917;p=elisp%2Fwanderlust.git * wl-vars.el (wl-draft-send-confirm-type): New user option. * wl-util.el (wl-y-or-n-p-with-scroll): New function. * wl-draft.el (wl-draft-send-confirm): Confirmation by `wl-draft-send-confirm-type' --- diff --git a/wl/ChangeLog b/wl/ChangeLog index 08f02c3..c462a8e 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,12 @@ +2006-01-28 Hiroya Murata + + * wl-vars.el (wl-draft-send-confirm-type): New user option. + + * wl-util.el (wl-y-or-n-p-with-scroll): New function. + + * wl-draft.el (wl-draft-send-confirm): Confirmation by + `wl-draft-send-confirm-type' + 2006-01-26 Yoichi NAKAYAMA * wl-draft.el (wl-draft-save, wl-draft-buffer-change-number): diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 855346a..c635e5e 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -1281,31 +1281,25 @@ This variable is valid when `wl-interactive-send' has non-nil value." :group 'wl-draft) (defun wl-draft-send-confirm () - (let (answer) - (unwind-protect - (condition-case nil - (progn - (when wl-draft-send-confirm-with-preview - (wl-draft-preview-message)) - (save-excursion - (goto-char (point-min)) ; to show recipients in header - (catch 'done - (while t - (discard-input) - (message "Send current draft? ") - (case (let ((cursor-in-echo-area t)) (read-char)) - ((?y ?Y) - (throw 'done t)) - ((?v ?j ?J ? ) - (ignore-errors (scroll-up))) - ((?^ ?k ?K ?) - (ignore-errors (scroll-down))) - (t - (throw 'done nil))))))) - (quit nil)) - (when (and wl-draft-send-confirm-with-preview - (eq major-mode 'mime-view-mode)) - (wl-mime-quit-preview))))) + (unwind-protect + (condition-case nil + (progn + (when wl-draft-send-confirm-with-preview + (wl-draft-preview-message)) + (save-excursion + (goto-char (point-min)) ; to show recipients in header + (funcall + (if (functionp wl-draft-send-confirm-type) + wl-draft-send-confirm-type + (lambda (prompt) + (wl-y-or-n-p-with-scroll + prompt + (eq wl-draft-send-confirm-type 'scroll-by-SPC/BS)))) + "Send current draft? "))) + (quit nil)) + (when (and wl-draft-send-confirm-with-preview + (eq major-mode 'mime-view-mode)) + (wl-mime-quit-preview)))) (defun wl-draft-send (&optional kill-when-done mes-string) "Send current draft message. diff --git a/wl/wl-util.el b/wl/wl-util.el index 3c99879..d543210 100644 --- a/wl/wl-util.el +++ b/wl/wl-util.el @@ -1099,6 +1099,28 @@ is enclosed by at least one regexp grouping construct." (setq value (prin1-to-string value))) (concat (downcase field) ":" value))))) +(defun wl-y-or-n-p-with-scroll (prompt &optional scroll-by-SPC) + (let ((prompt (concat prompt (if scroll-by-SPC + " " + " ")))) + (catch 'done + (while t + (discard-input) + (case (let ((cursor-in-echo-area t)) + (read-event prompt)) + ((?y ?Y) + (throw 'done t)) + (? + (if scroll-by-SPC + (ignore-errors (scroll-up)) + (throw 'done t))) + ((?v ?j ?J next) + (ignore-errors (scroll-up))) + ((?^ ?k ?K prior backspace) + (ignore-errors (scroll-down))) + (t + (throw 'done nil))))))) + ;; read multiple strings with completion (defun wl-completing-read-multiple-1 (prompt diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 0757fd5..b92d2ec 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -895,6 +895,16 @@ Prepared candidates are 'wl-draft-send-mail-with-smtp, (function :tag "Other")) :group 'wl-draft) +(defcustom wl-draft-send-confirm-type 'scroll-by-j/k + "*Confirmation type or function to use when send a message." + :type '(choice + (const :tag "y or n with scroll (j/k)" scroll-by-j/k) + (const :tag "y or n with scroll (SPC/BS)" scroll-by-SPC/BS) + (function-item y-or-n-p) + (function-item yes-or-no-p) + (function :tag "Other function")) + :group 'wl-draft) + (defcustom wl-draft-reply-with-argument-list '(("From" . (("Reply-To" "Mail-Reply-To" "From") ("Mail-Followup-To" "To" "Cc")