fixing some pdf stuffs

This commit is contained in:
Chris Cochrun 2023-11-28 10:23:25 -06:00
parent ca17a42f63
commit cec4337197
2 changed files with 113 additions and 6 deletions

View file

@ -555,6 +555,9 @@ This evil-collection package includes a lot of other evil based things.
#+end_src #+end_src
*** General *** General
:PROPERTIES:
:ID: 20231122T062139.870235
:END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package general (use-package general
:init :init
@ -568,6 +571,45 @@ This evil-collection package includes a lot of other evil based things.
"find a bible to open" "find a bible to open"
(interactive) (interactive)
(find-file "~/org/bibles/")) (find-file "~/org/bibles/"))
(defun chris/transpose-lines (arg)
"Moves the current line or region and follows"
(interactive)
(cond
((and mark-active transient-mark-mode)
(if (> (point) (mark))
(exchange-point-and-mark))
(let ((column (current-column))
(text (delete-and-extract-region (point) (mark))))
(forward-line arg)
(move-to-column column t)
(set-mark (point))
(insert text)
(exchange-point-and-mark)
(setq deactivate-mark nil)))
(t
(beginning-of-line)
(when (or (> arg 0) (not (bobp)))
(forward-line)
(when (or (< arg 0) (not (eobp)))
(transpose-lines arg))
(forward-line -1)))))
(defun chris/transpose-lines-up ()
"Moves the lines up"
(interactive)
(transpose-lines 1)
(forward-line -2)
(indent-according-to-mode))
(defun chris/transpose-lines-down ()
"Moves the lines down"
(interactive)
(forward-line 1)
(transpose-lines 1)
(forward-line -1)
(indent-according-to-mode))
(general-create-definer chris/leader-keys (general-create-definer chris/leader-keys
:keymaps '(normal visual emacs) :keymaps '(normal visual emacs)
:prefix "SPC") :prefix "SPC")
@ -651,6 +693,11 @@ This evil-collection package includes a lot of other evil based things.
"C-S-h" 'evil-window-decrease-width "C-S-h" 'evil-window-decrease-width
"zi" 'text-scale-increase "zi" 'text-scale-increase
"zd" 'text-scale-decrease) "zd" 'text-scale-decrease)
(general-def 'normal
:states 'normal
:keymaps 'override
"C-M-j" 'chris/transpose-lines-down
"C-M-k" 'chris/transpose-lines-up)
(general-def 'normal Info-mode-map (general-def 'normal Info-mode-map
"RET" 'Info-follow-nearest-node "RET" 'Info-follow-nearest-node
"p" 'Info-prev "p" 'Info-prev
@ -919,10 +966,14 @@ Part of this config includes some special capture templates for my work as a you
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
'(("w" todo "WAIT") '(("w" todo "WAIT")
("f" . "Second brain")
("fa" tags "area+LEVEL=1") ("fa" tags "area+LEVEL=1")
("fr" tags "resource+LEVEL=1") ("fr" tags "resource+LEVEL=1")
("fp" tags "project+LEVEL=1") ("fp" . "Projects")
("fpt" "All TFC projects" tags "projecttfc+LEVEL=1")
("fpd" "All Dev projects" tags "projectdev")
("fA" tags "archive+LEVEL=1") ("fA" tags "archive+LEVEL=1")
("h" . "Family searches")
("ha" tags "abbie") ("ha" tags "abbie")
("hl" tags "luke") ("hl" tags "luke")
("hy" tags "ty") ("hy" tags "ty")
@ -1124,7 +1175,8 @@ Super Agenda gives me a really nice way of making the agenda view look a lot bet
:priority "A") :priority "A")
(:name "Development" (:name "Development"
:category "TODO" :category "TODO"
:category "dev") :category "dev"
:scheduled nil)
(:name "Overdue" (:name "Overdue"
:time-grid t :time-grid t
:scheduled past :scheduled past
@ -4126,7 +4178,10 @@ Let's use pdf-tools for a lot better interaction with pdfs.
(custom-set-variables '(pdf-misc-print-program-executable "lpr") (custom-set-variables '(pdf-misc-print-program-executable "lpr")
'(pdf-misc-print-program-args (quote ("-o media=Letter" "-o fitplot" "-o sides=two-sided-long-edge")))) '(pdf-misc-print-program-args (quote ("-o media=Letter" "-o fitplot" "-o sides=two-sided-long-edge"))))
(add-hook 'pdf-view-mode 'pdf-view-fit-page-to-window) (add-hook 'pdf-view-mode-hook 'pdf-view-fit-page-to-window)
(defun chris/display-line-numbers-off ()
(display-line-numbers-mode -1))
(add-hook 'pdf-view-mode-hook 'chris/display-line-numbers-off)
:general :general
(general-def (general-def
:states 'normal :states 'normal

58
init.el
View file

@ -288,6 +288,45 @@
"find a bible to open" "find a bible to open"
(interactive) (interactive)
(find-file "~/org/bibles/")) (find-file "~/org/bibles/"))
(defun chris/transpose-lines (arg)
"Moves the current line or region and follows"
(interactive)
(cond
((and mark-active transient-mark-mode)
(if (> (point) (mark))
(exchange-point-and-mark))
(let ((column (current-column))
(text (delete-and-extract-region (point) (mark))))
(forward-line arg)
(move-to-column column t)
(set-mark (point))
(insert text)
(exchange-point-and-mark)
(setq deactivate-mark nil)))
(t
(beginning-of-line)
(when (or (> arg 0) (not (bobp)))
(forward-line)
(when (or (< arg 0) (not (eobp)))
(transpose-lines arg))
(forward-line -1)))))
(defun chris/transpose-lines-up ()
"Moves the lines up"
(interactive)
(transpose-lines 1)
(forward-line -2)
(indent-according-to-mode))
(defun chris/transpose-lines-down ()
"Moves the lines down"
(interactive)
(forward-line 1)
(transpose-lines 1)
(forward-line -1)
(indent-according-to-mode))
(general-create-definer chris/leader-keys (general-create-definer chris/leader-keys
:keymaps '(normal visual emacs) :keymaps '(normal visual emacs)
:prefix "SPC") :prefix "SPC")
@ -371,6 +410,11 @@
"C-S-h" 'evil-window-decrease-width "C-S-h" 'evil-window-decrease-width
"zi" 'text-scale-increase "zi" 'text-scale-increase
"zd" 'text-scale-decrease) "zd" 'text-scale-decrease)
(general-def 'normal
:states 'normal
:keymaps 'override
"C-M-j" 'chris/transpose-lines-down
"C-M-k" 'chris/transpose-lines-up)
(general-def 'normal Info-mode-map (general-def 'normal Info-mode-map
"RET" 'Info-follow-nearest-node "RET" 'Info-follow-nearest-node
"p" 'Info-prev "p" 'Info-prev
@ -628,10 +672,14 @@ much faster. The hope is to also make this a faster version of imenu."
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
'(("w" todo "WAIT") '(("w" todo "WAIT")
("f" . "Second brain")
("fa" tags "area+LEVEL=1") ("fa" tags "area+LEVEL=1")
("fr" tags "resource+LEVEL=1") ("fr" tags "resource+LEVEL=1")
("fp" tags "project+LEVEL=1") ("fp" . "Projects")
("fpt" "All TFC projects" tags "projecttfc+LEVEL=1")
("fpd" "All Dev projects" tags "projectdev")
("fA" tags "archive+LEVEL=1") ("fA" tags "archive+LEVEL=1")
("h" . "Family searches")
("ha" tags "abbie") ("ha" tags "abbie")
("hl" tags "luke") ("hl" tags "luke")
("hy" tags "ty") ("hy" tags "ty")
@ -817,7 +865,8 @@ much faster. The hope is to also make this a faster version of imenu."
:priority "A") :priority "A")
(:name "Development" (:name "Development"
:category "TODO" :category "TODO"
:category "dev") :category "dev"
:scheduled nil)
(:name "Overdue" (:name "Overdue"
:time-grid t :time-grid t
:scheduled past :scheduled past
@ -3032,7 +3081,10 @@ targets."
(custom-set-variables '(pdf-misc-print-program-executable "lpr") (custom-set-variables '(pdf-misc-print-program-executable "lpr")
'(pdf-misc-print-program-args (quote ("-o media=Letter" "-o fitplot" "-o sides=two-sided-long-edge")))) '(pdf-misc-print-program-args (quote ("-o media=Letter" "-o fitplot" "-o sides=two-sided-long-edge"))))
(add-hook 'pdf-view-mode 'pdf-view-fit-page-to-window) (add-hook 'pdf-view-mode-hook 'pdf-view-fit-page-to-window)
(defun chris/display-line-numbers-off ()
(display-line-numbers-mode -1))
(add-hook 'pdf-view-mode-hook 'chris/display-line-numbers-off)
:general :general
(general-def (general-def
:states 'normal :states 'normal