summaryrefslogtreecommitdiff
path: root/lisp/init-tex.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-02-12 23:24:12 -0500
committerKyle Meyer <kyle@kyleam.com>2014-02-12 23:24:12 -0500
commit1727e157ec913467445daa137bad620b8f666c0b (patch)
tree24f2954cdf7f700607dca02a8a1022edd529a7f7 /lisp/init-tex.el
parent7a24779b53f6adddf2558717f192415e951d34e9 (diff)
downloademacs.d-1727e157ec913467445daa137bad620b8f666c0b.tar.gz
Add function to find PDF for TeX file
Diffstat (limited to 'lisp/init-tex.el')
-rw-r--r--lisp/init-tex.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/init-tex.el b/lisp/init-tex.el
index db8cde0..7e58cf7 100644
--- a/lisp/init-tex.el
+++ b/lisp/init-tex.el
@@ -63,4 +63,17 @@ The point should be beyond \"\\section\"."
(interactive)
(km/latex-narrow-to-single-tag "section"))
+(defun km/latex-find-pdf ()
+ "Find the PDF file for the current LaTeX file."
+ (interactive)
+ (let ((pdf-file (concat (file-name-base (buffer-file-name))
+ ".pdf")))
+ (unless (file-exists-p pdf-file)
+ (error "%s does not exist" pdf-file))
+ (start-process "tex-pdf" nil "xdg-open" pdf-file)))
+
+(add-hook 'LaTeX-mode-hook
+ '(lambda ()
+ (local-set-key (kbd "C-c m p") 'km/latex-find-pdf)))
+
(provide 'init-tex)