feat(emacs): add open-out-pdf
for latex
Signed-off-by: Lucas Sta Maria <lucas@priime.dev>
This commit is contained in:
parent
50a089a2d0
commit
d6f127a7f8
1 changed files with 16 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
(require 'latex)
|
||||
(require 'cdlatex)
|
||||
(require 'f)
|
||||
|
||||
(defun custom-compile-latex ()
|
||||
"Run the `just' command -- the command I use to compile my environment."
|
||||
|
@ -12,6 +13,19 @@
|
|||
(save-buffer)
|
||||
(shell-command-to-string "just"))
|
||||
|
||||
(defun open-out-pdf ()
|
||||
"Find and open the produced PDF via Zathura."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(when (f-directory-p "./out/")
|
||||
(defconst --pdf-files (f-glob "./out/*.pdf"))
|
||||
(unless (zerop (length --pdf-files))
|
||||
(defconst --pdf-command "zathura")
|
||||
(defconst --pdf-file (car --pdf-files))
|
||||
(defconst --shell-command (format "%s %s" --pdf-command --pdf-file))
|
||||
(setq-local async-shell-command-buffer 'rename-buffer)
|
||||
(async-shell-command --shell-command)))))
|
||||
|
||||
(defun enter-math ()
|
||||
"Enter and ensure math-mode."
|
||||
(interactive)
|
||||
|
@ -72,7 +86,8 @@
|
|||
(display-fill-column-indicator-mode 1)
|
||||
(set-fill-column 100)
|
||||
|
||||
(keymap-local-set "C-c C-z" #'custom-compile-latex)
|
||||
(keymap-local-set "C-c C-c" #'custom-compile-latex)
|
||||
(keymap-local-set "C-c C-z" #'open-out-pdf)
|
||||
(keymap-local-set "C-c C-b" #'latex-insert-block)
|
||||
(keymap-local-set "C-c C-h" #'enter-math)
|
||||
(keymap-local-set "C-c C-/" #'insert-frac)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue