1
0
Fork 0

feat: add pdfconfig.el

Signed-off-by: Lucas Sta Maria <lucas@priime.dev>
This commit is contained in:
Lucas Sta Maria 2023-08-05 23:41:56 -07:00
parent 7148388de0
commit f5a4f2be60
No known key found for this signature in database
GPG key ID: F07FB16A826E3B47
3 changed files with 40 additions and 1 deletions

View file

@ -53,7 +53,8 @@
mu4econfig.el, mu4econfig.el,
racket.el, racket.el,
latexconfig.el, latexconfig.el,
cppconfig.el cppconfig.el,
pdfconfig.el
] ]
]; ];
.config/picom.conf; .config/picom.conf;

View file

@ -0,0 +1,35 @@
;;; pdfconfig.el --- configuration for working with PDF files
;;; Commentary:
;; Configuration for working with PDF files.
;;; Code:
;; PDF Tools
(pdf-tools-install)
(add-hook 'doc-view-mode (lambda () (display-line-numbers-mode -1)))
(add-hook 'doc-view-mode 'pdf-view-mode)
(add-hook 'pdf-view-mode (lambda () (display-line-numbers-mode -1)))
(add-hook 'pdf-view-mode (lambda () (line-number-mode -1)))
(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))))
;;; pdfconfig.el ends here

View file

@ -43,6 +43,8 @@
;; Productivity ;; Productivity
(straight-use-package 'org) (straight-use-package 'org)
(straight-use-package 'elfeed) (straight-use-package 'elfeed)
(straight-use-package '(pdf-tools :type git :host github
:repo "vedang/pdf-tools"))
;; LSP ;; LSP
(straight-use-package 'lsp-mode) (straight-use-package 'lsp-mode)
@ -74,6 +76,7 @@
(load-library "racket") (load-library "racket")
(load-library "latexconfig") (load-library "latexconfig")
(load-library "cppconfig") (load-library "cppconfig")
(load-library "pdfconfig")
;; ====== Hooks ============================== ;; ====== Hooks ==============================
(add-hook 'after-init-hook 'global-company-mode) (add-hook 'after-init-hook 'global-company-mode)