format-spec.el: Work for XEmacs
[gnus] / lisp / nnimap.el
index 6904e0a..c476be6 100644 (file)
@@ -1265,7 +1265,7 @@ If LIMIT, first try to limit the search to the N last articles."
            (group (buffer-substring-no-properties
                    (progn (skip-chars-forward " \"")
                           (point))
-                   (progn (move-end-of-line 1)
+                   (progn (end-of-line)
                           (skip-chars-backward " \r\"")
                           (point)))))
        (unless (member '%NoSelect flags)
@@ -2086,12 +2086,15 @@ Return the server's response to the SELECT or EXAMINE command."
                    (ranges (cdr spec)))
                (if (eq group 'junk)
                    (setq junk-articles ranges)
-                 (push (list (nnimap-send-command
-                              "UID COPY %s %S"
-                              (nnimap-article-ranges ranges)
-                              (utf7-encode group t))
-                             ranges)
-                       sequences))))
+                 ;; Don't copy if the message is already in its
+                 ;; target group.
+                 (unless (string= group nnimap-inbox)
+                  (push (list (nnimap-send-command
+                               "UID COPY %s %S"
+                               (nnimap-article-ranges ranges)
+                               (utf7-encode group t))
+                              ranges)
+                        sequences)))))
            ;; Wait for the last COPY response...
            (when sequences
              (nnimap-wait-for-response (caar sequences))