(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)
(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))