This is an indirect answer to your question -- I'm not sure how to figure out what the original buffer's filename is without doing the following. (EDIT: @purple_arrows's answer fills in the details: you can use buffer-base-buffer
. Please accept that answer as most correct.)
The following piece of advice will associate the original buffer's filename with each of its indirect clones:
(defadvice clone-indirect-buffer (around associate-filename activate)
"Associate the original filename with the cloned buffer."
(let ((filename buffer-file-name))
ad-do-it
(setq buffer-file-name filename)))
Now, each of the clones has the same filename as the original buffer.
I use indirectly-cloned buffers a lot, and like to be able to, eg, save the associated file when I'm working with any of the buffers, rather than the original. This piece of advice was my solution to that desired workflow.