X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=wl%2Fwl.el;h=11e9326260d3653a1d21a3bd898a0643842de93f;hb=95383fe5c0c91a36068171ea8b364c58f1bb510b;hp=c71652b3b7c8c1a6f6a3eec587be3204a3d4b75e;hpb=cdb5c86665fbcf02b7aa27fea37e35c47f86fc6c;p=elisp%2Fwanderlust.git diff --git a/wl/wl.el b/wl/wl.el index c71652b..11e9326 100644 --- a/wl/wl.el +++ b/wl/wl.el @@ -1,10 +1,10 @@ ;;; wl.el -- Wanderlust bootstrap. -;; Copyright 1998,1999,2000 Yuuichi Teranishi -;; Masahiro MURATA +;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi +;; Copyright (C) 1998,1999,2000 Masahiro MURATA ;; Author: Yuuichi Teranishi -;; Masahiro MURATA +;; Masahiro MURATA ;; Keywords: mail, net news ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen). @@ -31,7 +31,9 @@ ;;; Code: ;; -(require 'elmo2) +(require 'elmo) +(require 'wl-version) ; reduce recursive-load-depth + ;; from x-face.el (unless (and (fboundp 'defgroup) (fboundp 'defcustom)) @@ -43,7 +45,6 @@ (require 'wl-vars) (require 'wl-util) -(require 'wl-version) (cond (wl-on-xemacs (require 'wl-xmas)) @@ -54,7 +55,7 @@ (t (require 'wl-mule))) -(provide 'wl) ; circular dependency +(provide 'wl) ; circular dependency (require 'wl-folder) (require 'wl-summary) (require 'wl-thread) @@ -68,6 +69,7 @@ (require 'wl-highlight) (eval-when-compile + (require 'cl) (require 'smtp) (require 'wl-score) (unless wl-on-nemacs @@ -105,22 +107,21 @@ (let ((summaries (wl-collect-summary))) (while summaries (set-buffer (pop summaries)) - (wl-summary-msgdb-save) - ;; msgdb is saved, but cache is not saved yet. + (elmo-folder-commit wl-summary-buffer-elmo-folder) (wl-summary-set-message-modified)))) (setq wl-biff-check-folders-running nil) (if wl-plugged (progn ;; flush queue!! (elmo-dop-queue-flush) - (wl-biff-start) + (unless queue-flush-only (wl-biff-start)) (if (and wl-draft-enable-queuing wl-auto-flush-queue) (wl-draft-queue-flush)) (when (and (eq major-mode 'wl-summary-mode) - (elmo-folder-plugged-p wl-summary-buffer-folder-name)) - (let* ((msgdb-dir (elmo-msgdb-expand-path - wl-summary-buffer-folder-name)) + (elmo-folder-plugged-p wl-summary-buffer-elmo-folder)) + (let* ((msgdb-dir (elmo-folder-msgdb-path + wl-summary-buffer-elmo-folder)) (seen-list (elmo-msgdb-seen-load msgdb-dir))) (setq seen-list (wl-summary-flush-pending-append-operations seen-list)) @@ -133,9 +134,9 @@ ;;; wl-plugged-mode (defvar wl-plugged-port-label-alist - (list (cons elmo-default-nntp-port "nntp") - (cons elmo-default-imap4-port "imap4") - (cons elmo-default-pop3-port "pop3"))) + (list (cons 119 "nntp") + (cons 143 "imap4") + (cons 110 "pop3"))) ;;(cons elmo-pop-before-smtp-port "pop3") (defconst wl-plugged-switch-variables @@ -234,7 +235,8 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (defun wl-plugged-sending-queue-info () ;; sending queue status (let (alist msgs sent-via server port) - (setq msgs (elmo-list-folder wl-queue-folder)) + (setq msgs (elmo-folder-list-messages + (wl-folder-get-elmo-folder wl-queue-folder))) (while msgs (setq sent-via (wl-draft-queue-info-operation (car msgs) 'get-sent-via)) (while sent-via @@ -280,7 +282,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (if (string= last (caar dop-queue)) (wl-append operation (list ope)) ;;(setq count (1+ count)) - (when (and last (setq server-info (elmo-folder-portinfo last))) + (when (and last (setq server-info (elmo-net-port-info last))) (setq alist (wl-append-assoc-list (cons (car server-info) (nth 1 server-info)) ;; server port @@ -335,8 +337,8 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (wl-plugged-sending-queue-status qinfo)))) (insert line "\n")) (while alist - (setq server (caaar alist) - port (cdaar alist) + (setq server (nth 0 (caar alist)) + port (nth 1 (caar alist)) label (nth 1 (car alist)) plugged (nth 2 (car alist)) time (nth 3 (car alist))) @@ -418,6 +420,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (wl-plugged-redrawing-switch wl-plugged-port-indent plugged time) (setq alist (cdr alist)))) + (sit-for 0) (set-buffer-modified-p nil)) (defun wl-plugged-change () @@ -496,20 +499,23 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (name (elmo-match-buffer 3)) (plugged (not (string= switch wl-plugged-plug-on))) (alist wl-plugged-alist) - server port) + server port stream-type name-1) (cond ((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-int (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)))))) (t (setq port name))) (setq server (wl-plugged-get-server)) - (elmo-set-plugged plugged server port nil alist)) + (elmo-set-plugged plugged server port stream-type nil alist)) ((eq indent wl-plugged-server-indent) ;; toggle server plug - (elmo-set-plugged plugged name nil nil alist)) + (elmo-set-plugged plugged name nil nil nil alist)) ((eq indent 0) ;; toggle all plug - (elmo-set-plugged plugged nil nil nil alist))) + (elmo-set-plugged plugged nil nil nil nil alist))) ;; redraw (wl-plugged-redrawing wl-plugged-alist) ;; show plugged status in modeline @@ -602,7 +608,8 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (defun wl-save () "Save summary and folder status." (interactive) - (wl-save-status 'keep-summary)) + (wl-save-status 'keep-summary) + (run-hooks 'wl-save-hook)) (defun wl-save-status (&optional keep-summary) (message "Saving summary and folder status...") @@ -610,12 +617,13 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (save-excursion (let ((summaries (wl-collect-summary))) (while summaries - (set-buffer (car summaries)) - (unless keep-summary - (wl-summary-cleanup-temp-marks)) - (wl-summary-save-status keep-summary) - (unless keep-summary - (kill-buffer (car summaries))) + (with-current-buffer (car summaries) + (unless keep-summary + (wl-summary-cleanup-temp-marks)) + (wl-summary-save-view keep-summary) + (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) @@ -626,25 +634,19 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (defun wl-exit () (interactive) (when (or (not wl-interactive-exit) - (y-or-n-p "Quit Wanderlust?")) + (y-or-n-p "Quit Wanderlust? ")) (elmo-quit) (wl-biff-stop) (run-hooks 'wl-exit-hook) (wl-save-status) (wl-folder-cleanup-variables) - (elmo-cleanup-variables) + (wl-message-buffer-cache-clean-up) (wl-kill-buffers (format "^\\(%s\\)$" (mapconcat 'identity - (list (format "%s\\(:.*\\)?" - (default-value 'wl-message-buf-name)) - wl-original-buf-name - wl-folder-buffer-name + (list wl-folder-buffer-name wl-plugged-buf-name) "\\|"))) - (elmo-buffer-cache-clean-up) - (if (fboundp 'mmelmo-cleanup-entity-buffers) - (mmelmo-cleanup-entity-buffers)) (setq wl-init nil) (unless wl-on-nemacs (remove-hook 'kill-emacs-hook 'wl-save-status)) @@ -686,11 +688,13 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (progn (message "Checking environment...") (wl-check-environment arg) - (message "Checking environment...done"))) - (if demo-buf - (kill-buffer demo-buf)) + (message "Checking environment...done")) + demo-buf) (if succeed (setq wl-init t)) + ;; This hook may contain the functions `wl-plugged-init-icons' and + ;; `wl-biff-init-icons' for reasons of system internal to accord + ;; facilities for the Emacs variants. (run-hooks 'wl-init-hook))))) (defun wl-check-environment (no-check-folder) @@ -698,6 +702,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (require 'mime-setup)) (unless wl-from (error "Please set `wl-from'")) + ;; Message-ID (unless (string-match "[^.]\\.[^.]" (or wl-message-id-domain (if wl-local-domain (concat (system-name) @@ -710,55 +715,68 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." "." wl-local-domain) (system-name)))) (error "Please remove `@' from `wl-message-id-domain'")) + (if (string= wl-local-domain "localdomain") + (error "Please set `wl-local-domain'")) + (if (string= wl-message-id-domain "localhost.localdomain") + (error "Please set `wl-message-id-domain'")) + ;; folders (when (not no-check-folder) - (if (not (eq (elmo-folder-get-type wl-draft-folder) 'localdir)) - (error "%s is not allowed for draft folder" wl-draft-folder)) - (unless (elmo-folder-exists-p wl-draft-folder) - (if (y-or-n-p - (format "Draft Folder %s does not exist, create it?" - wl-draft-folder)) - (elmo-create-folder wl-draft-folder) - (error "Draft Folder is not created"))) - (if (and wl-draft-enable-queuing - (not (elmo-folder-exists-p wl-queue-folder))) + (let ((draft-folder (wl-folder-get-elmo-folder wl-draft-folder)) + (queue-folder (wl-folder-get-elmo-folder wl-queue-folder)) + (trash-folder (wl-folder-get-elmo-folder wl-trash-folder)) + (lost+found-folder (wl-folder-get-elmo-folder + elmo-lost+found-folder))) + (if (not (elmo-folder-message-file-p draft-folder)) + (error "%s is not allowed for draft folder" wl-draft-folder)) + (unless (elmo-folder-exists-p draft-folder) + (if (y-or-n-p + (format "Draft Folder %s does not exist, create it? " + wl-draft-folder)) + (elmo-folder-create draft-folder) + (error "Draft Folder is not created"))) + (if (and wl-draft-enable-queuing + (not (elmo-folder-exists-p queue-folder))) + (if (y-or-n-p + (format "Queue Folder %s does not exist, create it? " + wl-queue-folder)) + (elmo-folder-create queue-folder) + (error "Queue Folder is not created"))) + (when (not (eq no-check-folder 'wl-draft)) + (unless (elmo-folder-exists-p trash-folder) + (if (y-or-n-p + (format "Trash Folder %s does not exist, create it? " + wl-trash-folder)) + (elmo-folder-create trash-folder) + (error "Trash Folder is not created"))) + (unless (elmo-folder-exists-p lost+found-folder) + (elmo-folder-create lost+found-folder))) + ;; tmp dir + (unless (file-exists-p wl-tmp-dir) (if (y-or-n-p - (format "Queue Folder %s does not exist, create it?" - wl-queue-folder)) - (elmo-create-folder wl-queue-folder) - (error "Queue Folder is not created")))) - (when (not (eq no-check-folder 'wl-draft)) - (unless (elmo-folder-exists-p wl-trash-folder) - (if (y-or-n-p - (format "Trash Folder %s does not exist, create it?" - wl-trash-folder)) - (elmo-create-folder wl-trash-folder) - (error "Trash Folder is not created"))) - (unless (elmo-folder-exists-p elmo-lost+found-folder) - (elmo-create-folder elmo-lost+found-folder))) - (unless (file-exists-p wl-tmp-dir) - (if (y-or-n-p - (format "Temp directory (to save multipart) %s does not exist, create it now?" - wl-tmp-dir)) - (make-directory wl-tmp-dir) - (error "Temp directory is not created")))) + (format "Temp directory (to save multipart) %s does not exist, create it now? " + wl-tmp-dir)) + (make-directory wl-tmp-dir) + (error "Temp directory is not created")))))) ;;;###autoload (defun wl (&optional arg) "Start Wanderlust -- Yet Another Message Interface On Emacsen. -If prefix argument is specified, folder checkings are skipped." +If ARG (prefix argument) is specified, folder checkings are skipped." (interactive "P") (or wl-init (wl-load-profile)) - (unwind-protect - (wl-init arg) - (wl-plugged-init (wl-folder arg)) - (sit-for 0)) - (unwind-protect - (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-hook))) + (let (demo-buf) + (unwind-protect + (setq demo-buf (wl-init arg)) + (wl-plugged-init (wl-folder arg))) + (unwind-protect + (unless arg + (run-hooks 'wl-auto-check-folder-pre-hook) + (wl-folder-auto-check) + (run-hooks 'wl-auto-check-folder-hook)) + (if (buffer-live-p demo-buf) + (kill-buffer demo-buf)) + (unless arg (wl-biff-start)) + (run-hooks 'wl-hook)))) ;; Define some autoload functions WL might use. (eval-and-compile