diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/init.el b/init.el index ddbb53f..24d71ed 100644 --- a/init.el +++ b/init.el | |||
@@ -650,6 +650,37 @@ | |||
650 | (:option inferior-lisp-program acdw/lisp-bin) | 650 | (:option inferior-lisp-program acdw/lisp-bin) |
651 | 651 | ||
652 | (setup (:straight clhs)) | 652 | (setup (:straight clhs)) |
653 | |||
654 | (defmacro acdw/cl-define-key (key-string &rest bindings) | ||
655 | "Define KEY-STRING to functions in BINDINGS. | ||
656 | KEY-STRING is passed directly to `kbd'. BINDINGS are a lists of | ||
657 | the form (:IDE MAP FUNC AFTER), where IDE is an IDE (like `slime' or | ||
658 | `sly'), MAP is the mapping in which to bind KEY-STRING, FUNC | ||
659 | is 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. | ||
660 | `acdw/cl-define-key' only binds the keys that match `acdw/cl-ide' | ||
661 | to save computation time." | ||
662 | (declare (indent 1)) | ||
663 | (let* ((binding (catch :found | ||
664 | (dolist (b bindings) | ||
665 | (when (eq (car b) acdw/cl-ide) | ||
666 | (throw :found b))))) | ||
667 | (binding-map `,(nth 1 binding)) | ||
668 | (binding-func `(function ,(nth 2 binding))) | ||
669 | (binding-after `,(nth 3 binding))) | ||
670 | `(with-eval-after-load ',binding-after | ||
671 | (define-key ,binding-map (kbd ,key-string) ,binding-func)))) | ||
672 | |||
673 | (dolist (key '("RET" "<return>")) | ||
674 | (acdw/cl-define-key key | ||
675 | (:slime slime-repl-mode-map slime-repl-return-at-end slime) | ||
676 | (:sly sly-mrepl-mode-map sly-mrepl-return-at-end sly-mrepl))) | ||
677 | |||
678 | (eval-after-load 'sly-mrepl | ||
679 | (function | ||
680 | (lambda nil | ||
681 | (define-key sly-mrepl-mode-map | ||
682 | (kbd "C-c C-c") | ||
683 | (function sly-mrepl-return))))) | ||
653 | 684 | ||
654 | (pcase acdw/cl-ide | 685 | (pcase acdw/cl-ide |
655 | (:slime | 686 | (:slime |
@@ -662,10 +693,6 @@ | |||
662 | "~/var/quicklisp/slime-helper.el")))) | 693 | "~/var/quicklisp/slime-helper.el")))) |
663 | (load slime-helper)) | 694 | (load slime-helper)) |
664 | 695 | ||
665 | (with-eval-after-load 'slime | ||
666 | (dolist (key (list (kbd "RET") | ||
667 | (kbd "<return>"))) | ||
668 | (define-key slime-repl-mode-map key #'slime-repl-return-at-end))) | ||
669 | (defun slime-repl-return-at-end () | 696 | (defun slime-repl-return-at-end () |
670 | (interactive) | 697 | (interactive) |
671 | (if (<= (point-max) (point)) | 698 | (if (<= (point-max) (point)) |
@@ -681,11 +708,6 @@ | |||
681 | (:sly | 708 | (:sly |
682 | (setup (:straight sly) | 709 | (setup (:straight sly) |
683 | (:option sly-kill-without-query-p t) | 710 | (:option sly-kill-without-query-p t) |
684 | |||
685 | (with-eval-after-load 'sly-mrepl | ||
686 | (dolist (key (list (kbd "RET") | ||
687 | (kbd "<return>"))) | ||
688 | (define-key sly-mrepl-mode-map key #'sly-mrepl-return-at-end))) | ||
689 | 711 | ||
690 | (defun sly-mrepl-return-at-end () | 712 | (defun sly-mrepl-return-at-end () |
691 | (interactive) | 713 | (interactive) |