Use of *Error* to make undo begin/end behave
For years I have thrown in the *error* functions to just exit somewhat cleanly, like:
(defun c:somecommand ()
(DEFUN *error* (msg)
(PRINC "\nFunction Cancelled\n")
(PRINC)
)
<code>
)
but I never cared too much about it. Sometimes I would throw in some variable restore statements.
But now some users of mine are getting hit with accidental undo's that go too far back.
I believe it is because of (vla-startundomark (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))) that is not closed out with
(vla-endundomark (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))).
It is hard to prevent that happening, as even if I am perfect in my code, the may have routines from wherever that did not close out the undo-begins.
I am wondering how to close out any undo-begins others may have started.
Let's say some other tool did this 5 times:
(vla-startundomark (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))
How should I handle that?
It may be that I do not have my head on straight, and my guess at the problem is wrong.
If so, suggestions please - alternate career options included and always welcome.
If I am on the right track, is one (vla-endundomark... enough to end them all?
If not, how do I detect "non-closed" undomarks?
This can't be a new issue, url's also welcome.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties