Thanks for the correction hendricks.
You can setup macros but you will also need to edit the retract and deploy system files as those are what m402 and m401 call.
Anyways, here is my bed.g file, which I call by just clicking the auto bed compensation button, or G32.
M557 X50:150 Y50:150 S25 ; Define grid
T0 ; Select tool 0
G91 ; Relative mode
G1 Z10 F150 ; Make sure everything clears the bed
; ------------ Home Z ---------------------
G90 ; Absolute mode
G1 X110.5 Y72 Z6 F4000 ; Home at center of bed, my offsets are X-10.5 and Y28
M401 ; Deploy probe
G30 ; Home Z-axis
;----------- Mesh Level ------------------
G29 ; Start mesh level
M374 ; Save results, but this might not be necessary
M402 ; Retract probe
G1 X20 Y20 Z10 F3000 ; Dock position