The parts of the image that end up outside the canvas due to the straightening action MUST be cropped and deleted. Why would you attempt to defy the laws of geometry?
Well, I suppose you could write a script to use instead of using the Ruler tool and have the script add enough space to the canvas size to accommodate the re-positioned image without cropping part(s) of it, but that is a question for the Photoshop scripting forum, Personally, I couldn't script my way out of a paper bag.
What I'm doing requires me to keep the image's dimensions at a rather specific aspect ratio so more often than not I use the space from the rationing to keep that, and fill it in with either black or white.
But, what I did discover is that the rotating and cropping are done as two separate actions. Meaning I can just Ctrl+z to undo the last action and I'll have that space back.
I'll have to look into writing a script similar to the one you suggested because that could take a few seconds off each time I do this, and I tend to do it in bulk.
Thanks again for advice.
If you want to make it a permenant change then you can edit the existing script. If you want to control on a per use basis, I belive you can undo one step to get back the uncropped document size.
Do note that you will actually get a larger document size, rather than the previous document size if you remove the cropping step.