Hi!
Finally, I start to understand what you are trying to do. Here is a recipe on how to enable it:
- In System Preferences > Keyboard > Shortcuts > Services, select Text > Open Selected File
- Restart Emacs. (I didn't, which caused Aquamacs to be launched)
I did test your patch from within gmail in Chrome. One this that I realized was that when typing a space, it sometimes came out as a plain space, sometimes as a non-breakable space. I'm not sure this is specific to the edit field in gmail, but I think it would ba good idea to trim both kind of spaces.