I am trying to use a certain minor mode (inferior-scheme-mode), which is activated by M-x run-scheme. But its key combinations are masked by another competing minor mode (geiser-mode).

How can I configure Emacs to automatically disable the competing/conflicting minor mode when activating the one that I need?

I tried the following elisp in init.el to no avail (I don't know much about elisp):

(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme" t)

(defun enable-inf-scheme-mode()
  "Turns on inferior-scheme-mode and turn off conflicting modes (geiser-mode)"
  (geiser-mode 0))
(add-hook 'inferior-scheme-mode-hook 'enable-inf-scheme-mode)

However, I can manually disable the conflicting mode using M-: (geiser-mode 0).

Note: run-scheme creates a new inferior-scheme-mode buffer that hides the original scheme-mode buffer (somewhat annoyingly). I wanted to disable the geiser-mode on the original scheme-mode buffer. I am not sure if this is why the code isn't working.

  • 1
    Maybe your hook is called before geiser-mode is enabled. A quick solution is to write a function to enable geiser-mode, but only when your other mode isn't enabled, and use the new function in hooks. Nov 7, 2022 at 16:25
  • @Lindydancer Thanks. But I think geiser-mode is always enabled somehow in my .init.el. I actually tried to remove geiser, but unsuccessfully. Geiser is always there in C-h m, unless I remove my whole scheme lines.
    – tinlyx
    Nov 7, 2022 at 21:40
  • My suggestion is that you add your "whole scheme lines" to your question. Something may jump out at somebody...
    – NickD
    Nov 7, 2022 at 21:45
  • 1
    @NickD I'll try sometime later. Currently, my shceme lines are mixed with a large number of lines with many other languages (including some that do require geiser) and probably spreading multiple files. I also accidentally included geiser in another unrelated .el file because of copy-and-pasting from online examples. I think this goes against minimal completeness.
    – tinlyx
    Nov 8, 2022 at 2:04
  • 1
    If you needed an excuse to clean up your init file, you now have one :-)
    – NickD
    Nov 8, 2022 at 2:06

1 Answer 1


After reading and re-reading your question a few times, I think I understand what you want.

  • You have a Scheme source file open.
  • You'd like to start an inferior-scheme-mode REPL.
    • It would be nice if this REPL could coexist in the same frame as the original Scheme source file without replacing it.
    • It would be nice if on the Scheme source file side, geiser-mode is disabled.

With this in mind, let's instruct Emacs very explicitly.

(defun run-scheme-without-geiser ()
  "Run scheme-program-name and disable geiser-mode."
  (geiser-mode -1)
  (run-scheme scheme-program-name))

I made an executive decision to keep the source on the left while the REPL is on the right. We can change that if you don't like that layout. Load this function, and try doing M-x run-scheme-without-geiser. Let me know if that works for you.

PS: If you want to get more comfortable with Elisp, I recommend using M-x ielm. It'll let you explore Elisp in a comfortable REPL. Also, become familiar with the following two keybindings and use them a lot to ask Emacs about itself.

  • C-h f - What does this function do?
  • C-h v - What is this variable for?

PPS: Someone asked me in the past about how to get out of ielm. Just C-x k to delete the buffer. Switching to another buffer with C-x b is fine too.

  • 1
    PPPS: C-c C-d in IELM will end the IELM session but leave the IELM buffer open. Nov 8, 2022 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.