+" Expand the command line window so we don't have to press RETURN later.
+let s:cmdheight = &cmdheight
+set cmdheight=3
+
+" Call and then discard our function.
+call P4submit()
+delfunction P4submit
+" Don't expand tabs in the spec.
+set noexpandtab
+
+" Restore the command window.
+exe "set cmdheight=" . s:cmdheight
+
+" Close the scratch buffer.
+if version >= 700
+ " Vim 7 lets us close the buffer by number. The changelist is always in #1.
+ au BufWinLeave <buffer=1> qa!
+else
+ " Prior versions can only do it by name. Fall back to a temporary file.
+ au BufWinLeave /tmp/tmp.*.* qa!
+endif