(defun wl-summary-delete-all-target-marks ()
(wl-summary-delete-marks-on-buffer wl-summary-buffer-target-mark-list))
-(defun wl-summary-mark-as-read-region (beg end)
- (interactive "r")
+(defun wl-summary-number-list-from-region (beg end)
(save-excursion
(save-restriction
(wl-summary-narrow-to-region beg end)
(goto-char (point-min))
- (if (eq wl-summary-buffer-view 'thread)
- (let (number-list)
+ (let (number-list)
+ (if (eq wl-summary-buffer-view 'thread)
(while (not (eobp))
(let* ((number (wl-summary-message-number))
(entity (wl-thread-get-entity number)))
- (if (wl-thread-entity-get-opened entity)
- (setq number-list (append number-list (list number)))
- (setq number-list
- (append number-list
- (wl-thread-get-children-msgs number))))
+ (setq number-list
+ (nconc number-list
+ (if (wl-thread-entity-get-opened entity)
+ (list number)
+ (wl-thread-get-children-msgs number))))
(forward-line 1)))
- (wl-summary-mark-as-read number-list))
- (let (number-list)
(while (not (eobp))
(setq number-list
- (append number-list (list (wl-summary-message-number))))
- (forward-line 1))
- (wl-summary-mark-as-read number-list))))))
+ (nconc number-list (list (wl-summary-message-number))))
+ (forward-line 1)))
+ number-list))))
-(defun wl-summary-mark-as-unread-region (beg end)
+(defun wl-summary-mark-as-read-region (beg end)
(interactive "r")
- (save-excursion
- (save-restriction
- (wl-summary-narrow-to-region beg end)
- (goto-char (point-min))
- (if (eq wl-summary-buffer-view 'thread)
- (let (number-list)
- (while (not (eobp))
- (let* ((number (wl-summary-message-number))
- (entity (wl-thread-get-entity number)))
- (if (wl-thread-entity-get-opened entity)
- (setq number-list (append number-list (list number)))
- (setq number-list
- (append number-list
- (wl-thread-get-children-msgs number))))
- (forward-line 1)))
- (wl-summary-mark-as-unread number-list))
- (let (number-list)
- (while (not (eobp))
- (setq number-list
- (append number-list (list (wl-summary-message-number))))
- (forward-line 1))
- (wl-summary-mark-as-unread number-list))))))
+ (let ((number-list (wl-summary-number-list-from-region beg end)))
+ (if (null number-list)
+ (message "No message.")
+ (wl-summary-mark-as-read number-list))))
-(defun wl-summary-set-flags-region (beg end)
+(defun wl-summary-mark-as-unread-region (beg end)
(interactive "r")
- (save-excursion
- (save-restriction
- (wl-summary-narrow-to-region beg end)
- (goto-char (point-min))
- (let (numbers)
- (if (eq wl-summary-buffer-view 'thread)
- (while (not (eobp))
- (let* ((number (wl-summary-message-number))
- (entity (wl-thread-get-entity number))
- children)
- (if (wl-thread-entity-get-opened entity)
- ;; opened...mark line.
- (setq numbers (nconc numbers (list number)))
- ;; closed
- (setq numbers
- (nconc numbers
- (wl-thread-get-children-msgs number))))
- (forward-line 1)))
- (while (not (eobp))
- (setq numbers (nconc numbers (list (wl-summary-message-number))))
- (forward-line 1)))
- (wl-summary-set-flags-internal numbers))))
- (wl-summary-count-unread)
- (wl-summary-update-modeline))
+ (let ((number-list (wl-summary-number-list-from-region beg end)))
+ (if (null number-list)
+ (message "No message.")
+ (wl-summary-mark-as-unread number-list))))
-(defun wl-summary-mark-as-answered-region (beg end)
- (interactive "r")
- (save-excursion
- (save-restriction
- (wl-summary-narrow-to-region beg end)
- (goto-char (point-min))
- (let ((inverse (elmo-message-flagged-p wl-summary-buffer-elmo-folder
- (wl-summary-message-number)
- 'answered)))
- (if (eq wl-summary-buffer-view 'thread)
- (while (not (eobp))
- (let* ((number (wl-summary-message-number))
- (entity (wl-thread-get-entity number))
- children)
- (if (wl-thread-entity-get-opened entity)
- ;; opened...mark line.
- ;; Crossposts are not processed
- (wl-summary-mark-as-answered-internal inverse)
- ;; closed
- (wl-summary-mark-as-answered-internal
- inverse
- (wl-thread-get-children-msgs number)))
- (forward-line 1)))
- (while (not (eobp))
- (wl-summary-mark-as-answered-internal inverse)
- (forward-line 1))))))
- (wl-summary-count-unread)
- (wl-summary-update-modeline))
+(defun wl-summary-set-flags-region (beg end &optional remove)
+ (interactive "r\nP")
+ (let ((number-list (wl-summary-number-list-from-region beg end)))
+ (if (null number-list)
+ (message "No message.")
+ (wl-summary-set-flags-internal number-list nil nil remove)
+ (wl-summary-count-unread)
+ (wl-summary-update-modeline))))
-(defun wl-summary-mark-as-important-region (beg end)
- (interactive "r")
- (save-excursion
- (save-restriction
- (wl-summary-narrow-to-region beg end)
- (goto-char (point-min))
- (let ((inverse (elmo-message-flagged-p wl-summary-buffer-elmo-folder
- (wl-summary-message-number)
- 'important)))
- (if (eq wl-summary-buffer-view 'thread)
- (while (not (eobp))
- (let* ((number (wl-summary-message-number))
- (entity (wl-thread-get-entity number))
- children)
- (if (wl-thread-entity-get-opened entity)
- ;; opened...mark line.
- ;; Crossposts are not processed
- (wl-summary-mark-as-important-internal inverse)
- ;; closed
- (wl-summary-mark-as-important-internal
- inverse
- (wl-thread-get-children-msgs number)))
- (forward-line 1)))
- (while (not (eobp))
- (wl-summary-mark-as-important-internal inverse)
- (forward-line 1))))))
- (wl-summary-count-unread)
- (wl-summary-update-modeline))
+(defun wl-summary-mark-as-answered-region (beg end &optional remove)
+ (interactive "r\nP")
+ (let ((number-list (wl-summary-number-list-from-region beg end))
+ (remove (or remove
+ (elmo-message-flagged-p wl-summary-buffer-elmo-folder
+ (save-excursion
+ (goto-char beg)
+ (wl-summary-message-number))
+ 'answered))))
+ (if (null number-list)
+ (message "No message.")
+ (wl-summary-mark-as-answered-internal remove number-list)
+ (wl-summary-count-unread)
+ (wl-summary-update-modeline))))
+
+(defun wl-summary-mark-as-important-region (beg end &optional remove)
+ (interactive "r\nP")
+ (let ((number-list (wl-summary-number-list-from-region beg end))
+ (remove (or remove
+ (elmo-message-flagged-p wl-summary-buffer-elmo-folder
+ (save-excursion
+ (goto-char beg)
+ (wl-summary-message-number))
+ 'important))))
+ (if (null number-list)
+ (message "No message.")
+ (wl-summary-mark-as-important-internal remove number-list)
+ (wl-summary-count-unread)
+ (wl-summary-update-modeline))))
(defun wl-summary-mark-as-read-all ()
(interactive)
wl-summary-buffer-target-mark-list)
(wl-summary-delete-all-target-marks))))
-(defun wl-summary-target-mark-mark-as-important ()
- (interactive)
- (wl-summary-target-mark-operation
- 'important
- (and (interactive-p)
- (elmo-message-flagged-p wl-summary-buffer-elmo-folder
- (car wl-summary-buffer-target-mark-list)
- 'important))))
+(defun wl-summary-target-mark-mark-as-important (&optional remove)
+ (interactive "P")
+ (wl-summary-target-mark-operation 'important remove))
-(defun wl-summary-target-mark-mark-as-answered ()
- (interactive)
- (wl-summary-target-mark-operation
- 'answered
- (and (interactive-p)
- (elmo-message-flagged-p wl-summary-buffer-elmo-folder
- (car wl-summary-buffer-target-mark-list)
- 'answered))))
+(defun wl-summary-target-mark-mark-as-answered (&optional remove)
+ (interactive "P")
+ (wl-summary-target-mark-operation 'answered remove))
-(defun wl-summary-target-mark-set-flags ()
- (interactive)
+(defun wl-summary-target-mark-set-flags (&optional remove)
+ (interactive "P")
(save-excursion
(let ((inhibit-read-only t)
(buffer-read-only nil)
wl-summary-buffer-disp-msg)
- (wl-summary-set-flags-internal wl-summary-buffer-target-mark-list)
+ (wl-summary-set-flags-internal wl-summary-buffer-target-mark-list
+ nil nil remove)
(wl-summary-delete-all-target-marks)
(wl-summary-count-unread)
(wl-summary-update-modeline))))