- (with-temp-buffer
- (insert (format "(%s-request-set-mark \"%s\" '%s \"%s\")\n"
- (nth 0 gnus-command-method) group action
- (or server (nth 1 gnus-command-method))))
- (append-to-file (point-min) (point-max) (gnus-agent-lib-file "flags")))
+ (mm-with-unibyte-buffer
+ (insert "(gnus-agent-synchronize-group-flags \""
+ group
+ "\" '")
+ (gnus-pp action)
+ (insert " \""
+ (gnus-method-to-server gnus-command-method)
+ "\"")
+ (insert ")\n")
+ (let ((coding-system-for-write nnheader-file-coding-system))
+ (write-region (point-min) (point-max) (gnus-agent-lib-file "flags")
+ t 'silent)))
+ ;; Also set the marks for the original back end that keeps marks in
+ ;; the local system.
+ (let ((gnus-agent nil))
+ (when (and (memq (car gnus-command-method) '(nntp))
+ (gnus-check-backend-function 'request-set-mark
+ (car gnus-command-method)))
+ (funcall (gnus-get-function gnus-command-method 'request-set-mark)
+ group action server)))