From 54f5683b3ba8d82cbab1fa5392cdb4575d355938 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Sun, 3 Nov 2024 18:57:42 -0500 Subject: [PATCH] refactor(emacs): remove ocamlconfig.el and pdfconfig.el Signed-off-by: Lucas Sta Maria --- .emacs.d/include/ocamlconfig.el | 9 ------- .emacs.d/include/pdfconfig.el | 35 -------------------------- .emacs.d/include/priime-convenience.el | 29 ++++++++++++++++++++- .emacs.d/include/priime-languages.el | 6 ++++- 4 files changed, 33 insertions(+), 46 deletions(-) delete mode 100644 .emacs.d/include/ocamlconfig.el delete mode 100644 .emacs.d/include/pdfconfig.el diff --git a/.emacs.d/include/ocamlconfig.el b/.emacs.d/include/ocamlconfig.el deleted file mode 100644 index 4487543..0000000 --- a/.emacs.d/include/ocamlconfig.el +++ /dev/null @@ -1,9 +0,0 @@ -;;; ocamlconfig.el --- Configuration for OCaml and Tuareg -;;; Commentary: -;;; Code: - -(add-hook 'tuareg-mode-hook #'flycheck-ocaml-setup) -(add-hook 'tuareg-mode-hook #'(lambda () (merlin-mode -1))) -(setq utop-command "opam exec -- dune utop . -- -emacs") - -;;; ocamlconfig.el ends here diff --git a/.emacs.d/include/pdfconfig.el b/.emacs.d/include/pdfconfig.el deleted file mode 100644 index defcd1f..0000000 --- a/.emacs.d/include/pdfconfig.el +++ /dev/null @@ -1,35 +0,0 @@ -;;; pdfconfig.el --- configuration for working with PDF files -;;; Commentary: -;; Configuration for working with PDF files. -;;; Code: - -;; PDF Tools -(pdf-tools-install) - -(setq doc-view-resolution 300) - -(defun pdf-download-and-view (&optional url filename) - "Download and view the PDF given by its URL as FILENAME." - (interactive) - (let* ((url (or url - (read-string "Download URL: "))) - (default-filename (or filename - (car (last (split-string url "/" t))))) - (filename (or filename - (read-string (format "Filename (%s): " default-filename) - nil - nil - default-filename))) - (file-path (concat "/tmp/" filename)) - (download-buffer (url-retrieve-synchronously url))) - (set-buffer download-buffer) - (goto-char (point-min)) - (re-search-forward "^$" nil 'move) - (forward-char) - (delete-region (point-min) (point)) - (write-file file-path) - (find-file (expand-file-name file-path)))) - -(setq pdf-view-continuous t) - -;;; pdfconfig.el ends here diff --git a/.emacs.d/include/priime-convenience.el b/.emacs.d/include/priime-convenience.el index a4973e4..a59edd5 100644 --- a/.emacs.d/include/priime-convenience.el +++ b/.emacs.d/include/priime-convenience.el @@ -4,6 +4,28 @@ ;; development experience and productivity. ;;; Code: +(defun pdf-download-and-view (&optional url filename) + "Download and view the PDF given by its URL as FILENAME." + (interactive) + (let* ((url (or url + (read-string "Download URL: "))) + (default-filename (or filename + (car (last (split-string url "/" t))))) + (filename (or filename + (read-string (format "Filename (%s): " default-filename) + nil + nil + default-filename))) + (file-path (concat "/tmp/" filename)) + (download-buffer (url-retrieve-synchronously url))) + (set-buffer download-buffer) + (goto-char (point-min)) + (re-search-forward "^$" nil 'move) + (forward-char) + (delete-region (point-min) (point)) + (write-file file-path) + (find-file (expand-file-name file-path)))) + (use-package projectile :straight t :custom (projectile-completion-system 'auto) @@ -31,7 +53,12 @@ (use-package pdf-tools :straight '(pdf-tools :type git :host github - :repo "vedang/pdf-tools")) + :repo "vedang/pdf-tools") + :custom + (doc-view-resolution 300) + (pdf-view-continuous t) + :init + (pdf-tools-install)) (use-package olivetti :straight t :hook (org-mode . olivetti-mode)) diff --git a/.emacs.d/include/priime-languages.el b/.emacs.d/include/priime-languages.el index 9c63a10..dc0e013 100644 --- a/.emacs.d/include/priime-languages.el +++ b/.emacs.d/include/priime-languages.el @@ -52,7 +52,11 @@ '(llvm-mode :type git :host github :repo "nverno/llvm-mode")) (use-package clojure-mode :straight t) -(use-package tuareg :straight t) +(use-package tuareg :straight t + :custom + (utop-command "opam exec -- dune utop . -- -emacs") + :hook ((tuareg-mode . flycheck-ocaml-setup) + (tuareg-mode . merlin-mode))) (use-package utop :straight t) (use-package dune :straight t) (use-package flycheck-ocaml :straight t)