From e0bba9da6b4a7791e87b44d90367a8426ffab7c4 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 3 Nov 2018 20:55:13 +0100 Subject: [PATCH] [Utils] Move general purpose hydras to db-utils --- init.el | 73 +++++-------------------------------------- site-lisp/db-utils.el | 59 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 65 deletions(-) diff --git a/init.el b/init.el index b3c3c4e..49b6d62 100644 --- a/init.el +++ b/init.el @@ -472,22 +472,9 @@ (add-hook 'ediff-after-quit-hook-internal 'winner-undo))) (use-package ispell - :commands (ispell-change-directory - hydra-ispell/body) + :commands (ispell-change-directory) :init (setq ispell-dictionary "en_US" - ispell-really-hunspell t) - :config (defhydra hydra-ispell (:color blue) - "ispell" - ("g" (lambda () - (interactive) - (setq ispell-dictionary "de_DE") - (ispell-change-dictionary "de_DE")) - "german") - ("e" (lambda () - (interactive) - (setq ispell-dictionary "en_US") - (ispell-change-dictionary "en_US")) - "english"))) + ispell-really-hunspell t)) (use-package mailcap :defer t @@ -509,36 +496,6 @@ (use-package server :commands (server-running-p server-start)) -(use-package rect - :commands (hydra-rectangle/body) - :config - (defhydra hydra-rectangle (:body-pre (rectangle-mark-mode 1) - :color pink - :post (deactivate-mark)) - " - ^_k_^ _d_elete _s_tring -_h_ _l_ _o_k _y_ank - ^_j_^ _n_ew-copy _r_eset -^^^^ _e_xchange _u_ndo -^^^^ ^ ^ _p_aste -" - ("h" backward-char nil) - ("l" forward-char nil) - ("k" previous-line nil) - ("j" next-line nil) - ("n" copy-rectangle-as-kill nil) - ("d" delete-rectangle nil) - ("r" (if (region-active-p) - (deactivate-mark) - (rectangle-mark-mode 1)) - nil) - ("y" yank-rectangle nil) - ("u" undo nil) - ("s" string-rectangle nil) - ("p" kill-rectangle nil) - ("e" rectangle-exchange-point-and-mark nil) - ("o" nil nil))) - ;; * Some essential packages @@ -556,30 +513,16 @@ _h_ _l_ _o_k _y_ank db/ascii-to-hex conditionally-enable-lispy db/export-diary - db/add-symbols-to-TeX-input-method)) + db/add-symbols-to-TeX-input-method + hydra-ispell/body + hydra-toggle/body + hydra-zoom/body + hydra-rectangle/body)) (use-package db-emacsclient) (use-package hydra - :commands (defhydra - hydra-toggle/body - hydra-zoom/body) - :config - (defhydra hydra-toggle (:color blue) - "toggle" - ("c" column-number-mode "column") - ("d" toggle-debug-on-error "debug-on-error") - ("e" toggle-debug-on-error "debug-on-error") - ("f" auto-fill-mode "auto-fill") - ("l" toggle-truncate-lines "truncate lines") - ("q" toggle-debug-on-quit "debug-on-quit") - ("r" read-only-mode "read-only")) - - ;; zooming with single keystrokes (from oremacs) - (defhydra hydra-zoom (:color red) - "zoom" - ("g" text-scale-increase "increase") - ("l" text-scale-decrease "decrease"))) + :commands (defhydra)) (use-package magit :commands (magit-status) diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index 95955cb..67bda3e 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -401,6 +401,65 @@ This is done only if the value of this variable is not null." ("\\mathcalS" ?𝒮) ("\\mathfrakP" ?𝔓))))) + +;;; Hydras + +(defhydra hydra-ispell (:color blue) + "ispell" + ("g" (lambda () + (interactive) + (setq ispell-dictionary "de_DE") + (ispell-change-dictionary "de_DE")) + "german") + ("e" (lambda () + (interactive) + (setq ispell-dictionary "en_US") + (ispell-change-dictionary "en_US")) + "english")) + +(defhydra hydra-toggle (:color blue) + "toggle" + ("c" column-number-mode "column") + ("d" toggle-debug-on-error "debug-on-error") + ("e" toggle-debug-on-error "debug-on-error") + ("f" auto-fill-mode "auto-fill") + ("l" toggle-truncate-lines "truncate lines") + ("q" toggle-debug-on-quit "debug-on-quit") + ("r" read-only-mode "read-only")) + +;; zooming with single keystrokes (from oremacs) +(defhydra hydra-zoom (:color red) + "zoom" + ("g" text-scale-increase "increase") + ("l" text-scale-decrease "decrease")) + +(defhydra hydra-rectangle (:body-pre (rectangle-mark-mode 1) + :color pink + :post (deactivate-mark)) + " + ^_k_^ _d_elete _s_tring +_h_ _l_ _o_k _y_ank + ^_j_^ _n_ew-copy _r_eset +^^^^ _e_xchange _u_ndo +^^^^ ^ ^ _p_aste +" + ("h" backward-char nil) + ("l" forward-char nil) + ("k" previous-line nil) + ("j" next-line nil) + ("n" copy-rectangle-as-kill nil) + ("d" delete-rectangle nil) + ("r" (if (region-active-p) + (deactivate-mark) + (rectangle-mark-mode 1)) + nil) + ("y" yank-rectangle nil) + ("u" undo nil) + ("s" string-rectangle nil) + ("p" kill-rectangle nil) + ("e" rectangle-exchange-point-and-mark nil) + ("o" nil nil)) + ;;; End