(defvar wl-news-version-file-name "previous-version")
(defvar wl-news-default-previous-version '(2 0 0))
+(defvar wl-news-lang
+ (if (and (boundp 'current-language-environment)
+ (string-equal "Japanese"
+ (symbol-value 'current-language-environment)))
+ '("ja" "en") '("en" "ja"))
+ "The list of languages to show NEWS. (order sensitive)")
+
(defun wl-news-check ()
(let* ((updated (not (wl-news-already-current-p))))
(if updated
(let ((filename (expand-file-name
wl-news-version-file-name
elmo-msgdb-directory))
- (tmp-buffer (get-buffer-create " *wl-news-version-tmp*")))
+ (tmp-buffer (get-buffer-create " *wl-news-version-tmp*"))
+ print-length print-level)
(set-buffer tmp-buffer)
(erase-buffer)
(prin1 (cons current-version previous-version) tmp-buffer)
(require 'wl-mime)
(let ((news-list (cdr (assoc lang wl-news-news-alist)))
ret)
- (if no-mime-tag
- (insert "--------------\n")
- (mime-edit-insert-tag "text" "plain" "" ""))
- (while (< 0
- (product-version-compare
- (car (car news-list))
- previous-version))
- (setq ret t)
- (insert (cdr (car news-list)) "\n\n")
- (setq news-list (cdr news-list)))
+ (when news-list
+ (if no-mime-tag
+ (insert "--------------\n")
+ (mime-edit-insert-tag "text" "plain" "" ""))
+ (while (< 0
+ (product-version-compare
+ (car (car news-list))
+ previous-version))
+ (setq ret t)
+ (insert (cdr (car news-list)) "\n\n")
+ (setq news-list (cdr news-list))))
ret))
(defun wl-news-check-news (version news-lang)
(product-version (product-find 'wl-version))
(car (wl-news-previous-version-load)))))
-(defun wl-news-send-news (version news-lang)
+(defun wl-news-send-news (version news-lang folder)
(require 'wl-draft)
(let ((lang (if (listp wl-news-lang)
wl-news-lang
(wl-draft-get-header-delimiter t)
(setq ret
(and (elmo-folder-writable-p
- (wl-folder-get-elmo-folder wl-default-folder))
+ (wl-folder-get-elmo-folder folder))
(elmo-folder-append-buffer
- (wl-folder-get-elmo-folder wl-default-folder) t)))
+ (wl-folder-get-elmo-folder folder))))
(wl-draft-hide send-buffer)
(wl-draft-delete send-buffer))
ret))
(defvar wl-news-buf-name "NEWS")
(defvar wl-news-mode-map nil)
(defvar wl-news-winconf nil)
+(defvar wl-news-buffer-oldest-version nil)
+(make-variable-buffer-local 'wl-news-buffer-oldest-version)
(unless wl-news-mode-map
(setq wl-news-mode-map (make-sparse-keymap))
(define-key wl-news-mode-map "q" 'wl-news-exit)
- (define-key wl-news-mode-map "Q" 'wl-news-discard-and-mail)
+ (define-key wl-news-mode-map "Q" 'wl-news-force-exit)
(define-key wl-news-mode-map "\C-xk" 'wl-news-exit)
+ (define-key wl-news-mode-map "a" 'wl-news-show-all)
+ (define-key wl-news-mode-map "m" 'wl-news-append-to-folder)
(define-key wl-news-mode-map "\C-m" 'wl-news-next-line)
(define-key wl-news-mode-map " " 'wl-news-next-page))
(setq wl-news-winconf (current-window-configuration))
(set-buffer (get-buffer-create wl-news-buf-name))
(wl-news-mode)
+ (setq wl-news-buffer-oldest-version previous-version)
(buffer-disable-undo (current-buffer))
;; insert news
(let ((buffer-read-only nil))
- (insert "--- Wanderlust NEWS --- press 'q' for exit\n")
- (if (wl-news-already-current-p)
- (insert " press 'Q' for discard this message\n\n"))
+ (insert "--- Wanderlust NEWS --- press 'a' to show all NEWS\n")
+ (insert " press 'm' to mail this NEWS to your folder\n")
+ (insert " press 'q' to quit\n")
+ (insert " press 'Q' to force quit\n\n")
(while (car lang)
(wl-news-append-news
(car lang) previous-version t)
(interactive)
(scroll-up))
+(defun wl-news-show-all ()
+ (interactive)
+ (when (eq major-mode 'wl-news-mode)
+ (kill-buffer (current-buffer))
+ (wl-news t)))
+
(defun wl-news-exit ()
(interactive)
- (if (eq major-mode 'wl-news-mode)
- (if (not (wl-news-already-current-p))
- (wl-news-discard-and-mail)
- (kill-buffer (current-buffer))
- (if wl-news-winconf
- (set-window-configuration wl-news-winconf)))))
-
-(defun wl-news-discard-and-mail ()
+ (let* ((oldest-version (cdr (wl-news-previous-version-load)))
+ (current-version (product-version (product-find 'wl-version)))
+ (new-old-version current-version)
+ (buf (get-buffer wl-news-buf-name)))
+ (when buf
+ (if (wl-news-check-news oldest-version wl-news-lang)
+ (if (y-or-n-p "Do you want to see this message again? ")
+ (progn
+ (message "Please M-x wl-news if you want to see it.")
+ (setq new-old-version oldest-version))))
+ (wl-news-previous-version-save
+ current-version new-old-version)
+ (kill-buffer (current-buffer))
+ (if wl-news-winconf
+ (set-window-configuration wl-news-winconf))
+ (kill-buffer buf)
+ (if wl-news-winconf
+ (set-window-configuration wl-news-winconf)))))
+
+(defun wl-news-append-to-folder ()
(interactive)
- (if (eq major-mode 'wl-news-mode)
- (let* ((oldest-version (cdr (wl-news-previous-version-load)))
- (current-version (product-version (product-find 'wl-version)))
- (new-old-version current-version))
- (if (wl-news-check-news oldest-version wl-news-lang)
- (if (y-or-n-p "Do you want to see this message again? ")
- (progn
- (message "Please M-x wl-news if you want to see it.")
- (setq new-old-version oldest-version))
- (if (y-or-n-p "Do you want this message for a mail? ")
- (or (wl-news-send-news oldest-version wl-news-lang)
- (error
- (format "Cannot append NEWS mail to %s" wl-default-folder))))))
- (wl-news-previous-version-save
- current-version new-old-version)
- (kill-buffer (current-buffer))
- (if wl-news-winconf
- (set-window-configuration wl-news-winconf)))))
+ (let* ((current-version (product-version (product-find 'wl-version)))
+ (new-old-version current-version)
+ (folder wl-default-folder))
+ (if (or (and (elmo-folder-writable-p
+ (wl-folder-get-elmo-folder folder))
+ (y-or-n-p (format
+ "Do you want to append this message to %s ? "
+ wl-default-folder)))
+ (setq folder
+ (wl-summary-read-folder wl-default-folder "to append ")))
+ (or (wl-news-send-news wl-news-buffer-oldest-version wl-news-lang folder)
+ (error "Cannot append NEWS mail to %s" folder)))))
+
+(defun wl-news-force-exit ()
+ (interactive)
+ (let ((buf))
+ (when (setq buf (get-buffer wl-news-buf-name))
+ (wl-news-previous-version-save
+ (product-version (product-find 'wl-version))
+ (cdr (wl-news-previous-version-load)))
+ (kill-buffer buf)
+ (if wl-news-winconf
+ (set-window-configuration wl-news-winconf)))))
(require 'product)