summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
authorCase Duckworth2021-05-12 19:30:24 -0500
committerCase Duckworth2021-05-12 19:30:24 -0500
commitb06a7305c1ffb179f75a66a22e5e34031e0ea861 (patch)
treeff0d504e3eeacb6ca8474e1f43ae946c75ffc619 /init.el
parentRefactor CL IDE binding code (diff)
downloademacs-b06a7305c1ffb179f75a66a22e5e34031e0ea861.tar.gz
emacs-b06a7305c1ffb179f75a66a22e5e34031e0ea861.zip
Change common-lisp-ide -> sly
Since I just use sly
Diffstat (limited to 'init.el')
-rw-r--r--init.el100
1 files changed, 23 insertions, 77 deletions
diff --git a/init.el b/init.el index 9e6f79f..53e7d0e 100644 --- a/init.el +++ b/init.el
@@ -641,83 +641,6 @@
641(setup (:straight (beginend)) 641(setup (:straight (beginend))
642 (beginend-global-mode +1)) 642 (beginend-global-mode +1))
643 643
644(setup common-lisp-ide
645 (defvar acdw/cl-ide :sly)
646 (defvar acdw/lisp-bin (or (executable-find "sbcl")
647 (executable-find "clisp")))
648 (:needs acdw/lisp-bin)
649 (:option inferior-lisp-program acdw/lisp-bin)
650
651 (setup (:straight clhs))
652
653 (defmacro acdw/cl-define-key (key-string &rest bindings)
654 "Define KEY-STRING to functions in BINDINGS.
655KEY-STRING is passed directly to `kbd'. BINDINGS are a lists of
656the form (:IDE MAP FUNC AFTER), where IDE is an IDE (like `slime' or
657`sly'), MAP is the mapping in which to bind KEY-STRING, FUNC
658is the function to bind KEY-STRING to in that IDE and MAP, and AFTER is the file to `eval-after-load' the `define-key' definition.
659`acdw/cl-define-key' only binds the keys that match `acdw/cl-ide'
660to save computation time."
661 (declare (indent 1))
662 (let* ((binding (catch :found
663 (dolist (b bindings)
664 (when (eq (car b) acdw/cl-ide)
665 (throw :found b)))))
666 (binding-map `,(nth 1 binding))
667 (binding-func `(function ,(nth 2 binding)))
668 (binding-after `,(nth 3 binding)))
669 `(with-eval-after-load ',binding-after
670 (define-key ,binding-map (kbd ,key-string) ,binding-func))))
671
672 (dolist (key '("RET" "<return>"))
673 (acdw/cl-define-key key
674 (:slime slime-repl-mode-map slime-repl-return-at-end slime)
675 (:sly sly-mrepl-mode-map sly-mrepl-return-at-end sly-mrepl)))
676
677 (eval-after-load 'sly-mrepl
678 (function
679 (lambda nil
680 (define-key sly-mrepl-mode-map
681 (kbd "C-c C-c")
682 (function sly-mrepl-return)))))
683
684 (pcase acdw/cl-ide
685 (:slime
686 (setup (:straight slime)
687 (:also-load slime-autoloads)
688
689 (when-let ((slime-helper (or (expand-file-name-exists-p
690 "~/quicklisp/slime-helper.el")
691 (expand-file-name-exists-p
692 "~/var/quicklisp/slime-helper.el"))))
693 (load slime-helper))
694
695 (defun slime-repl-return-at-end ()
696 (interactive)
697 (if (<= (point-max) (point))
698 (slime-repl-return)
699 (slime-repl-newline-and-indent)))
700
701 (with-eval-after-load 'company
702 (setup (:straight slime-company)
703 (:option slime-company-completion 'fuzzy
704 slime-company-after-completion nil)
705 (slime-setup '(slime-fancy slime-company))))))
706 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
707 (:sly
708 (setup (:straight sly)
709 (:option sly-kill-without-query-p t)
710
711 (defun sly-mrepl-return-at-end ()
712 (interactive)
713 (if (<= (point-max) (point))
714 (sly-mrepl-return)
715 (if (bound-and-true-p paredit-mode)
716 (paredit-newline)
717 (electric-newline-and-maybe-indent))))
718
719 (:also-load sly-autoloads)))))
720
721(setup (:straight (consult 644(setup (:straight (consult
722 :host github 645 :host github
723 :repo "minad/consult")) 646 :repo "minad/consult"))
@@ -1031,6 +954,29 @@ if ripgrep is installed, otherwise `consult-grep'."
1031 (require 'acdw-modeline) 954 (require 'acdw-modeline)
1032 (simple-modeline-mode +1)) 955 (simple-modeline-mode +1))
1033 956
957(setup (:straight sly)
958 (defvar acdw/lisp-bin (or (executable-find "sbcl")
959 (executable-find "clisp")))
960 (:needs acdw/lisp-bin)
961 (:option inferior-lisp-program acdw/lisp-bin
962 sly-kill-without-query-p t)
963
964 (:also-load sly-autoloads)
965 (setup (:straight clhs))
966
967 (:with-feature sly-mrepl
968 (dolist (key '("RET" "<return>"))
969 (:bind key sly-mrepl-return-at-end))
970 (:bind "C-c C-c" sly-mrepl-return))
971
972 (defun sly-mrepl-return-at-end ()
973 (interactive)
974 (if (<= (point-max) (point))
975 (sly-mrepl-return)
976 (if (bound-and-true-p paredit-mode)
977 (paredit-newline)
978 (electric-newline-and-maybe-indent)))))
979
1034(setup (:straight undo-fu) 980(setup (:straight undo-fu)
1035 (:global "C-/" undo-fu-only-undo 981 (:global "C-/" undo-fu-only-undo
1036 "C-?" undo-fu-only-redo)) 982 "C-?" undo-fu-only-redo))