You can read out the length of any layer as well as grabbing in and out-point. The trick is to put this information to the time-remap or opacity of your non-audio composition. It's pretty easy, help yourself.
http://expressions.aenhancers.com/
*Martin
There is no direct connection between the length of the composition and the length of a layer in that composition. You cannot write an expression that changes the composition length to match the length of a layer because you cannot keyframe the length of a composition.
Depending on the complexity of your project the best you can hope for would be to develop a script that creates a composition from an audio layer inside a folder in the Project Panel that also contains all of the assets used in the composition. The script would create a new composition then add all of the assets and effects needed to create a new comp.
I assume that you may also be using the keyframe assistant to create keyframes from audio. That tool is also not connected in any way to expressions.
If your project is just a couple of layers and an audio track you can create animation presets that will apply all the effects to each layer individually. If the layers are solids or shape layers the workflow would then be to select the audio track in the Project Panel, select File>New Comp from Selected, make sure that no layers were selected in the timeline, and then apply (run) the animation presets you have saved.