loop recording?

this seems to be possible, but i can't figure it out. i can play a loop, but when i hit record it runs past the loop boundary. i assume it has to do with setting punch in/out boundaries to coincide with the loop boundaries, but i'm having trouble with that.