* 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-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):
: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.
(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
(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")