From: hmurata Date: Wed, 23 Jun 2004 10:00:38 +0000 (+0000) Subject: This is transient implementation for UI testing. X-Git-Tag: wl-2_11_31~89 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=e3b3e8d0f7522fdcbe39a6f99099179765ec9e96;p=elisp%2Fwanderlust.git This is transient implementation for UI testing. * wl-summary.el (wl-summary-number-list-from-region): New function. (wl-summary-mark-as-read-region): Use it. (wl-summary-mark-as-unread-region): Ditto. (wl-summary-set-flags-region): Ditto and add optional argument remove. (wl-summary-mark-as-answered-region): Ditto. (wl-summary-mark-as-important-region): Ditto. (wl-summary-target-mark-mark-as-important): Added optional argument remove. (wl-summary-target-mark-mark-as-answered): Ditto. (wl-summary-target-mark-set-flags): Ditto. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index 80a447e..1626966 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,18 @@ +2004-06-23 Hiroya Murata + + * wl-summary.el (wl-summary-number-list-from-region): New + function. + (wl-summary-mark-as-read-region): Use it. + (wl-summary-mark-as-unread-region): Ditto. + (wl-summary-set-flags-region): Ditto and add optional argument + remove. + (wl-summary-mark-as-answered-region): Ditto. + (wl-summary-mark-as-important-region): Ditto. + (wl-summary-target-mark-mark-as-important): Added optional + argument remove. + (wl-summary-target-mark-mark-as-answered): Ditto. + (wl-summary-target-mark-set-flags): Ditto. + 2004-06-22 Hiroya Murata * wl-summary.el (wl-summary-set-flags-region): Call diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 9d7d13b..96b8727 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1529,140 +1529,80 @@ If ARG is non-nil, checking is omitted." (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) @@ -2968,31 +2908,22 @@ The mark is decided according to the FOLDER, FLAGS and CACHED." 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))))