joostkremers/ebib — pull request #13 by lamberta (2013-08-15 23:36:17+00:00)
Title: Change ebib-call-file-viewer to handle file names containing spaces

`ebib-call-file-viewer` chokes on file names that contain spaces because it treats the spaces as a list separator between multiple file names. While I'm no fan of spaces in file names, this is problematic because a number of other reference managers automatically generate file names based on a papers title, causing interoperability problems when using ebib. This fix works around the issue by first testing if the file path exists (spaces and all), before attempting to extract an element from a list. Perhaps a better solution in the long run is to use a semicolon as the file name separator, such as used with [multiple identical fields](http://ebib.sourceforge.net/manual/ebib-manual.html#multiple-identical-fields)

The parameters have been changed to: `(defun ebib-call-file-viewer (filename &optional n) ...`
Where *filename* is the full path to a file (may contain spaces), or a list of filenames separated by a space (these may still not contain spaces). When passed a list of filenames, *n* designates the list element.

~~~
(ebib-call-file-viewer "~/papers/Hello, World.pdf") ;=> success
(ebib-call-file-viewer "~/papers/Hello, World.pdf" 0) ;=> error opening "~/papers/Hello,"
(ebib-call-file-viewer "~/papers/hello.pdf ~/papers/world.pdf" 1) ;=> success opening "world.pdf"
~~~