When I am on a long line, beyond the end of an adjacent line, if I move up or down to the other line the point will go to end of the line, naturally. Then when I move back to the longer line, it goes to the same position I was originally at.
Similarly, if I reach the end of the buffer by pressing down on the last line, when I move up it moves to the column I was in (or the end of the line if the column is from another longer line) rather than the column of the end of the last line.
How does it know what column to move to? This is not goal-column, it is transient (based on the last column explicitly horizontally moved to) rather than permanent.
I would like to control this behavior programmatically, so I would like to know any relevant variables or functions.