Clean up slime settings

This commit is contained in:
Marcus Kammer 2024-12-23 21:08:56 +01:00
parent 127e6569e2
commit efcfc9ba30
Signed by: marcuskammer
GPG key ID: C374817BE285268F

87
init.el
View file

@ -840,74 +840,32 @@ Uses `mk/hyperspec-dir-locations' to find the directory."
(setq common-lisp-hyperspec-root (mk/hyperspec-dir)) (setq common-lisp-hyperspec-root (mk/hyperspec-dir))
(use-package slime (use-package slime
:defer t
:init
(setq inferior-lisp-program "sbcl")
:custom :custom
(slime-autodoc-use-multiline-p 1) (slime-autodoc-use-multiline-p t)
(slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
(slime-net-coding-system 'utf-8-unix)
:config :config
(define-key slime-mode-map (kbd "C-c C-q") 'slime-close-all-parens-in-sexp) (define-key slime-mode-map (kbd "C-c C-q") 'slime-close-all-parens-in-sexp)
(slime-setup '(slime-autodoc (slime-setup '(slime-fancy
slime-tramp slime-autodoc
slime-fancy
slime-asdf slime-asdf
slime-indentation slime-indentation
slime-editing-commands
slime-sbcl-exts slime-sbcl-exts
slime-company)) slime-company))
;; To create a slime specific sbcl image: ;; REPL syntax highlighting
;; shell$ sbcl
;; * (mapc 'require '(sb-bsd-sockets sb-posix sb-introspect sb-cltl2 asdf))
;; * (save-lisp-and-die "sbcl.core-for-slime")
;; Stop SLIME's REPL from grabbing DEL,
;; which is annoying when backspacing over a '('
;; (defun override-slime-repl-bindings-with-paredit ()
;; (define-key slime-repl-mode-map
;; (read-kbd-macro paredit-backward-delete-key) nil))
;; (add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)
(setq common-lisp-hyperspec-symbol-table
(concat common-lisp-hyperspec-root "Data/Map_Sym.txt"))
(setq common-lisp-hyperspec-issuex-table
(concat common-lisp-hyperspec-root "Data/Map_IssX.txt"))
(let ((image-path (expand-file-name "~/sbcl.core-for-slime")))
(if (file-exists-p image-path)
(setq slime-lisp-implementations
`((sbcl ("sbcl" "--noinform" "--core" ,image-path) :coding-system utf-8-unix)))
(setq slime-lisp-implementations
`((sbcl ("sbcl" "--noinform") :coding-system utf-8-unix)))))
(defvar mk/slime-remote-instances
'((:machine-instance "code-metalisp"
:remote-host "code.metalisp.dev"
:username "cl")
(:machine-instance "u1-marcsukammer"
:remote-host "u1.marcsukammer.dev"
:username "marcus")))
(mapc (lambda (instance)
(push (slime-create-filename-translator
:machine-instance (plist-get instance :machine-instance)
:remote-host (plist-get instance :remote-host)
:username (plist-get instance :username))
slime-filename-translations))
mk/slime-remote-instances)
;; syntax highlighting
(defvar slime-repl-font-lock-keywords lisp-font-lock-keywords-2) (defvar slime-repl-font-lock-keywords lisp-font-lock-keywords-2)
(defun slime-repl-font-lock-setup () (defun slime-repl-font-lock-setup ()
(setq font-lock-defaults (setq font-lock-defaults
'(slime-repl-font-lock-keywords '(slime-repl-font-lock-keywords
;; From lisp-mode.el
nil nil (("+-*/.<>=!?$%_&~^:@" . "w")) nil nil nil (("+-*/.<>=!?$%_&~^:@" . "w")) nil
(font-lock-syntactic-face-function . lisp-font-lock-syntactic-face-function)))) (font-lock-syntactic-face-function . lisp-font-lock-syntactic-face-function))))
(add-hook 'slime-repl-mode-hook 'slime-repl-font-lock-setup) (add-hook 'slime-repl-mode-hook 'slime-repl-font-lock-setup)
;; Custom REPL prompt
(defadvice slime-repl-insert-prompt (after font-lock-face activate) (defadvice slime-repl-insert-prompt (after font-lock-face activate)
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
(add-text-properties (add-text-properties
@ -915,7 +873,30 @@ Uses `mk/hyperspec-dir-locations' to find the directory."
'(font-lock-face '(font-lock-face
slime-repl-prompt-face slime-repl-prompt-face
rear-nonsticky rear-nonsticky
(slime-repl-prompt read-only font-lock-face intangible)))))) (slime-repl-prompt read-only font-lock-face intangible)))))
;; Load custom core file if it exists
(let ((core-path (expand-file-name "~/sbcl.core-for-slime")))
(when (file-exists-p core-path)
(setq slime-lisp-implementations
`((sbcl ("sbcl" "--noinform" "--core" ,core-path) :coding-system utf-8-unix)))))
;; Remote instance configuration
(setq mk/slime-remote-instances
'((:machine-instance "code-metalisp"
:remote-host "code.metalisp.dev"
:username "cl")
(:machine-instance "u1-marcsukammer"
:remote-host "u1.marcsukammer.dev"
:username "marcus")))
(mapc (lambda (instance)
(push (slime-create-filename-translator
:machine-instance (plist-get instance :machine-instance)
:remote-host (plist-get instance :remote-host)
:username (plist-get instance :username))
slime-filename-translations))
mk/slime-remote-instances))
(use-package slime-company (use-package slime-company
:after (slime company) :after (slime company)