+ if (!vmacp)
+ vch_mac = VC_NOTINMAC;
+#ifdef TRACE
+ if (trace)
+ fprintf(trace, "vmacchng, vch_mac=%d, linebuf='%s', *dot=%o\n", vch_mac, linebuf, *dot);
+#endif
+ if (vmacp && fromvis)
+ vsave();
+#ifdef TRACE
+ if (trace)
+ fprintf(trace, "after vsave, linebuf='%s', *dot=%o\n", linebuf, *dot);
+#endif
+ switch(vch_mac) {
+ case VC_NOCHANGE:
+ vch_mac = VC_ONECHANGE;
+ break;
+ case VC_ONECHANGE:
+ /* Save current state somewhere */
+#ifdef TRACE
+ vudump("before vmacchng hairy case");
+#endif
+ savedot = dot; savedol = dol; savecursor = cursor;
+ CP(savelb, linebuf);
+ nlines = dol - zero;
+ while ((line *) endcore - truedol < nlines)
+ morelines();
+ copyw(truedol+1, zero+1, nlines);
+ truedol += nlines;
+
+#ifdef TRACE
+ visdump("before vundo");
+#endif
+ /* Restore state as it was at beginning of macro */
+ vundo(0);
+#ifdef TRACE
+ visdump("after vundo");
+ vudump("after vundo");
+#endif
+
+ /* Do the saveall we should have done then */
+ saveall();
+#ifdef TRACE
+ vudump("after saveall");
+#endif
+
+ /* Restore current state from where saved */
+ more = savedol - dol; /* amount we shift everything by */
+ if (more)
+ (*(more>0 ? copywR : copyw))(savedol+1, dol+1, truedol-dol);
+ unddol += more; truedol += more; undap2 += more;
+
+ truedol -= nlines;
+ copyw(zero+1, truedol+1, nlines);
+ dot = savedot; dol = savedol ; cursor = savecursor;
+ CP(linebuf, savelb);
+ vch_mac = VC_MANYCHANGE;
+
+ /* Arrange that no further undo saving happens within macro */
+ otchng = tchng; /* Copied this line blindly - bug? */
+ inopen = -1; /* no need to save since it had to be 1 or -1 before */
+ vundkind = VMANY;
+#ifdef TRACE
+ vudump("after vmacchng");
+#endif
+ break;
+ case VC_NOTINMAC:
+ case VC_MANYCHANGE:
+ /* Nothing to do for various reasons. */
+ break;