* wl-util.el (wl-save-drafts): Moved from sample setting.
(wl-set-save-drafts): New function to set idle timer.
* wl-draft.el (wl-draft): Call it.
* wl-vars.el (wl-auto-save-drafts-interval): New variable.
; 'wl-generate-user-agent-string-1)
-;; Automatically save modified draft buffers in every 20 seconds.
-;(defun my-wl-auto-save-draft-buffers ()
-; (let ((buffers (wl-collect-draft)))
-; (save-excursion
-; (while buffers
-; (set-buffer (car buffers))
-; (if (buffer-modified-p) (wl-draft-save))
-; (setq buffers (cdr buffers))))))
-;(run-with-idle-timer 20 t 'my-wl-auto-save-draft-buffers)
-
;; When you encrypt message by PGP, include your public key.
;; (to make the message visible from yourself)
;(setq pgg-encrypt-for-me t)
;(setq wl-generate-mailer-string-function
; 'wl-generate-user-agent-string-1)
-
-;; \e$BJQ99$5$l$?%I%i%U%H$,$"$l$P\e(B 20 \e$BIC$4$H$K<+F0J]B8$9$k!#\e(B
-;(defun my-wl-auto-save-draft-buffers ()
-; (let ((buffers (wl-collect-draft)))
-; (save-excursion
-; (while buffers
-; (set-buffer (car buffers))
-; (if (buffer-modified-p) (wl-draft-save))
-; (setq buffers (cdr buffers))))))
-;(run-with-idle-timer 20 t 'my-wl-auto-save-draft-buffers)
-
;; PGP \e$B$G0E9f2=$9$k;~$K<+J,$N8x3+80$b4^$a$k!#\e(B
;; (\e$B$=$N%a%C%;!<%8$r<+J,$G$bFI$a$k$h$&$K\e(B)
;(setq pgg-encrypt-for-me t)
+2004-11-26 Yoichi NAKAYAMA <yoichi@geiin.org>
+
+ * wl-util.el (toplevel): Don't check existence of `timer-activate'.
+
+ * wl-util.el (wl-save-drafts): Moved from sample setting.
+ (wl-set-save-drafts): New function to set idle timer.
+ * wl-draft.el (wl-draft): Call it.
+ * wl-vars.el (wl-auto-save-drafts-interval): New variable.
+
2004-11-23 Yuuichi Teranishi <teranisi@gohome.org>
* wl-util.el (wl-current-message-buffer): Fixed bug when yank from
(let (wl-demo)
(wl-init)) ; returns immediately if already initialized.
-
+ (wl-set-save-drafts)
(let (buffer header-alist-internal)
(setq buffer (wl-draft-create-buffer parent-folder))
(unless (cdr (assq 'From header-alist))
(buffer-list))
result))
+(defun wl-save-drafts ()
+ (let ((buffers (wl-collect-draft)))
+ (save-excursion
+ (while buffers
+ (set-buffer (car buffers))
+ (if (buffer-modified-p) (wl-draft-save))
+ (setq buffers (cdr buffers))))))
+
(static-if (fboundp 'read-directory-name)
(defun wl-read-directory-name (prompt dir)
(read-directory-name prompt dir dir))
(set-window-hscroll (get-buffer-window (current-buffer) t) 0))
max))))
+;; Draft auto-save
+(static-cond
+ (wl-on-xemacs
+ (defvar wl-save-drafts-timer-name "wl-save-drafts")
+
+ (defun wl-set-save-drafts ()
+ (if (numberp wl-auto-save-drafts-interval)
+ (unless (get-itimer wl-save-drafts-timer-name)
+ (start-itimer wl-save-drafts-timer-name 'wl-save-drafts
+ wl-save-drafts-interval wl-save-drafts-interval
+ t))
+ (when (get-itimer wl-save-drafts-timer-name)
+ (delete-itimer wl-save-drafts-timer-name)))))
+ (t
+ (defun wl-set-save-drafts ()
+ (if (numberp wl-auto-save-drafts-interval)
+ (progn
+ (require 'timer)
+ (if (get 'wl-save-drafts 'timer)
+ (progn (timer-set-idle-time (get 'wl-save-drafts 'timer)
+ wl-auto-save-drafts-interval t)
+ (timer-activate-when-idle (get 'wl-save-drafts 'timer)))
+ (put 'wl-save-drafts 'timer
+ (run-with-idle-timer
+ wl-auto-save-drafts-interval t 'wl-save-drafts))))
+ (when (get 'wl-save-drafts 'timer)
+ (cancel-timer (get 'wl-save-drafts 'timer)))))))
+
;; Biff
(static-cond
(wl-on-xemacs
wl-biff-check-interval wl-biff-check-interval
wl-biff-use-idle-timer))))
- ((and (condition-case nil (require 'timer) (error nil));; FSFmacs 19+
- (fboundp 'timer-activate))
-
+ (t
(defun wl-biff-stop ()
(when (get 'wl-biff 'timer)
(cancel-timer (get 'wl-biff 'timer))))
(timer-set-time timer (timer-next-integral-multiple-of-time
current wl-biff-check-interval)
wl-biff-check-interval)
- (timer-activate timer))))))
- (t
- (fset 'wl-biff-stop 'ignore)
- (fset 'wl-biff-start 'ignore)))
+ (timer-activate timer)))))))
(defsubst wl-biff-notify (new-mails notify-minibuf)
(when (and (not wl-modeline-biff-status) (> new-mails 0))
:type 'regexp
:group 'wl-draft)
+(defcustom wl-auto-save-drafts-interval 1
+ "Idle interval in seconds to save draft buffers automatically.
+If you don't want to use this feature, set this to nil."
+ :type '(choice (const :tag "Don't use this feature" nil)
+ (number :tag "Secs"))
+ :group 'wl-draft)
+
(defcustom wl-draft-preview-attributes t
"Non-nil forces to preview the attributes in the `wl-draft-preview-message'.
Attributes specified in the `wl-draft-preview-attributes-list' are displayed."