;;; wl-folder.el -- Folder mode for Wanderlust.
-;; Copyright 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
-;; Masahiro MURATA <muse@ba2.so-net.ne.jp>
+;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
;; Author: Yuuichi Teranishi <teranisi@gohome.org>
;; Masahiro MURATA <muse@ba2.so-net.ne.jp>
(define-key wl-folder-mode-map "g" 'wl-folder-goto-folder)
(define-key wl-folder-mode-map "j" 'wl-folder-jump-to-current-entity)
(define-key wl-folder-mode-map "w" 'wl-draft)
- (define-key wl-folder-mode-map "W" 'wl-folder-write-current-newsgroup)
+ (define-key wl-folder-mode-map "W" 'wl-folder-write-current-folder)
(define-key wl-folder-mode-map "\C-c\C-o" 'wl-jump-to-draft-buffer)
(define-key wl-folder-mode-map "rS" 'wl-folder-sync-region)
(define-key wl-folder-mode-map "S" 'wl-folder-sync-current-entity)
(elmo-msgdb-expand-path entity))
entity)))
(cdr nums))
- (current-buffer)))
+ (get-buffer wl-folder-buffer-name)))
(setq wl-folder-info-alist-modified t)
(sit-for 0)
(list (if wl-folder-notify-deleted
(setq unread (or (cadr nums) 0))
(if (or (not unread-only)
(or (< 0 new) (< 0 unread)))
- (save-window-excursion
- (save-excursion
- (wl-summary-goto-folder-subr entity
- (wl-summary-get-sync-range entity)
- nil nil nil t)
- (wl-summary-exit))))))))
+ (let ((wl-summary-buffer-name (concat
+ wl-summary-buffer-name
+ (symbol-name this-command)))
+ (wl-message-buf-name (concat wl-message-buf-name
+ (symbol-name this-command))))
+ (save-window-excursion
+ (save-excursion
+ (wl-summary-goto-folder-subr entity
+ (wl-summary-get-sync-range entity)
+ nil nil nil t)
+ (wl-summary-exit)))))))))
(defun wl-folder-sync-current-entity (&optional unread-only)
"Synchronize the folder at position.
(setq new (or (car nums) 0))
(setq unread (or (cadr nums) 0))
(if (or (< 0 new) (< 0 unread))
- (save-window-excursion
- (save-excursion
- (wl-summary-goto-folder-subr entity
- (wl-summary-get-sync-range entity)
- nil)
- (wl-summary-mark-as-read-all)
- (wl-summary-exit)))
+ (let ((wl-summary-buffer-name (concat
+ wl-summary-buffer-name
+ (symbol-name this-command)))
+ (wl-message-buf-name (concat wl-message-buf-name
+ (symbol-name this-command))))
+ (save-window-excursion
+ (save-excursion
+ (wl-summary-goto-folder-subr entity
+ (wl-summary-get-sync-range entity)
+ nil)
+ (wl-summary-mark-as-read-all)
+ (wl-summary-exit))))
(sit-for 0))))))
(defun wl-folder-mark-as-read-all-current-entity ()
(defun wl-folder-mode ()
"Major mode for Wanderlust Folder.
-See info under Wanderlust for full documentation.
+See Info under Wanderlust for full documentation.
Special commands:
\\{wl-folder-mode-map}
wl-nntp-posting-server
elmo-default-nntp-port
nil nil "nntp" add))
- ;; 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-make-plugged-hook)))
(defvar wl-folder-init-func 'wl-local-folder-init)
(setq alist (cdr alist)))
hashtb))
+(defun wl-folder-get-newsgroups (folder)
+ "Return Newsgroups field value string for FOLDER newsgroup.
+If FOLDER is multi, return comma separated string (cross post)."
+ (let ((flist (elmo-folder-get-primitive-folder-list folder)) ; multi
+ newsgroups fld ret)
+ (while (setq fld (car flist))
+ (if (setq ret
+ (cond ((eq 'nntp (elmo-folder-get-type fld))
+ (nth 1 (elmo-folder-get-spec fld)))
+ ((eq 'localnews (elmo-folder-get-type fld))
+ (elmo-replace-in-string
+ (nth 1 (elmo-folder-get-spec fld)) "/" "\\."))))
+ ;; append newsgroup
+ (setq newsgroups (if (stringp newsgroups)
+ (concat newsgroups "," ret)
+ ret)))
+ (setq flist (cdr flist)))
+ (list nil nil newsgroups)))
+
+(defun wl-folder-guess-mailing-list-by-refile-rule (folder)
+ "Return ML address guess by FOLDER.
+Use `wl-subscribed-mailing-list' and `wl-refile-rule-alist'.
+Don't care multi."
+ (setq folder (car (elmo-folder-get-primitive-folder-list folder)))
+ (unless (memq (elmo-folder-get-type folder)
+ '(localnews nntp))
+ (let ((rules wl-refile-rule-alist)
+ mladdress tokey toalist histkey)
+ (while rules
+ (if (or (and (stringp (car (car rules)))
+ (string-match "[Tt]o" (car (car rules))))
+ (and (listp (car (car rules)))
+ (elmo-string-matched-member "to" (car (car rules))
+ 'case-ignore)))
+ (setq toalist (append toalist (cdr (car rules)))))
+ (setq rules (cdr rules)))
+ (setq tokey (car (rassoc folder toalist)))
+;;; (setq histkey (car (rassoc folder wl-refile-alist)))
+ ;; case-ignore search `wl-subscribed-mailing-list'
+ (if (stringp tokey)
+ (list
+ (elmo-string-matched-member tokey wl-subscribed-mailing-list t)
+ nil nil)
+ nil))))
+
+(defun wl-folder-guess-mailing-list-by-folder-name (folder)
+ "Return ML address guess by FOLDER name's last hierarchy.
+Use `wl-subscribed-mailing-list'."
+ (setq folder (car (elmo-folder-get-primitive-folder-list folder)))
+ (when (memq (elmo-folder-get-type folder)
+ '(localdir imap4 maildir))
+ (let (key mladdress)
+ (setq folder (substring folder 1)) ; remove folder type symbol
+ (when (string-match "[^\\./]+$" folder)
+ (setq key (regexp-quote
+ (concat (substring folder (match-beginning 0)) "@")))
+ (setq mladdress
+ (elmo-string-matched-member
+ key wl-subscribed-mailing-list 'case-ignore))
+ (if (stringp mladdress)
+ (list mladdress nil nil)
+ nil)))))
+
(defun wl-folder-update-diff-line (diffs)
(let ((inhibit-read-only t)
(buffer-read-only nil)
(setq count (+ count (wl-folder-count-incorporates entity)))
(if (or (null (car nums)) ; unknown
(< 0 count))
- (save-window-excursion
- (save-excursion
- (wl-summary-goto-folder-subr entity
- (wl-summary-get-sync-range entity)
- nil)
- (setq ret-val (wl-summary-incorporate))
- (wl-summary-exit)
- ret-val))
+ (let ((wl-summary-buffer-name (concat
+ wl-summary-buffer-name
+ (symbol-name this-command)))
+ (wl-message-buf-name (concat wl-message-buf-name
+ (symbol-name this-command))))
+ (save-window-excursion
+ (save-excursion
+ (wl-summary-goto-folder-subr entity
+ (wl-summary-get-sync-range entity)
+ nil)
+ (setq ret-val (wl-summary-incorporate))
+ (wl-summary-exit)
+ ret-val)))
(cons 0 0))))))
(defun wl-folder-count-incorporates (folder)
wl-summary-highlight wl-auto-select-first new)
(setq new (or (car nums) 0))
(if (< 0 new)
- (save-window-excursion
- (save-excursion
- (wl-summary-goto-folder-subr entity 'no-sync nil)
- (wl-summary-drop-unsync)
- (wl-summary-exit))))))))
+ (let ((wl-summary-buffer-name (concat
+ wl-summary-buffer-name
+ (symbol-name this-command)))
+ (wl-message-buf-name (concat wl-message-buf-name
+ (symbol-name this-command))))
+ (save-window-excursion
+ (save-excursion
+ (wl-summary-goto-folder-subr entity 'no-sync nil)
+ (wl-summary-drop-unsync)
+ (wl-summary-exit)))))))))
(defun wl-folder-drop-unsync-current-entity (&optional force-check)
"Drop all unsync messages in the folder at position.
(wl-folder-drop-unsync-entity entity)
(message "All unsync messages in %s are dropped!" entity-name)))))
-(defun wl-folder-write-current-newsgroup ()
- ""
+(defun wl-folder-write-current-folder ()
+ "Write message to current folder's newsgroup or mailing-list.
+Call `wl-summary-write-current-folder' with current folder name."
(interactive)
- (wl-summary-write-current-newsgroup (wl-folder-entity-name)))
+ (unless (wl-folder-buffer-group-p)
+ (wl-summary-write-current-folder
+ (wl-folder-get-realname (wl-folder-entity-name)))))
(defun wl-folder-mimic-kill-buffer ()
"Kill the current (Folder) buffer with query."