X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=wl%2Fwl.el;h=d52324314287af3347faa0dfaaf214d9a4c055cc;hb=a188e316446f771a0900c8e05026e39b224eb0f9;hp=98035ca0c318f0ea99492a6df6ec01d22372e5f3;hpb=b84bfc119fc38a1cc50f1fd62c2a935bb1159e07;p=elisp%2Fwanderlust.git diff --git a/wl/wl.el b/wl/wl.el index 98035ca..d523243 100644 --- a/wl/wl.el +++ b/wl/wl.el @@ -56,8 +56,10 @@ (provide 'wl) ; circular dependency (require 'wl-folder) (require 'wl-summary) +(require 'wl-action) (require 'wl-thread) (require 'wl-address) +(require 'wl-news) (wl-draft-mode-setup) (require 'wl-draft) @@ -71,7 +73,8 @@ (require 'smtp) (require 'wl-score) (require 'wl-fldmgr) - (require 'wl-mime)) + (require 'wl-mime) + (require 'wl-spam)) (defun wl-plugged-init (&optional make-alist) (setq elmo-plugged wl-plugged) @@ -646,6 +649,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (wl-refile-alist-save) (wl-folder-info-save) (and (featurep 'wl-fldmgr) (wl-fldmgr-exit)) + (and (featurep 'wl-spam) (wl-spam-save-status)) (elmo-crosspost-message-alist-save) (message "Saving summary and folder status...done")) @@ -666,9 +670,11 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (list wl-folder-buffer-name wl-plugged-buf-name) "\\|"))) - (if (and wl-folder-use-frame - (> (length (visible-frame-list)) 1)) - (delete-frame)) + (when wl-delete-startup-frame-function + (funcall wl-delete-startup-frame-function)) +;; (if (and wl-folder-use-frame +;; (> (length (visible-frame-list)) 1)) +;; (delete-frame)) (setq wl-init nil) (remove-hook 'kill-emacs-hook 'wl-save-status) t) @@ -692,8 +698,15 @@ 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-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-no-from wl-summary-no-from-message) (setq elmo-no-subject wl-summary-no-subject-message) + (wl-news-check) (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 @@ -701,33 +714,29 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (run-hooks 'wl-init-hook))) (defun wl-check-environment (no-check-folder) - (unless wl-from (error "Please set `wl-from'")) + (unless wl-from (error "Please set `wl-from' to your mail address")) ;; Message-ID - (unless (string-match "[^.]\\.[^.]" (or wl-message-id-domain - (if wl-local-domain - (concat (system-name) - "." wl-local-domain) - (system-name)))) - (error "Please set `wl-local-domain' to get valid FQDN")) - (if (string-match "@" (or wl-message-id-domain - (if wl-local-domain - (concat (system-name) - "." 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'")) + (when wl-insert-message-id + (let ((message-id (funcall wl-message-id-function)) + domain) + (unless (string-match "^<\\([^@]*\\)@\\([^@]*\\)>$" message-id) + (cond + ((string-match "@" wl-message-id-domain) + (error "Please remove `@' from `wl-message-id-domain'")) + (t + (error + "Check around `wl-message-id-function' to get valid Message-ID string")))) + (setq domain (match-string 2 message-id)) + (if (or (not (string-match "[^.]\\.[^.]" domain)) + (string= domain "localhost.localdomain")) + (elmo-warning + "Please set `wl-message-id-domain' to get valid Message-ID string.")))) ;; folders (when (not no-check-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? " @@ -742,12 +751,6 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (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 @@ -758,6 +761,38 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (make-directory wl-temporary-file-directory) (error "Temp directory is not created")))))) +(defconst wl-check-variables-alist + '((numberp . elmo-pop3-default-port) + (symbolp . elmo-pop3-default-authenticate-type) + (numberp . elmo-imap4-default-port) + (symbolp . elmo-imap4-default-authenticate-type) + (numberp . elmo-nntp-default-port) + (numberp . wl-pop-before-smtp-port) + (symbolp . wl-pop-before-smtp-authenticate-type))) + +(defun wl-check-variables () + (let ((type-variables wl-check-variables-alist) + type) + (while (setq type (car type-variables)) + (if (and (eval (cdr type)) + (not (funcall (car type) + (eval (cdr type))))) + (error "%s must be %s: %S" + (cdr type) + (substring (format "%s" (car type)) 0 -1) + (eval (cdr type)))) + (setq type-variables (cdr type-variables))))) + +(defun wl-check-variables-2 () + (if (< wl-message-buffer-cache-size 1) + (error "`wl-message-buffer-cache-size' must be larger than 0")) + (when wl-message-buffer-prefetch-depth + (if (not (< wl-message-buffer-prefetch-depth + wl-message-buffer-cache-size)) + (error (concat + "`wl-message-buffer-prefetch-depth' must be smaller than " + "`wl-message-buffer-cache-size' - 1."))))) + ;;;###autoload (defun wl (&optional arg) "Start Wanderlust -- Yet Another Message Interface On Emacsen. @@ -765,7 +800,6 @@ If ARG (prefix argument) is specified, folder checkings are skipped." (interactive "P") (unless wl-init (wl-load-profile) - (wl-folder-init) (elmo-init)) (let (demo-buf check) (unless wl-init @@ -775,14 +809,16 @@ If ARG (prefix argument) is specified, folder checkings are skipped." (condition-case obj (progn (if check - (condition-case nil - (progn - (message "Checking environment...") - (wl-check-environment arg) - (message "Checking environment...done")) - (error) - (quit))) - (wl-plugged-init (wl-folder arg)) + (progn + (message "Checking environment...") + (wl-check-environment arg) + (message "Checking environment...done") + (message "Checking type of variables...") + (wl-check-variables) + (wl-check-variables-2) + (message "Checking type of variables...done"))) + (let ((inhibit-quit t)) + (wl-plugged-init (wl-folder))) (unless arg (run-hooks 'wl-auto-check-folder-pre-hook) (wl-folder-auto-check) @@ -797,6 +833,41 @@ If ARG (prefix argument) is specified, folder checkings are skipped." (kill-buffer demo-buf))) (run-hooks 'wl-hook)) +(defvar wl-delete-startup-frame-function nil) + +;;;###autoload +(defun wl-other-frame (&optional arg) + "Pop up a frame to read messages via Wanderlust." + (interactive) + (if wl-folder-use-frame + (wl arg) + (let ((focusing-functions (append '(raise-frame select-frame) + (if (fboundp 'x-focus-frame) + '(x-focus-frame) + '(focus-frame)))) + (folder (get-buffer wl-folder-buffer-name)) + window frame wl-folder-use-frame) + (if (and folder + (setq window (get-buffer-window folder t)) + (window-live-p window) + (setq frame (window-frame window))) + (progn + (while focusing-functions + (funcall (car focusing-functions) frame) + (setq focusing-functions (cdr focusing-functions))) + (wl arg)) + (setq frame (make-frame)) + (while focusing-functions + (funcall (car focusing-functions) frame) + (setq focusing-functions (cdr focusing-functions))) + (setq wl-delete-startup-frame-function + `(lambda () + (setq wl-delete-startup-frame-function nil) + (let ((frame ,frame)) + (if (eq (selected-frame) frame) + (delete-frame frame))))) + (wl arg))))) + ;; Define some autoload functions WL might use. (eval-and-compile ;; This little mapcar goes through the list below and marks the