[lisp] move configuration to init.org; move hydras to hydra section

This commit is contained in:
contrapunctus 2021-02-20 01:36:37 +05:30
parent 08dc18aef0
commit 6e2e5ad0b9
2 changed files with 201 additions and 171 deletions

View File

@ -1,42 +1,3 @@
(use-package slime
:commands (slime-eval-buffer slime-eval-defun)
:bind
(:map slime-mode-map
("M-n" . next-line)
("M-p" . previous-line)
("SPC" . self-insert-command)
("<f1> <f1>" . slime-documentation))
:config
(slime-setup t)
(setq inferior-lisp-program
;; "/usr/bin/ecl"
"/home/anon/bin/sbcl"
;; "/usr/bin/sbcl"
slime-net-coding-system 'utf-8-unix)
(defun cp-slime-completion-in-region (_fn completions start end)
(funcall completion-in-region-function start end completions))
(advice-add 'slime-display-or-scroll-completions
:around #'cp-slime-completion-in-region)
(add-to-list 'slime-filename-translations
(slime-create-filename-translator
:machine-instance "tilde"
:remote-host "tilde.team"
:username "contrapunctus")))
(use-package redshank
:hook (slime-mode . redshank-mode))
(defun set-cl-repl-keys ()
(if (or (cp-buffer-name-match-p "^\*inferior-lisp\*\\(<[0-9]*>\\)?")
(eq major-mode 'lisp-mode))
(progn
(local-set-key (kbd "TAB") 'completion-at-point)
(local-set-key (kbd "M-q") 'sp-indent-defun))))
(add-hook 'slime-connected-hook 'set-cl-repl-keys)
(add-hook 'comint-mode-hook 'set-cl-repl-keys)
(add-hook 'lisp-mode-hook 'set-cl-repl-keys)
(setq scheme-program-name "csi -:c")
(setq comint-prompt-read-only t)

333
init.org
View File

@ -798,16 +798,19 @@ Add these common operations to the hydra -
4. [X] =toggle-debug-on-error=
5. [ ] "insert" hydra, for timestamps, dates; in Elisp, insert as strings; in Org, in angular brackets; etc
#+BEGIN_SRC emacs-lisp
(use-package hydra
:commands defhydra)
(use-package hydra :commands defhydra)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra contrapunctus-line-display-hydra (:color red)
"Line display"
("t" toggle-truncate-lines "truncate")
("v" visual-line-mode "visual-line")
("f" visual-fill-column-mode "visual-fill-column")
("a" adaptive-wrap-prefix-mode "adaptive-prefix-wrap"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra contrapunctus-window-hydra (:color red)
"Window"
("d" delete-window "delete")
@ -818,7 +821,9 @@ Add these common operations to the hydra -
("o" shrink-window "decrease height")
("l" enlarge-window-horizontally "increase width")
("k" shrink-window-horizontally "decrease width"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra contrapunctus-general-hydra (:color blue)
"What command?"
("c" chronometrist "chronometrist")
@ -838,11 +843,15 @@ Add these common operations to the hydra -
("m" magit-status "magit")
("E" toggle-debug-on-error "tdoe")
("Q" toggle-debug-on-quit "tdoq"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-org-block (:color blue)
"Org source block"
("e" (cp-org-insert-src "emacs-lisp") "Emacs Lisp"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-org-nav (:color red)
"Navigation"
("i" org-previous-visible-heading "previous heading")
@ -856,7 +865,9 @@ Add these common operations to the hydra -
("O" org-drag-element-forward "drag forward")
("J" org-promote-subtree "promote")
(":" org-demote-subtree "demote"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-org (:color blue)
"Org"
("p" org-set-property "property")
@ -874,7 +885,158 @@ Add these common operations to the hydra -
("c" chronometrist "chronometrist")
("m" magit-status "Magit")
("G" contrapunctus-general-hydra/body "up"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-el-eval (:color blue)
("b" eval-buffer "buffer")
("e" eval-defun "defun")
("l" eval-last-sexp "last sexp"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra contrapunctus-el-test (:color blue)
("e" (cp/compile-project "Cask" "cask exec buttercup -L . --traceback pretty") "buttercup")
("r" ert "ert"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-el (:color blue)
"Emacs Lisp"
("r" ielm "REPL")
("D" (funcall-interactively #'eval-defun t) "Debug")
("e" cp-el-eval/body "Eval")
("h" helpful-at-point "Help")
("j" xref-find-definitions "Jump to definition")
("b" (cp/compile-project "Cask" "cask build") "Compile")
("C" (cp/compile-project "Cask" "cask clean-elc") "clean")
("t" (contrapunctus-el-test/body) "Test")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-cl-eval (:color blue)
("b" slime-eval-buffer "buffer")
("e" slime-eval-defun "defun"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-cl-doc (:color blue)
("d" slime-documentation "slime")
("e" slime-documentation-lookup "CLHS"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-cl (:color blue)
"Common Lisp"
("C" slime-connect "connect")
("d" cp-cl-doc/body "Documentation")
("e" cp-cl-eval/body "Eval")
("r" slime "REPL")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-scm-eval (:color blue)
("b" geiser-eval-buffer "buffer")
("e" geiser-eval-definition "defun"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-cs (:color blue)
"CHICKEN Scheme"
("e" cp-scm-eval/body "Eval")
("r" run-chicken "REPL")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-guile (:color blue)
"Guile"
("e" cp-scm-eval/body "Eval")
("r" run-guile "REPL")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-ly (:color blue)
"Lilypond"
("c" (cp/compile-project "main.ly" "~/bin/mkly dev") "Compile")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra cp-prolog (:color blue)
"Prolog"
("r" ediprolog-dwim "REPL")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defhydra contrapunctus-programming-hydra (:color blue)
"Which language?"
("e" cp-el/body "Emacs Lisp")
@ -897,7 +1059,9 @@ Add these common operations to the hydra -
("E" toggle-debug-on-error "tdoe")
("Q" toggle-debug-on-quit "tdoq")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defun contrapunctus-programming-hydra-dispatch-language ()
(interactive)
(cond ((or (derived-mode-p 'emacs-lisp-mode 'ielm-mode)
@ -1800,154 +1964,59 @@ pjb suggested a different approach [[http://paste.lisp.org/display/10157][here]]
#+END_SRC
**** hydra
#+BEGIN_SRC emacs-lisp
(defhydra cp-el-eval (:color blue)
("b" eval-buffer "buffer")
("e" eval-defun "defun")
("l" eval-last-sexp "last sexp"))
(defhydra contrapunctus-el-test (:color blue)
("e" (cp/compile-project "Cask" "cask exec buttercup -L . --traceback pretty") "buttercup")
("r" ert "ert"))
(defhydra cp-el (:color blue)
"Emacs Lisp"
("r" ielm "REPL")
("D" (funcall-interactively #'eval-defun t) "Debug")
("e" cp-el-eval/body "Eval")
("h" helpful-at-point "Help")
("j" xref-find-definitions "Jump to definition")
("b" (cp/compile-project "Cask" "cask build") "Compile")
("C" (cp/compile-project "Cask" "cask clean-elc") "clean")
("t" (contrapunctus-el-test/body) "Test")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
*** Common Lisp
#+BEGIN_SRC emacs-lisp
(defhydra cp-cl-eval (:color blue)
("b" slime-eval-buffer "buffer")
("e" slime-eval-defun "defun"))
(use-package redshank
:hook (slime-mode . redshank-mode))
(defhydra cp-cl-doc (:color blue)
("d" slime-documentation "slime")
("e" slime-documentation-lookup "CLHS"))
(use-package slime
:commands (slime-eval-buffer slime-eval-defun)
:bind
(:map slime-mode-map
("M-n" . next-line)
("M-p" . previous-line)
("SPC" . self-insert-command)
("<f1> <f1>" . slime-documentation))
:config
(slime-setup t)
(setq inferior-lisp-program
;; "/usr/bin/ecl"
"/home/anon/bin/sbcl"
;; "/usr/bin/sbcl"
slime-net-coding-system 'utf-8-unix)
(defun cp-slime-completion-in-region (_fn completions start end)
(funcall completion-in-region-function start end completions))
(advice-add 'slime-display-or-scroll-completions
:around #'cp-slime-completion-in-region)
(add-to-list 'slime-filename-translations
(slime-create-filename-translator
:machine-instance "tilde"
:remote-host "tilde.team"
:username "contrapunctus")))
(defhydra cp-cl (:color blue)
"Common Lisp"
("C" slime-connect "connect")
("d" cp-cl-doc/body "Documentation")
("e" cp-cl-eval/body "Eval")
("r" slime "REPL")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
(defun set-cl-repl-keys ()
(if (or (cp-buffer-name-match-p "^\*inferior-lisp\*\\(<[0-9]*>\\)?")
(eq major-mode 'lisp-mode))
(progn
(local-set-key (kbd "TAB") 'completion-at-point)
(local-set-key (kbd "M-'") 'sp-indent-defun))))
(add-hook 'slime-connected-hook 'set-cl-repl-keys)
(add-hook 'comint-mode-hook 'set-cl-repl-keys)
(add-hook 'lisp-mode-hook 'set-cl-repl-keys)
#+END_SRC
*** Scheme
**** common
#+BEGIN_SRC emacs-lisp
(defhydra cp-scm-eval (:color blue)
("b" geiser-eval-buffer "buffer")
("e" geiser-eval-definition "defun"))
#+END_SRC
**** CHICKEN Scheme
#+BEGIN_SRC emacs-lisp
(defhydra cp-cs (:color blue)
"CHICKEN Scheme"
("e" cp-scm-eval/body "Eval")
("r" run-chicken "REPL")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
**** Guile
#+BEGIN_SRC emacs-lisp
(defhydra cp-guile (:color blue)
"Guile"
("e" cp-scm-eval/body "Eval")
("r" run-guile "REPL")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
*** Lilypond
#+BEGIN_SRC emacs-lisp
(defhydra cp-ly (:color blue)
"Lilypond"
("c" (cp/compile-project "main.ly" "~/bin/mkly dev") "Compile")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
*** Prolog
#+BEGIN_SRC emacs-lisp
(use-package ediprolog
:commands ediprolog-dwim)
(defhydra cp-prolog (:color blue)
"Prolog"
("r" ediprolog-dwim "REPL")
("i" (find-file "~/.emacs.d/init.org") "open init")
("d" dired-jump "dired-jump")
("u" 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")
("G" contrapunctus-programming-hydra/body "up"))
#+END_SRC
*** c
#+BEGIN_SRC emacs-lisp