feat: add pdfconfig.el
Signed-off-by: Lucas Sta Maria <lucas@priime.dev>
This commit is contained in:
parent
7148388de0
commit
f5a4f2be60
3 changed files with 40 additions and 1 deletions
|
@ -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;
|
||||||
|
|
35
.emacs.d/include/pdfconfig.el
Normal file
35
.emacs.d/include/pdfconfig.el
Normal 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
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue