updated for version 7.4.396
Problem:    When 'clipboard' is "unnamed", :g/pat/d is very slow. (Praful)
Solution:   Only set the clipboard after the last delete. (Christian Brabandt)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 083693b..ba764bf 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -11534,6 +11534,10 @@
 {
     linenr_T	lnum;
 
+#ifdef FEAT_CLIPBOARD
+    start_global_changes();
+#endif
+
     /* First set the marks for all lines closed/open. */
     for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
 	if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed))
@@ -11542,5 +11546,8 @@
     /* Execute the command on the marked lines. */
     global_exe(eap->arg);
     ml_clearmarked();	   /* clear rest of the marks */
+#ifdef FEAT_CLIPBOARD
+    end_global_changes();
+#endif
 }
 #endif