[Emacs] Rearchitect term-hydra

This commit is contained in:
Ivan Malison 2016-09-22 13:08:40 -07:00
parent a60df99f67
commit 2d472d8d18
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -3076,8 +3076,8 @@ emr (emacs refactor) provides support for refactoring in many programming langua
#+END_SRC #+END_SRC
*** term-projectile *** term-projectile
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(imalison:use-package term-projectile (imalison:use-package* term-projectile "term-manager"
:bind ("C-c 7" . imalison:term-hydra/body) :bind ("C-c 7" . imalison:term-hydra-global/body)
:commands (term-projectile-forward term-projectile-backward :commands (term-projectile-forward term-projectile-backward
term-projectile-default-directory-forward term-projectile-default-directory-forward
term-projectile-default-directory-backward term-projectile-default-directory-backward
@ -3086,28 +3086,66 @@ emr (emacs refactor) provides support for refactoring in many programming langua
:config :config
(progn (progn
(emit-prefix-selector imalison:term (emit-prefix-selector imalison:term
term-projectile-forward term-projectile-forward
term-projectile-create-new) term-projectile-create-new)
(defhydra imalison:term-hydra-default-directory () (defvar imalison:term-hydra-original-default-directory)
(defhydra imalison:term-hydra-default-directory
(:body-pre
(term-projectile-default-directory-forward-restored))
"term - default-directory" "term - default-directory"
("f" term-projectile-default-directory-forward) ("f" term-projectile-default-directory-forward-restored)
("b" term-projectile-default-directory-backward) ("b" term-projectile-default-directory-backward-restored)
("c" term-projectile-default-directory-create-new)) ("c" term-projectile-default-directory-create-new-restored)
("d" term-projectile-default-directory-forward-restored)
("g" imalison:term-hydra-global/body-restored :exit t)
("p" imalison:term-hydra-projectile/body-restored :exit t))
(defhydra imalison:term-hydra-projectile () (defhydra imalison:term-hydra-projectile
(:body-pre
(progn
(term-projectile-forward-restored)))
"term - projectile" "term - projectile"
("f" term-projectile-forward) ("f" term-projectile-forward-restored)
("b" term-projectile-backward) ("b" term-projectile-backward-restored)
("c" term-projectile-create-new)) ("c" term-projectile-create-new-restored)
("d" imalison:term-hydra-default-directory/body-restored :exit t)
("g" imalison:term-hydra-global/body-restored :exit t)
("p" term-projectile-forward-restored))
(defhydra imalison:term-hydra ()
"term" (defhydra imalison:term-hydra-global
("f" term-projectile-global-forward) (:body-pre
("b" term-projectile-global-backward) (progn (setq imalison:term-hydra-original-default-directory
("c" term-projectile-global-create-new) default-directory)
("d" imalison:term-hydra-default-directory/body :exit t) (term-projectile-global-forward-restored)))
("p" imalison:term-hydra-projectile/body :exit t)))) "term - global"
("f" term-projectile-global-forward-restored)
("b" term-projectile-global-backward-restored)
("c" term-projectile-global-create-new-restored)
("d" imalison:term-hydra-default-directory/body-restored :exit t)
("g" term-projectile-global-forward-restored)
("p" imalison:term-hydra-projectile/body-restored :exit t))
(mapcar (lambda (term-projectile-function)
(defalias (imalison:concat-symbols term-projectile-function '-restored)
(lambda (&rest args)
(interactive)
(let ((default-directory imalison:term-hydra-original-default-directory))
(apply term-projectile-function args)))))
'(term-projectile-default-directory-forward
term-projectile-default-directory-backward
term-projectile-default-directory-create-new
term-projectile-forward
term-projectile-backward
term-projectile-create-new
term-projectile-global-forward
term-projectile-global-backward
term-projectile-global-create-new
imalison:term-hydra-global/body
imalison:term-hydra-projectile/body
imalison:term-hydra-default-directory/body))))
#+END_SRC #+END_SRC
*** crux *** crux
crux-reopen-as-root-mode makes it so that any file owned by root will automatically be opened as the root user. crux-reopen-as-root-mode makes it so that any file owned by root will automatically be opened as the root user.