* wl-vars.el (wl-draft-send-confirm-type): New user option.
authorhmurata <hmurata>
Sat, 28 Jan 2006 09:03:41 +0000 (09:03 +0000)
committerhmurata <hmurata>
Sat, 28 Jan 2006 09:03:41 +0000 (09:03 +0000)
* 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'

wl/ChangeLog
wl/wl-draft.el
wl/wl-util.el
wl/wl-vars.el

index 08f02c3..c462a8e 100644 (file)
@@ -1,3 +1,12 @@
+2006-01-28  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * 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  <yoichi@geiin.org>
 
        * wl-draft.el (wl-draft-save, wl-draft-buffer-change-number):
index 855346a..c635e5e 100644 (file)
@@ -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? <y/n/j(down)/k(up)> ")
-                   (case (let ((cursor-in-echo-area t)) (read-char))
-                     ((?y ?Y)
-                      (throw 'done t))
-                     ((?v ?j ?J ? )
-                      (ignore-errors (scroll-up)))
-                     ((?^ ?k ?K ?\7f)
-                      (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.
index 3c99879..d543210 100644 (file)
@@ -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
+                                  "<y/n/SPC(down)/BS(up)> "
+                                "<y/n/j(down)/k(up)> "))))
+    (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
index 0757fd5..b92d2ec 100644 (file)
@@ -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")