Created
March 29, 2012 20:39
-
-
Save ryseto/2243572 to your computer and use it in GitHub Desktop.
Open PDF file by the cite key: \cite{foo} -> open foo.pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun MyTeX-open-article () | |
"Open PDF file by the cite key: \cite{foo} -> open foo.pdf" | |
(interactive) | |
(let* ((s (save-excursion | |
(skip-chars-backward "^{,") | |
(point))) | |
(e (save-excursion | |
(skip-chars-forward "^},") | |
(point))) | |
(pdfdir "~/Documents/Dropbox/Papers/pdf/") | |
(pdffile (concat pdfdir | |
(buffer-substring-no-properties s e) ".pdf")) | |
(process-kill-without-query | |
(start-process-shell-command "Open the article" nil "open" pdffile))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment