[hydra] move all hydras in one spot

This commit is contained in:
contrapunctus 2021-02-19 13:43:53 +05:30
parent f11e94eada
commit bfe8eda872
1 changed files with 88 additions and 88 deletions

176
init.org
View File

@ -834,6 +834,94 @@ Add these common operations to the hydra -
("E" toggle-debug-on-error "tdoe")
("Q" toggle-debug-on-quit "tdoq"))
(defhydra cp-org-block (:color blue)
"Org source block"
("e" (cp-org-insert-src "emacs-lisp") "Emacs Lisp"))
(defhydra cp-org-nav (:color red)
"Navigation"
("i" org-previous-visible-heading "previous heading")
("o" org-next-visible-heading "next heading")
("j" outline-up-heading "up heading")
(";" outline-down-heading "down heading")
("k" org-backward-heading-same-level "backward heading")
("l" org-forward-heading-same-level "forward heading")
("I" org-drag-element-backward "drag backward")
("O" org-drag-element-forward "drag forward")
("J" org-promote-subtree "promote")
(":" org-demote-subtree "demote"))
(defhydra cp-org (:color blue)
"Org"
("p" org-set-property "property")
("b" cp-org-block/body "source block")
("t" cp-org-set-tags "tags")
("n" cp-org-nav/body "navigation")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("f" find-file "new")
("o" save-buffer "save")
("k" (kill-buffer (current-buffer)) "kill")
("l" contrapunctus-line-display-hydra/body "line display")
("w" contrapunctus-window-hydra/body "window")
("c" chronometrist "chronometrist")
("m" magit-status "Magit")
("u" contrapunctus-general-hydra/body "up"))
(defhydra contrapunctus-programming-hydra (:color blue)
"Which language?"
("e" cp-el/body "Emacs Lisp")
("c" cp-cs/body "CHICKEN Scheme")
("g" cp-guile/body "Guile")
("L" cp-ly/body "Lilypond")
("l" cp-cl/body "Common Lisp")
("o" cp-org/body "Org")
("p" cp-prolog/body "Prolog")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("f" find-file "new")
("o" save-buffer "save")
("k" (kill-buffer (current-buffer)) "kill")
("l" contrapunctus-line-display-hydra/body "line display")
("w" contrapunctus-window-hydra/body "window")
("c" chronometrist "chronometrist")
("m" magit-status "Magit")
("E" toggle-debug-on-error "tdoe")
("Q" toggle-debug-on-quit "tdoq")
("u" contrapunctus-programming-hydra/body "up"))
(defun contrapunctus-programming-hydra-dispatch-language ()
(interactive)
(cond ((or (derived-mode-p 'emacs-lisp-mode 'ielm-mode)
;; ;; Similar problems with this as the f-glob below;
;; ;; e.g. false positive if you have a .dir-locals.el in
;; ;; a project...
;; (f-glob "*.el")
)
(cp-el/body))
(;; (or (locate-dominating-file default-directory "build.scm")
;; (locate-dominating-file default-directory "main.ly"))
(derived-mode-p 'LilyPond-mode)
(cp-ly/body))
((and (featurep 'geiser) geiser-mode)
(cond ((equal 'chicken geiser-impl--implementation)
(cp-cs/body))
((equal 'guile geiser-impl--implementation)
(cp-guile/body))
(t (error "Couldn't detect Scheme implementation."))))
((derived-mode-p 'lisp-mode 'slime-repl-mode)
(cp-cl/body))
((derived-mode-p 'org-mode)
(cp-org/body))
((derived-mode-p 'prog-mode)
(contrapunctus-programming-hydra/body))
(t (contrapunctus-general-hydra/body))))
(define-key boon-command-map (kbd "m") #'contrapunctus-programming-hydra-dispatch-language)
#+END_SRC
** eshell
#+BEGIN_SRC emacs-lisp
@ -1080,42 +1168,6 @@ Add these common operations to the hydra -
(goto-char pos)
(insert indent))))
(defhydra cp-org-block (:color blue)
"Org source block"
("e" (cp-org-insert-src "emacs-lisp") "Emacs Lisp"))
(defhydra cp-org-nav (:color red)
"Navigation"
("i" org-previous-visible-heading "previous heading")
("o" org-next-visible-heading "next heading")
("j" outline-up-heading "up heading")
(";" outline-down-heading "down heading")
("k" org-backward-heading-same-level "backward heading")
("l" org-forward-heading-same-level "forward heading")
("I" org-drag-element-backward "drag backward")
("O" org-drag-element-forward "drag forward")
("J" org-promote-subtree "promote")
(":" org-demote-subtree "demote"))
(defhydra cp-org (:color blue)
"Org"
("p" org-set-property "property")
("b" cp-org-block/body "source block")
("t" cp-org-set-tags "tags")
("n" cp-org-nav/body "navigation")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("f" find-file "new")
("o" save-buffer "save")
("k" (kill-buffer (current-buffer)) "kill")
("l" contrapunctus-line-display-hydra/body "line display")
("w" contrapunctus-window-hydra/body "window")
("c" chronometrist "chronometrist")
("m" magit-status "Magit")
("u" contrapunctus-general-hydra/body "up"))
;; (use-package org-src-mode
;; :hook (org-src-mode . (lambda () (when (derived-mode-p 'emacs-lisp-mode)))))
@ -1688,58 +1740,6 @@ pjb suggested a different approach [[http://paste.lisp.org/display/10157][here]]
(cd (locate-dominating-file default-directory file))
(compile cmd))
(defhydra contrapunctus-programming-hydra (:color blue)
"Which language?"
("e" cp-el/body "Emacs Lisp")
("c" cp-cs/body "CHICKEN Scheme")
("g" cp-guile/body "Guile")
("L" cp-ly/body "Lilypond")
("l" cp-cl/body "Common Lisp")
("o" cp-org/body "Org")
("p" cp-prolog/body "Prolog")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("f" find-file "new")
("o" save-buffer "save")
("k" (kill-buffer (current-buffer)) "kill")
("l" contrapunctus-line-display-hydra/body "line display")
("w" contrapunctus-window-hydra/body "window")
("c" chronometrist "chronometrist")
("m" magit-status "Magit")
("E" toggle-debug-on-error "tdoe")
("Q" toggle-debug-on-quit "tdoq")
("u" contrapunctus-programming-hydra/body "up"))
(defun contrapunctus-programming-hydra-dispatch-language ()
(interactive)
(cond ((or (derived-mode-p 'emacs-lisp-mode 'ielm-mode)
;; ;; Similar problems with this as the f-glob below;
;; ;; e.g. false positive if you have a .dir-locals.el in
;; ;; a project...
;; (f-glob "*.el")
)
(cp-el/body))
(;; (or (locate-dominating-file default-directory "build.scm")
;; (locate-dominating-file default-directory "main.ly"))
(derived-mode-p 'LilyPond-mode)
(cp-ly/body))
((and (featurep 'geiser) geiser-mode)
(cond ((equal 'chicken geiser-impl--implementation)
(cp-cs/body))
((equal 'guile geiser-impl--implementation)
(cp-guile/body))
(t (error "Couldn't detect Scheme implementation."))))
((derived-mode-p 'lisp-mode 'slime-repl-mode)
(cp-cl/body))
((derived-mode-p 'org-mode)
(cp-org/body))
((derived-mode-p 'prog-mode)
(contrapunctus-programming-hydra/body))
(t (contrapunctus-general-hydra/body))))
(define-key boon-command-map (kbd "m") #'contrapunctus-programming-hydra-dispatch-language)
#+END_SRC
*** Emacs Lisp
#+BEGIN_SRC emacs-lisp