Launching an external PDF viewer from Emacs/AUCTeX on a Mac OSX fails

Got it to work. A hard wrap happened in the following function after formatting it with M-q, separating the %q from the rest of the command.

(setq TeX-view-program-list
      '(("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline 
              %q")))

I couldn't catch it initially because it looked OK (even though it was not). I also must have fixed it when I pasted it in the question. At any rate, the proper form is:

(setq TeX-view-program-list
  '(("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline %q")))

and now things work as they should.


skim-make-url doesn't work with paths with spaces (at least for me) so I had to double quote the paths, like this:

(defun skim-make-url ()
  (concat
   (TeX-current-line)
   " \""
   (expand-file-name (funcall file (TeX-output-extension) t)
             (file-name-directory (TeX-master-file)))
   "\" \""
   (buffer-file-name)
   "\""))