title: Emacs + AUCTex + Skim embbed pdf preview support
body: <p>My configuration as below:</p>
  
  <ul>
  <li>OS: MacOSX Sierra v10.12</li>
  <li>Emacs: GNU Emacs 25.2.</li>
  <li>AucTex: auctex-11.90.0</li>
  <li>TexLive: 2016</li>
  <li>Skim: Version 1.4.28 (102)</li>
  </ul>
  
  <p>I use below emacs configuration:</p>
  
  <pre><code>;; AucTeX
  (setq TeX-auto-save t)
  (setq TeX-parse-self t)
  (setq-default TeX-master nil)
  
  (setq TeX-PDF-mode nil)
  (setq preview-image-type (quote dvipng))
  
  (add-hook 'LaTeX-mode-hook (lambda ()
    (push
      '("latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
        :help "Run latexmk on file")
      TeX-command-list)))
  (add-hook 'LaTeX-mode-hook
            (lambda () (local-set-key (kbd "&lt;S-s-mouse-1&gt;") #'TeX-view)))
  
  (dolist (dir '("/Applications/Skim.app/Contents/SharedSupport"))
    (add-to-list 'exec-path dir))
  
  (setq TeX-view-program-list
        '(("Preview.app" "open -a Preview.app %o")
          ("Skim" "open -a Skim.app %o")
          ("displayline" "displayline -g -b %n %o %b")
          ("open" "open %o"))
        TeX-view-program-selection
        '((output-dvi "open")
          (output-pdf "Skim")
          (output-html "open")))
  </code></pre>
  
  <p>I can use C-c C-c to compile my tex file. and use C-c C-v to launch preview (Skim).</p>
  
  <p>But:</p>
  
  <ol>
  <li>the Skim will popup as a application, I wish it can be embbed into emacs as another window, just like DocView behavior. Is it possible to do that or my config is not good?</li>
  <li>When Skim lanuched, the opened file is test.dvi, but I wish it's test.pdf.</li>
  <li>When press C-c C-c first time, it will popup LaTex select window, after confirmed and press C-c C-c again, it will popup View select window and need to confirm view command then I see the document. Can I make everything as default so no need to select again and again? (C-c C-c, compile; C-c C-c again, preview).</li>
  </ol>