1 ;;; wl.el -- Wanderlust bootstrap.
3 ;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
4 ;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
6 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
7 ;; Masahiro MURATA <muse@ba2.so-net.ne.jp>
8 ;; Keywords: mail, net news
10 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
12 ;; This program is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; This program is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
35 (require 'wl-version) ; reduce recursive-load-depth
38 (unless (and (fboundp 'defgroup)
41 (defmacro defgroup (&rest args))
42 (defmacro defcustom (symbol value &optional doc &rest args)
43 (let ((doc (concat "*" (or doc ""))))
44 (` (defvar (, symbol) (, value) (, doc))))))
56 (provide 'wl) ; circular dependency
67 (require 'wl-highlight)
76 (defun wl-plugged-init (&optional make-alist)
77 (setq elmo-plugged wl-plugged)
78 (if wl-reset-plugged-alist
79 (elmo-set-plugged elmo-plugged))
81 (wl-make-plugged-alist))
83 (setq elmo-plugged (setq wl-plugged (elmo-plugged-p))
84 wl-modeline-plug-status wl-plugged)
86 (wl-toggle-plugged t 'flush)))
88 (defun wl-toggle-plugged (&optional arg queue-flush-only)
90 (elmo-quit) ; Disconnect current connection.
91 (unless queue-flush-only
96 (setq wl-plugged nil))
97 (t (setq wl-plugged (not wl-plugged))))
98 (elmo-set-plugged wl-plugged))
99 (setq elmo-plugged wl-plugged
100 wl-modeline-plug-status wl-plugged)
102 (let ((summaries (wl-collect-summary)))
104 (set-buffer (pop summaries))
105 (elmo-folder-commit wl-summary-buffer-elmo-folder)
106 (wl-summary-set-message-modified))))
107 (setq wl-biff-check-folders-running nil)
111 (elmo-dop-queue-flush)
112 (unless queue-flush-only (wl-biff-start))
113 (if (and wl-draft-enable-queuing
115 (wl-draft-queue-flush))
116 ;; (when (and (eq major-mode 'wl-summary-mode)
117 ;; (elmo-folder-plugged-p wl-summary-buffer-elmo-folder))
118 ;; (let* ((msgdb-dir (elmo-folder-msgdb-path
119 ;; wl-summary-buffer-elmo-folder))
120 ;; (seen-list (elmo-msgdb-seen-load msgdb-dir)))
122 ;; (wl-summary-flush-pending-append-operations seen-list))
123 ;; (elmo-msgdb-seen-save msgdb-dir seen-list)))
124 (run-hooks 'wl-plugged-hook))
126 (run-hooks 'wl-unplugged-hook))
127 (force-mode-line-update t))
131 (defvar wl-plugged-port-label-alist
132 (list (cons 119 "nntp")
135 ;;(cons elmo-pop-before-smtp-port "pop3")
137 (defconst wl-plugged-switch-variables
138 '(("Queuing" . wl-draft-enable-queuing)
139 ("AutoFlushQueue" . wl-auto-flush-queue)
140 ("DisconnectedOperation" . elmo-enable-disconnected-operation)))
142 (defvar wl-plugged-buf-name "Plugged")
143 (defvar wl-plugged-mode-map nil)
144 (defvar wl-plugged-alist nil)
145 (defvar wl-plugged-switch nil)
146 (defvar wl-plugged-winconf nil)
147 (defvar wl-plugged-sending-queue-alist nil)
148 (defvar wl-plugged-dop-queue-alist nil)
149 (defvar wl-plugged-alist-modified nil)
151 (defvar wl-plugged-mode-menu-spec
153 ["Toggle plugged" wl-plugged-toggle t]
154 ["Toggle All plugged" wl-plugged-toggle-all t]
155 ["Prev Port" wl-plugged-move-to-previous t]
156 ["Next Port" wl-plugged-move-to-next t]
157 ["Prev Server" wl-plugged-move-to-previous-server t]
158 ["Next Server" wl-plugged-move-to-next-server t]
159 ["Flush queue" wl-plugged-flush-queue t]
161 ["Exit" wl-plugged-exit t]))
165 (defun wl-plugged-setup-mouse ()
166 (define-key wl-plugged-mode-map 'button2 'wl-plugged-click))
167 (defun wl-plugged-setup-mouse ()
168 (define-key wl-plugged-mode-map [mouse-2] 'wl-plugged-click))))
170 (unless wl-plugged-mode-map
171 (setq wl-plugged-mode-map (make-sparse-keymap))
172 (define-key wl-plugged-mode-map " " 'wl-plugged-toggle)
173 (define-key wl-plugged-mode-map "\C-m" 'wl-plugged-toggle)
174 (define-key wl-plugged-mode-map "\M-t" 'wl-plugged-toggle-all)
175 (define-key wl-plugged-mode-map "q" 'wl-plugged-exit)
176 (define-key wl-plugged-mode-map "\C-t" 'wl-plugged-exit)
177 (define-key wl-plugged-mode-map "F" 'wl-plugged-flush-queue)
178 (define-key wl-plugged-mode-map "P" 'wl-plugged-move-to-previous-server)
179 (define-key wl-plugged-mode-map "N" 'wl-plugged-move-to-next-server)
180 (define-key wl-plugged-mode-map "p" 'wl-plugged-move-to-previous)
181 (define-key wl-plugged-mode-map "n" 'wl-plugged-move-to-next)
182 (define-key wl-plugged-mode-map "\e\t" 'wl-plugged-move-to-previous)
183 (define-key wl-plugged-mode-map "\t" 'wl-plugged-move-to-next)
184 (wl-plugged-setup-mouse)
188 "Menu used in Plugged mode."
189 wl-plugged-mode-menu-spec))
191 (defun wl-plugged-mode ()
192 "Mode for setting Wanderlust plugged.
193 See info under Wanderlust for full documentation.
196 \\{wl-plugged-mode-map}
198 Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
200 (kill-all-local-variables)
201 (use-local-map wl-plugged-mode-map)
202 (setq major-mode 'wl-plugged-mode)
203 (setq mode-name "Plugged")
204 (easy-menu-add wl-plugged-mode-menu)
205 (wl-mode-line-buffer-identification)
206 (setq wl-plugged-switch wl-plugged)
207 (setq wl-plugged-alist-modified nil)
208 (setq buffer-read-only t)
209 (run-hooks 'wl-plugged-mode-hook))
211 (defmacro wl-plugged-string (plugged &optional time)
212 (` (if (, time) wl-plugged-auto-off
213 (if (, plugged) wl-plugged-plug-on wl-plugged-plug-off))))
215 (defmacro wl-plugged-server-indent ()
216 (` (make-string wl-plugged-server-indent ? )))
218 (defun wl-plugged-set-variables ()
219 (setq wl-plugged-sending-queue-alist
220 (wl-plugged-sending-queue-info))
221 (setq wl-plugged-dop-queue-alist
222 (wl-plugged-dop-queue-info))
223 (setq wl-plugged-alist
224 (sort (copy-sequence elmo-plugged-alist)
226 (string< (caar a) (caar b))))))
228 (defun wl-plugged-sending-queue-info ()
229 ;; sending queue status
230 (let (alist msgs sent-via server port)
231 (setq msgs (elmo-folder-list-messages
232 (wl-folder-get-elmo-folder wl-queue-folder)))
234 (setq sent-via (wl-draft-queue-info-operation (car msgs) 'get-sent-via))
236 (when (eq (nth 1 (car sent-via)) 'unplugged)
237 (setq server (car (nth 2 (car sent-via)))
238 port (cdr (nth 2 (car sent-via))))
239 (elmo-plugged-p server port) ;; add elmo-plugged-alist if nothing.
241 (wl-append-assoc-list
245 (setq sent-via (cdr sent-via)))
246 (setq msgs (cdr msgs)))
249 (defun wl-plugged-sending-queue-status (qinfo)
250 ;; sending queue status
251 (let ((len (length (cdr qinfo))))
252 (concat (wl-plugged-set-folder-icon
254 (wl-folder-get-petname wl-queue-folder))
256 (format ": %d msgs (" len)
257 (format ": %d msg (" len))
258 (mapconcat (function int-to-string) (cdr qinfo) ",")
261 (defun wl-plugged-dop-queue-info ()
264 (elmo-dop-queue (copy-sequence elmo-dop-queue))
265 dop-queue last alist server-info
267 ;(elmo-dop-queue-load)
268 (elmo-dop-queue-merge)
269 (setq dop-queue (sort elmo-dop-queue '(lambda (a b)
270 (string< (elmo-dop-queue-fname a)
271 (elmo-dop-queue-fname b)))))
272 (wl-append dop-queue (list nil)) ;; terminate(dummy)
273 (when (car dop-queue)
274 (setq last (elmo-dop-queue-fname (car dop-queue)))) ;; first
276 (when (car dop-queue)
277 (setq ope (cons (elmo-dop-queue-method-name (car dop-queue))
281 (elmo-dop-queue-arguments (car dop-queue))))
282 (car (elmo-dop-queue-arguments
283 (car dop-queue))))))))
284 (if (and (car dop-queue)
285 (string= last (elmo-dop-queue-fname (car dop-queue))))
286 (wl-append operation (list ope))
287 ;;(setq count (1+ count))
288 (when (and last (setq server-info (elmo-net-port-info
289 (wl-folder-get-elmo-folder last))))
291 (wl-append-assoc-list
293 (cons last operation)
295 (when (car dop-queue)
296 (setq last (elmo-dop-queue-fname (car dop-queue))
297 operation (list ope))))
298 (setq dop-queue (cdr dop-queue)))
301 (defun wl-plugged-dop-queue-status (qinfo &optional column)
303 (let ((operations (cdr qinfo))
304 (column (or column wl-plugged-queue-status-column)))
306 '(lambda (folder-ope)
307 (concat (wl-plugged-set-folder-icon
309 (wl-folder-get-petname (car folder-ope)))
314 (format "%s:%d" (car ope) (cdr ope))
315 (format "%s" (car ope))))
316 (cdr folder-ope) ",")
319 (concat "\n" (wl-set-string-width column "")))))
321 (defun wl-plugged-drawing (plugged-alist)
322 (let ((buffer-read-only nil)
323 (alist plugged-alist)
324 (vars wl-plugged-switch-variables)
325 last server port stream-type label plugged time
326 line len qinfo column)
329 (insert (format "%s:[%s]%s"
331 (wl-plugged-string (symbol-value (cdar vars)))
332 (if (cdr vars) " " "")))
333 (setq vars (cdr vars)))
335 (let ((elmo-plugged wl-plugged-switch))
336 (setq line (format "[%s](wl-plugged)"
337 (wl-plugged-string (elmo-plugged-p))))
338 ;; sending queue status
339 (when (setq qinfo (assoc (cons nil nil) wl-plugged-sending-queue-alist))
341 (wl-set-string-width wl-plugged-queue-status-column line)
342 (wl-plugged-sending-queue-status qinfo))))
345 (setq server (nth 0 (caar alist))
346 port (nth 1 (caar alist))
347 stream-type (nth 2 (caar alist))
348 label (nth 1 (car alist))
349 plugged (nth 2 (car alist))
350 time (nth 3 (car alist)))
351 (unless (string= last server)
353 (insert (format "%s[%s]%s\n"
354 (wl-plugged-server-indent)
356 (elmo-plugged-p server nil plugged-alist))
362 (make-string wl-plugged-port-indent ? )
363 (wl-plugged-string plugged time)
370 (cdr (assq port wl-plugged-port-label-alist))
373 (setq column (max (if line (1+ (string-width line)) 0)
374 wl-plugged-queue-status-column))
376 ;; sending queue status
377 ((setq qinfo (assoc (cons server port) wl-plugged-sending-queue-alist))
380 (wl-set-string-width column line)
381 (wl-plugged-sending-queue-status qinfo))))
383 ((setq qinfo (assoc (list server port stream-type)
384 wl-plugged-dop-queue-alist))
387 (wl-set-string-width column line)
388 (wl-plugged-dop-queue-status qinfo column)))))
390 (setq alist (cdr alist)))
391 (delete-region (1- (point-max)) (point-max)) ;; delete line at the end.
392 (goto-char (point-min))
394 (wl-highlight-plugged-current-line)
396 (set-buffer-modified-p nil)
397 (count-lines (point-min) (point-max)))
399 (defun wl-plugged-redrawing-switch (indent switch &optional time)
401 (when (re-search-forward
402 (format "^%s\\[\\([^]]+\\)\\]" (make-string indent ? )))
403 (goto-char (match-beginning 1))
404 (delete-region (match-beginning 1) (match-end 1))
405 (insert (wl-plugged-string switch time))
406 (wl-highlight-plugged-current-line)
409 (defun wl-plugged-redrawing (plugged-alist)
410 (let ((buffer-read-only nil)
411 (alist plugged-alist)
412 last server port plugged time)
413 (goto-char (point-min))
414 (wl-plugged-redrawing-switch 0 (elmo-plugged-p))
416 (setq server (caaar alist)
418 plugged (nth 2 (car alist))
419 time (nth 3 (car alist)))
420 (unless (string= last server)
422 (wl-plugged-redrawing-switch
423 wl-plugged-server-indent
424 (elmo-plugged-p server nil plugged-alist))
427 (wl-plugged-redrawing-switch
428 wl-plugged-port-indent plugged time)
429 (setq alist (cdr alist))))
431 (set-buffer-modified-p nil))
433 (defun wl-plugged-change ()
435 (if (not elmo-plugged-alist)
436 (message "No plugged info")
437 (setq wl-plugged-winconf (current-window-configuration))
438 (let* ((cur-win (selected-window))
439 (max-lines (if (eq major-mode 'wl-summary-mode)
444 (set-buffer (get-buffer-create wl-plugged-buf-name))
446 (buffer-disable-undo (current-buffer))
447 (delete-windows-on (current-buffer))
448 (wl-plugged-set-variables)
449 (setq lines (wl-plugged-drawing wl-plugged-alist)))
450 (select-window cur-win)
451 (setq window-lines (min max-lines (max lines window-min-height)))
452 (when (> (- (window-height) window-lines) window-min-height)
453 (split-window cur-win (- (window-height) window-lines)))
454 (switch-to-buffer wl-plugged-buf-name)
457 (enlarge-window (- window-lines (window-height)))
458 (when (fboundp 'pos-visible-in-window-p)
459 (goto-char (point-min))
460 (while (and (< (window-height) max-lines)
461 (not (pos-visible-in-window-p (1- (point-max)))))
462 (enlarge-window 2))))
464 (goto-char (point-min))
466 (wl-plugged-move-to-next)))) ;; goto first entry
468 (defsubst wl-plugged-get-server ()
471 (wl-plugged-move-to-previous-server)
473 (when (looking-at (format "^%s\\[[^]]+\\]\\(.*\\)"
474 (wl-plugged-server-indent)))
475 (elmo-match-buffer 1))))
477 (defun wl-plugged-toggle ()
479 (let ((cur-point (point)))
485 (let (variable switch name)
486 (goto-char cur-point)
487 (when (and (not (bobp))
488 (not (eq (char-before) ? )))
489 (if (re-search-backward " [^ ]+" nil t)
491 (re-search-backward "^[^ ]+" nil t)))
492 (when (looking-at "\\([^ :[]+\\):?\\[\\([^]]+\\)\\]")
493 (setq name (elmo-match-buffer 1))
494 (setq switch (not (string= (elmo-match-buffer 2) wl-plugged-plug-on)))
495 (when (setq variable (cdr (assoc name wl-plugged-switch-variables)))
496 (set variable switch))
497 (goto-char (match-beginning 2))
498 (let ((buffer-read-only nil))
499 (delete-region (match-beginning 2) (match-end 2))
500 (insert (wl-plugged-string switch))
501 (set-buffer-modified-p nil)))))
503 ((looking-at "^\\( *\\)\\[\\([^]]+\\)\\]\\([^ \n]*\\)")
504 (let* ((indent (length (elmo-match-buffer 1)))
505 (switch (elmo-match-buffer 2))
506 (name (elmo-match-buffer 3))
507 (plugged (not (string= switch wl-plugged-plug-on)))
508 (alist wl-plugged-alist)
509 server port stream-type name-1)
511 ((eq indent wl-plugged-port-indent) ;; toggle port plug
513 ((string-match "\\([^([]*\\)(\\([^)[]+\\))" name)
514 (setq port (string-to-int (elmo-match-string 2 name)))
515 (if (string-match "!" (setq name-1 (elmo-match-string 1 name)))
517 (intern (substring name-1 (match-end 0))))))
520 (setq server (wl-plugged-get-server))
521 (elmo-set-plugged plugged server port stream-type nil alist))
522 ((eq indent wl-plugged-server-indent) ;; toggle server plug
523 (elmo-set-plugged plugged name nil nil nil alist))
524 ((eq indent 0) ;; toggle all plug
525 (elmo-set-plugged plugged nil nil nil nil alist)))
527 (wl-plugged-redrawing wl-plugged-alist)
528 ;; show plugged status in modeline
529 (let ((elmo-plugged wl-plugged-switch))
530 (setq wl-plugged-switch (elmo-plugged-p)
531 wl-modeline-plug-status wl-plugged-switch)
532 (force-mode-line-update t))))))
533 (setq wl-plugged-alist-modified t)
534 (goto-char cur-point)))
536 (defun wl-plugged-click (e)
541 (defun wl-plugged-toggle-all ()
543 (let ((cur-point (point)))
544 (setq wl-plugged-switch (not wl-plugged-switch))
545 (elmo-set-plugged wl-plugged-switch nil nil nil nil wl-plugged-alist)
546 (wl-plugged-redrawing wl-plugged-alist)
547 (goto-char cur-point)
548 (setq wl-plugged-alist-modified t)
549 ;; show plugged status in modeline
550 (setq wl-modeline-plug-status wl-plugged-switch)
551 (force-mode-line-update t)))
553 (defun wl-plugged-exit ()
555 (setq ;;elmo-plugged-alist wl-plugged-alist
556 wl-plugged wl-plugged-switch
558 wl-plugged-sending-queue-alist nil
559 wl-plugged-dop-queue-alist nil)
560 (run-hooks 'wl-plugged-exit-hook)
561 (when wl-plugged-alist-modified
562 (wl-toggle-plugged (if wl-plugged 'on 'off) t))
563 (kill-buffer (current-buffer))
564 (if wl-plugged-winconf
565 (set-window-configuration wl-plugged-winconf)))
567 (defun wl-plugged-flush-queue ()
569 (let ((cur-point (point))
570 (dop-status (elmo-dop-queue-flush))
571 (send-status (wl-draft-queue-flush)))
572 (unless (or dop-status send-status)
573 (message "No processing queue."))
574 (wl-plugged-set-variables)
575 (wl-plugged-drawing wl-plugged-alist)
576 (goto-char cur-point)))
578 (defun wl-plugged-move-to-next ()
580 (when (re-search-forward "\\[\\([^]]+\\)\\]" nil t)
581 (let ((pos (match-beginning 1)))
582 (if (invisible-p pos)
583 (goto-char (next-visible-point pos))
586 (defun wl-plugged-move-to-previous ()
588 (if (eq (char-before) ?\]) (forward-char -1))
589 (when (re-search-backward "\\[\\([^]]+\\)\\]" nil t)
590 (let ((pos (match-beginning 1)))
591 (if (invisible-p pos)
592 (goto-char (next-visible-point pos))
595 (defun wl-plugged-move-to-next-server ()
598 (format "^%s\\[\\([^]]+\\)\\]" (wl-plugged-server-indent)))
602 (if (re-search-forward regexp nil t)
603 (setq point (match-beginning 1))))
604 (if point (goto-char point))))
606 (defun wl-plugged-move-to-previous-server ()
609 (format "^%s\\[\\([^]]+\\)\\]" (wl-plugged-server-indent))))
610 (if (re-search-backward regexp nil t)
611 (goto-char (match-beginning 1)))))
613 ;;; end of wl-plugged-mode
616 "Save summary and folder status."
618 (wl-save-status 'keep-summary)
619 (run-hooks 'wl-save-hook))
621 (defun wl-save-status (&optional keep-summary)
622 (message "Saving summary and folder status...")
625 (let ((summaries (wl-collect-summary)))
627 (with-current-buffer (car summaries)
629 (wl-summary-cleanup-temp-marks))
630 (wl-summary-save-view keep-summary)
631 (elmo-folder-commit wl-summary-buffer-elmo-folder)
633 (kill-buffer (car summaries))))
634 (setq summaries (cdr summaries))))))
635 (wl-refile-alist-save)
636 (wl-folder-info-save)
637 (and (featurep 'wl-fldmgr) (wl-fldmgr-exit))
638 (elmo-crosspost-message-alist-save)
639 (message "Saving summary and folder status...done"))
643 (when (or (not wl-interactive-exit)
644 (y-or-n-p "Quit Wanderlust? "))
647 (run-hooks 'wl-exit-hook)
649 (wl-folder-cleanup-variables)
650 (wl-message-buffer-cache-clean-up)
654 (list wl-folder-buffer-name
657 (if (and wl-folder-use-frame
658 (> (length (visible-frame-list)) 1))
661 (remove-hook 'kill-emacs-hook 'wl-save-status)
663 (message "") ; empty minibuffer.
668 (unless (featurep 'mime-setup)
669 (require 'mime-setup))
670 (setq elmo-plugged wl-plugged)
671 (add-hook 'kill-emacs-hook 'wl-save-status)
674 (wl-refile-alist-setup)
678 (fset 'wl-summary-from-func-internal
679 (symbol-value 'wl-summary-from-function))
680 (fset 'wl-summary-subject-func-internal
681 (symbol-value 'wl-summary-subject-function))
682 (fset 'wl-summary-subject-filter-func-internal
683 (symbol-value 'wl-summary-subject-filter-function))
684 (setq elmo-no-from wl-summary-no-from-message)
685 (setq elmo-no-subject wl-summary-no-subject-message)
687 ;; This hook may contain the functions `wl-plugged-init-icons' and
688 ;; `wl-biff-init-icons' for reasons of system internal to accord
689 ;; facilities for the Emacs variants.
690 (run-hooks 'wl-init-hook)))
692 (defun wl-check-environment (no-check-folder)
693 (unless wl-from (error "Please set `wl-from'"))
695 (unless (string-match "[^.]\\.[^.]" (or wl-message-id-domain
697 (concat (system-name)
700 (error "Please set `wl-local-domain' to get valid FQDN"))
701 (if (string-match "@" (or wl-message-id-domain
703 (concat (system-name)
706 (error "Please remove `@' from `wl-message-id-domain'"))
707 (if (string= wl-local-domain "localdomain")
708 (error "Please set `wl-local-domain'"))
709 (if (string= wl-message-id-domain "localhost.localdomain")
710 (error "Please set `wl-message-id-domain'"))
712 (when (not no-check-folder)
713 (let ((draft-folder (wl-folder-get-elmo-folder wl-draft-folder))
714 (queue-folder (wl-folder-get-elmo-folder wl-queue-folder))
715 (trash-folder (wl-folder-get-elmo-folder wl-trash-folder))
716 (lost+found-folder (wl-folder-get-elmo-folder
717 elmo-lost+found-folder)))
718 (if (not (elmo-folder-message-file-p draft-folder))
719 (error "%s is not allowed for draft folder" wl-draft-folder))
720 (unless (elmo-folder-exists-p draft-folder)
722 (format "Draft Folder %s does not exist, create it? "
724 (elmo-folder-create draft-folder)
725 (error "Draft Folder is not created")))
726 (if (and wl-draft-enable-queuing
727 (not (elmo-folder-exists-p queue-folder)))
729 (format "Queue Folder %s does not exist, create it? "
731 (elmo-folder-create queue-folder)
732 (error "Queue Folder is not created")))
733 (when (not (eq no-check-folder 'wl-draft))
734 (unless (elmo-folder-exists-p trash-folder)
736 (format "Trash Folder %s does not exist, create it? "
738 (elmo-folder-create trash-folder)
739 (error "Trash Folder is not created")))
740 (unless (elmo-folder-exists-p lost+found-folder)
741 (elmo-folder-create lost+found-folder)))
743 (unless (file-exists-p wl-tmp-dir)
745 (format "Temp directory (to save multipart) %s does not exist, create it now? "
747 (make-directory wl-tmp-dir)
748 (error "Temp directory is not created"))))))
751 (defun wl (&optional arg)
752 "Start Wanderlust -- Yet Another Message Interface On Emacsen.
753 If ARG (prefix argument) is specified, folder checkings are skipped."
759 (let (demo-buf check)
761 (if wl-demo (setq demo-buf (wl-demo)))
769 (message "Checking environment...")
770 (wl-check-environment arg)
771 (message "Checking environment...done"))
774 (wl-plugged-init (wl-folder arg))
776 (run-hooks 'wl-auto-check-folder-pre-hook)
777 (wl-folder-auto-check)
778 (run-hooks 'wl-auto-check-folder-hook))
779 (unless arg (wl-biff-start)))
781 (if (buffer-live-p demo-buf)
782 (kill-buffer demo-buf))
783 (signal (car obj)(cdr obj)))
785 (if (buffer-live-p demo-buf)
786 (kill-buffer demo-buf)))
787 (run-hooks 'wl-hook))
789 ;; Define some autoload functions WL might use.
791 ;; This little mapcar goes through the list below and marks the
792 ;; symbols in question as autoloaded functions.
796 (let ((interactive (nth 1 (memq ':interactive package))))
801 (when (consp function)
802 (setq keymap (car (memq 'keymap function)))
803 (setq function (car function)))
804 (autoload function (car package) nil interactive keymap))))
805 (if (eq (nth 1 package) ':interactive)
808 '(("wl-fldmgr" :interactive t
809 wl-fldmgr-access-display-all wl-fldmgr-access-display-normal
810 wl-fldmgr-add wl-fldmgr-clear-cut-entity-list wl-fldmgr-copy
811 wl-fldmgr-copy-region wl-fldmgr-cut wl-fldmgr-cut-region
812 wl-fldmgr-make-access-group wl-fldmgr-make-filter
813 wl-fldmgr-make-group wl-fldmgr-make-multi
814 wl-fldmgr-reconst-entity-hashtb wl-fldmgr-rename wl-fldmgr-delete
815 wl-fldmgr-save-folders wl-fldmgr-set-petname wl-fldmgr-sort
816 wl-fldmgr-subscribe wl-fldmgr-subscribe-region
817 wl-fldmgr-unsubscribe wl-fldmgr-unsubscribe-region wl-fldmgr-yank )
818 ("wl-acap" wl-acap-init)
819 ("wl-acap" :interactive t wl-acap-store)
821 (wl-fldmgr-mode-map keymap)
822 wl-fldmgr-add-entity-hashtb)
823 ("wl-expire" :interactive t
824 wl-folder-archive-current-entity
825 wl-folder-expire-current-entity wl-summary-archive
828 wl-score-save wl-summary-rescore-msgs wl-summary-score-headers
829 wl-summary-score-update-all-lines )
830 ("wl-score" :interactive t
831 wl-score-change-score-file wl-score-edit-current-scores
832 wl-score-edit-file wl-score-flush-cache wl-summary-rescore
833 wl-score-set-mark-below wl-score-set-expunge-below
834 wl-summary-increase-score wl-summary-lower-score ))))
836 ;; for backward compatibility
837 (defalias 'wl-summary-from-func-petname 'wl-summary-default-from)
840 (product-provide (provide 'wl) (require 'wl-version))