Skip to content

Commit

Permalink
Close #639: Add option to control if we replace SLIME on load
Browse files Browse the repository at this point in the history
Use it to control whether to prompt interactively about replacing
SLIME, and if not prompting whether to replace or not replace.  Thanks
to Stefan Monnier for suggesting improvements to the original patch.

* sly.el (sly-replace-slime): New defcustom.

Co-authored-by João Távora <joaotavora@gmail.com>
  • Loading branch information
kfogel authored May 1, 2024
1 parent 0ebe705 commit ba40c8f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion sly.el
Original file line number Diff line number Diff line change
Expand Up @@ -7475,11 +7475,25 @@ can be found."
;;;###autoload
(add-hook 'lisp-mode-hook 'sly-editing-mode)

(defcustom sly-replace-slime 'ask
"Specify whether SLY should replace SLIME at load time.

This only has an effect if parts of SLIME components are already
loaded (e.g. in `lisp-mode-hook').

If `ask' prompt the user at load-time; if nil never replace; if t or
other non-nil value to unconditionally replace SLIME."
:type '(choice (const :tag "Ask user" ask)
(const :tag "Do not replace SLIME" nil)
(const :tag "Do replace SLIME" t)))

(cond
((or (not (memq 'slime-lisp-mode-hook lisp-mode-hook))
noninteractive
(prog1
(y-or-n-p "[sly] SLIME detected in `lisp-mode-hook', causes keybinding conflicts. Remove it for this Emacs session?")
(if (eq sly-replace-slime 'ask)
(y-or-n-p "[sly] SLIME detected in `lisp-mode-hook', causes keybinding conflicts. Remove it for this Emacs session?")
sly-replace-slime)
(warn "To restore SLIME in this session, customize `lisp-mode-hook'
and replace `sly-editing-mode' with `slime-lisp-mode-hook'.")))
(remove-hook 'lisp-mode-hook 'slime-lisp-mode-hook)
Expand Down

0 comments on commit ba40c8f

Please sign in to comment.