Hi Jean-Christophe!
Thanks for submitting the patch!
First a bit of formalia:
* All authors of a patch much assign the copyright to FSF in order for it to be included in Emacs. This mean that you can't include a random piece of code from the internet (in this case the `trim-spaces' function).
* You must follow the coding standards. First, every function should be prefixed with a module name, normally this corresponds the name of the name of the file they are defined in. However, in this case, ns-win, use "ns-". Secondly, there are hanging parentheses in the code, indentation isn't correct, and there are lines longer than 79 characters.
Comments on the patch itself:
* I'm not exactly sure which problem you were trying to solve. I just tested to select a number of files in the Finder on macOS (10.10.5) and dragged then to Emacs (25.1), and they open just fine. Please include a description in the source code for the situation your code handle.
* I miss a description, or link to a description, of the format of `ns-input-spi-argument'. Without it it's hard to tell what the code is trying to do, and whether or not it does it correctly.
* The code will be smaller, and more easy to read, if you would use `dolist' instead of `while'. Also, if you do this change, I see no need to break out the code into a separate function, as it will only be two or three lines long.
* File names in macOS may start or end with spaces. It's probably not a good idea to trim spaces. (Again, it's hard to tell without a description of the format.)
Again, thanks for submitting the patch.
-- Anders