Oops, i commented out to many lines. sorry, i was going to fast. But a quick retype will be as below.
``set'' is much the same as `setq' but it will evaluate its argument. Therefore my statement is saying, ``If mark is not nil set the variable to its value otherwise keep the var nil''.
(set 'undo$mark (if mark (progn (command "undo" "be") mark)))