summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-05-15 06:32:30 +0900
committerSean Whitton <spwhitton@spwhitton.name>2015-05-15 06:32:30 +0900
commit73ab639a6c236ebfee86e984963f0eacfcd6120d (patch)
tree92374f70903ffc70ac033b82ca357bdc70c498d4
parent954c0a2c3addf3918a0751e1cd3165baae3d732a (diff)
downloaddotfiles-73ab639a6c236ebfee86e984963f0eacfcd6120d.tar.gz
replace pandoc-mode with just a function
-rw-r--r--.emacs.d/init.el22
1 files changed, 15 insertions, 7 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 785754f5..345ed44d 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -1087,13 +1087,6 @@
("Europe/Paris" "Paris")
("Asia/Seoul" "Seoul"))))
-;; make it easier to compile to PDF with pandoc
-
-(use-package pandoc-mode
- :ensure
- :commands pandoc-mode conditionally-turn-on-pandoc
- :init (add-hook 'markdown-mode-hook 'conditionally-turn-on-pandoc))
-
;;;; ---- functions ----
@@ -1708,6 +1701,21 @@ Passes ARG to `projectile-switch-project-by-name'."
(spw/get-programming-projects programming-projects-dir))))
(projectile-switch-project-by-name project-dir arg)))
+(defun spw/pandoc-paper-compile ()
+ "Compile a paper to PDF with pandoc.
+
+Lightweight alternative to pandoc-mode."
+ (interactive)
+ (when (and (string= default-directory (expand-file-name "~/doc/papers/"))
+ (eq major-mode 'markdown-mode))
+ (let ((output-file (f-join "~/tmp" (f-filename (f-swap-ext (buffer-file-name) "pdf")))))
+ (call-process-shell-command
+ "pandoc" nil "*pandoc output*" nil
+ "-s" "--filter" "pandoc-citeproc" (concat "--bibliography=" (expand-file-name "~/doc/spw.bib"))
+ "--template" "pessay" "-V" "documentclass=pessay"
+ (buffer-file-name) "-o" output-file)
+ (find-file output-file))))
+
;;;; ---- personal settings ----