* wl-draft.el (wl-draft-reply): Use `elmo-parse' instead of `wl-parse'.
[elisp/wanderlust.git] / wl / wl.el
index 42665e3..c7d0ac6 100644 (file)
--- a/wl/wl.el
+++ b/wl/wl.el
@@ -41,7 +41,7 @@
   (defmacro defgroup (&rest args))
   (defmacro defcustom (symbol value &optional doc &rest args)
     (let ((doc (concat "*" (or doc ""))))
-      (` (defvar (, symbol) (, value) (, doc))))))
+      `(defvar ,symbol ,value ,doc))))
 
 (require 'wl-vars)
 (require 'wl-util)
       (progn
        ;; flush queue!!
        (elmo-dop-queue-flush)
-       (unless queue-flush-only (wl-biff-start))
+       (unless queue-flush-only
+         (when wl-biff-check-folder-list
+           (wl-biff-check-folders)
+           (wl-biff-start)))
        (if (and wl-draft-enable-queuing
                 wl-auto-flush-queue)
            (wl-draft-queue-flush))
 (defvar wl-plugged-port-label-alist
   (list (cons 119 "nntp")
        (cons 143 "imap4")
-       (cons 110 "pop3")))
+       (cons 110 "pop3")
+       (cons 25 "smtp")))
        ;;(cons elmo-pop-before-smtp-port "pop3")
 
 (defconst wl-plugged-switch-variables
@@ -212,11 +216,13 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
   (run-hooks 'wl-plugged-mode-hook))
 
 (defmacro wl-plugged-string (plugged &optional time)
-  (` (if (, time) wl-plugged-auto-off
-       (if (, plugged) wl-plugged-plug-on wl-plugged-plug-off))))
+  `(if ,time wl-plugged-auto-off
+     (if ,plugged
+        wl-plugged-plug-on
+       wl-plugged-plug-off)))
 
 (defmacro wl-plugged-server-indent ()
-  (` (make-string wl-plugged-server-indent ? )))
+  '(make-string wl-plugged-server-indent ? ))
 
 (defun wl-plugged-set-variables ()
   (setq wl-plugged-sending-queue-alist
@@ -454,8 +460,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
                          (/ (frame-height) 2)
                        (window-height)))
           window-lines lines)
-      (save-excursion
-       (set-buffer (get-buffer-create wl-plugged-buf-name))
+      (with-current-buffer (get-buffer-create wl-plugged-buf-name)
        (wl-plugged-mode)
        (buffer-disable-undo (current-buffer))
        (delete-windows-on (current-buffer))
@@ -525,7 +530,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
           ((eq indent wl-plugged-port-indent)  ;; toggle port plug
            (cond
             ((string-match "\\([^([]*\\)(\\([^)[]+\\))" name)
-             (setq port (string-to-int (elmo-match-string 2 name)))
+             (setq port (string-to-number (elmo-match-string 2 name)))
              (if (string-match "!" (setq name-1 (elmo-match-string 1 name)))
                  (setq stream-type
                        (intern (substring name-1 (match-end 0))))))
@@ -626,26 +631,35 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
 
 ;;; end of wl-plugged-mode
 
-(defun wl-save (&optional exec-marks)
+(defun wl-save ()
   "Save summary and folder status."
-  (interactive "P")
-  (wl-save-status 'keep-summary (not exec-marks))
+  (interactive)
+  (wl-save-status 'keep-summary)
   (run-hooks 'wl-save-hook))
 
-(defun wl-save-status (&optional keep-summary leave-marks)
+(defun wl-execute-temp-marks ()
+  "Execute temporary marks in summary buffers."
+  (interactive)
+  (let ((summaries (wl-collect-summary)))
+    (while summaries
+      (with-current-buffer (car summaries)
+       (wl-summary-exec-with-confirmation)
+       (wl-summary-save-status))
+      (setq summaries (cdr summaries)))))
+
+(defun wl-save-status (&optional keep-summary)
   (message "Saving summary and folder status...")
-  (let (summary-buf)
-    (save-excursion
-      (let ((summaries (wl-collect-summary)))
-       (while summaries
-         (with-current-buffer (car summaries)
-           (unless leave-marks
-             (wl-summary-cleanup-temp-marks keep-summary))
-           (wl-summary-save-view)
-           (elmo-folder-commit wl-summary-buffer-elmo-folder)
-           (unless keep-summary
-             (kill-buffer (car summaries))))
-         (setq summaries (cdr summaries))))))
+  (save-excursion
+    (let ((summaries (wl-collect-summary)))
+      (while summaries
+       (with-current-buffer (car summaries)
+         (unless keep-summary
+           (wl-summary-cleanup-temp-marks))
+         (wl-summary-save-view)
+         (elmo-folder-commit wl-summary-buffer-elmo-folder)
+         (unless keep-summary
+           (kill-buffer (car summaries))))
+       (setq summaries (cdr summaries)))))
   (wl-refile-alist-save)
   (wl-folder-info-save)
   (and (featurep 'wl-fldmgr) (wl-fldmgr-exit))
@@ -660,6 +674,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
     (elmo-quit)
     (when wl-use-acap (funcall (symbol-function 'wl-acap-exit)))
     (wl-biff-stop)
+    (elmo-clear-signal-slots)
     (run-hooks 'wl-exit-hook)
     (wl-save-status)
     (wl-folder-cleanup-variables)
@@ -677,6 +692,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
 ;;     (delete-frame))
     (setq wl-init nil)
     (remove-hook 'kill-emacs-hook 'wl-save-status)
+    (elmo-passwd-alist-clear)
     t)
   (message "") ; empty minibuffer.
   )
@@ -698,14 +714,30 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
          (symbol-value 'wl-summary-subject-function))
     (fset 'wl-summary-subject-filter-func-internal
          (symbol-value 'wl-summary-subject-filter-function))
+    (wl-summary-define-sort-command)
     (wl-summary-define-mark-action)
     (dolist (spec wl-summary-flag-alist)
       (set-face-foreground
        (make-face (intern
                   (format "wl-highlight-summary-%s-flag-face" (car spec))))
        (nth 1 spec)))
+    (setq elmo-get-folder-function #'wl-folder-make-elmo-folder
+         elmo-progress-callback-function #'wl-progress-callback-function)
     (setq elmo-no-from wl-summary-no-from-message)
     (setq elmo-no-subject wl-summary-no-subject-message)
+    (elmo-global-flags-initialize (mapcar 'car wl-summary-flag-alist))
+    (elmo-connect-signal
+     nil
+     'message-number-changed
+     'wl-draft
+     (elmo-define-signal-handler (listener folder old-number new-number)
+       (dolist (buffer (wl-collect-draft))
+        (with-current-buffer buffer
+          (wl-draft-buffer-change-number old-number new-number)))
+       (wl-draft-rename-saved-config old-number new-number))
+     (elmo-define-signal-filter (listener folder old-number new-number)
+       (and folder
+           (string= (elmo-folder-name-internal folder) wl-draft-folder))))
     (wl-news-check)
     (setq wl-init t)
     ;; This hook may contain the functions `wl-plugged-init-icons' and
@@ -822,13 +854,15 @@ If ARG (prefix argument) is specified, folder checkings are skipped."
          (unless arg
            (run-hooks 'wl-auto-check-folder-pre-hook)
            (wl-folder-auto-check)
-           (run-hooks 'wl-auto-check-folder-hook))
-         (unless arg (wl-biff-start)))
+           (run-hooks 'wl-auto-check-folder-hook)))
       (error
        (if (buffer-live-p demo-buf)
           (kill-buffer demo-buf))
        (signal (car obj)(cdr obj)))
       (quit))
+    (when wl-biff-check-folder-list
+      (unless arg (wl-biff-check-folders))
+      (wl-biff-start))
     (if (buffer-live-p demo-buf)
        (kill-buffer demo-buf)))
   (run-hooks 'wl-hook))
@@ -913,7 +947,8 @@ If ARG (prefix argument) is specified, folder checkings are skipped."
       wl-score-change-score-file wl-score-edit-current-scores
       wl-score-edit-file wl-score-flush-cache wl-summary-rescore
       wl-score-set-mark-below wl-score-set-expunge-below
-      wl-summary-increase-score wl-summary-lower-score ))))
+      wl-summary-increase-score wl-summary-lower-score )
+     ("wl-draft" wl-draft-rename-saved-config))))
 
 ;; for backward compatibility
 (defalias 'wl-summary-from-func-petname 'wl-summary-default-from)