* check-modules.el (test-shimbun): Check `shimbun-server'.
[elisp/wanderlust.git] / wl / wl-action.el
index e954bf3..0670d14 100644 (file)
 
 (require 'wl-summary)
 
+(eval-when-compile
+  (defalias-maybe 'wl-summary-target-mark 'ignore)
+  (defalias-maybe 'wl-summary-target-mark-region 'ignore))
+
 (defsubst wl-summary-action-mark (action)
   (nth 0 action))
 (defsubst wl-summary-action-symbol (action)
@@ -44,7 +48,8 @@
 (defsubst wl-summary-action-face (action)
   (nth 5 action))
 (defsubst wl-summary-action-docstring (action)
-  (nth 6 action))
+  (concat (nth 6 action)
+         "\nThis function is defined by `wl-summary-define-mark-action'."))
 
 ;; Set mark
 (defun wl-summary-set-mark (&optional set-mark number interactive data)
@@ -59,6 +64,8 @@ Return number if put mark succeed"
         (current (wl-summary-message-number))
         (action (assoc set-mark wl-summary-mark-action-list))
         visible mark cur-mark)
+    (when (zerop (elmo-folder-length wl-summary-buffer-elmo-folder))
+      (error "Set mark failed"))
     (prog1
        (save-excursion
          ;; Put mark
@@ -69,6 +76,8 @@ Return number if put mark succeed"
                         (and (null number) current))
                number (or number current)
                cur-mark (nth 1 (wl-summary-registered-temp-mark number)))
+         (unless number
+           (error "No message"))
          (if (wl-summary-reserve-temp-mark-p cur-mark)
              (when interactive
                (error "Already marked as `%s'" cur-mark))
@@ -105,7 +114,8 @@ Return number if put mark succeed"
            (cons number wl-summary-buffer-target-mark-list))))
 
 (defun wl-summary-unregister-target-mark (number)
-  (delq number wl-summary-buffer-target-mark-list))
+  (setq wl-summary-buffer-target-mark-list
+       (delq number wl-summary-buffer-target-mark-list)))
 
 (defun wl-summary-have-target-mark-p (number)
   (memq number wl-summary-buffer-target-mark-list))
@@ -212,7 +222,7 @@ Return number if put mark succeed"
     (let ((buffer-read-only nil)
          visible mark action)
       (if number
-         (setq visible (wl-summary-jump-to-msg number))
+         (setq visible (wl-summary-jump-to-msg number)) ; can be nil
        (setq visible t))
       (setq number (or number (wl-summary-message-number)))
       ;; Delete mark on buffer.
@@ -354,16 +364,17 @@ Return number if put mark succeed"
          `(lambda (beg end)
             ,(wl-summary-action-docstring action)
             (interactive "r")
-            (goto-char beg)
-            (wl-summary-mark-region-subr
-             (quote ,(intern (format "wl-summary-%s"
-                                     (wl-summary-action-symbol action))))
-             beg end
-             (if (quote ,(wl-summary-action-argument-function action))
-                 (funcall (function 
-                           ,(wl-summary-action-argument-function action))
-                          (quote ,(wl-summary-action-symbol action))
-                          (wl-summary-message-number))))))
+            (save-excursion
+              (goto-char beg)
+              (wl-summary-mark-region-subr
+               (quote ,(intern (format "wl-summary-%s"
+                                       (wl-summary-action-symbol action))))
+               beg end
+               (if (quote ,(wl-summary-action-argument-function action))
+                   (funcall (function
+                             ,(wl-summary-action-argument-function action))
+                            (quote ,(wl-summary-action-symbol action))
+                            (wl-summary-message-number)))))))
     (fset (intern (format "wl-summary-target-mark-%s"
                          (wl-summary-action-symbol action)))
          `(lambda ()
@@ -845,12 +856,6 @@ If optional argument NUMBER is specified, unmark message specified by NUMBER."
   (interactive)
   (wl-summary-unset-mark number (interactive-p)))
 
-(defun wl-summary-target-mark (&optional number)
-  "Put target mark '*' on current message.
-If optional argument NUMBER is specified, mark message specified by NUMBER."
-  (interactive)
-  (wl-summary-set-mark "*" number (interactive-p)))
-
 (defun wl-summary-unmark-region (beg end)
   (interactive "r")
   (save-excursion
@@ -897,10 +902,6 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
          (funcall function (wl-summary-message-number) data)
          (forward-line 1))))))
 
-(defun wl-summary-target-mark-region (beg end)
-  (interactive "r")
-  (wl-summary-mark-region-subr 'wl-summary-target-mark beg end nil))
-
 (defun wl-summary-target-mark-all ()
   (interactive)
   (wl-summary-target-mark-region (point-min) (point-max))