M-x slime [No match]

199 Views Asked by At

I installed Emacs 29.2 and sbcl 2.4.0.

Then I installed slime using the command M-x package-install<Ret>slime<Ret>. I can see that slime is installed (M-x list-packages):

enter image description here

Now, I'm trying to get slime to work following these instructions:

It is simple as:

  1. Open emacs
  2. Open your lisp file with fibonacci function
  3. Issue M-x slime
  4. Place you cursor over fibonacci function and press C-c C-c to evaluate/compile it in Slime.
  5. switch to slime window and call (fibonacci 10)

Screenshot example with hello-world function:

In emacs, I opened a hello world .lisp file with C-x C-f. However, when I type M-x slime<Ret>, I get [No match]. Same for M-x slime-mode<Ret>.

Here is my ~/.emacs file:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(slime paredit)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

;;;;;;;;;;;;;;;;;;;;;;;

;; I added the following according to slime install directions:

(setq inferior-lisp-program "sbcl")

sbcl is in my path:

% which sbcl
/opt/local/bin/sbcl

% echo $PATH
...:/Users/7stud/bin/:/opt/local/bin:....

I tried altering the .emacs file to use the full path to sbcl:

(setq inferior-lisp-program "/opt/local/bin/sbcl")

but I still get M-x slime [No match]. I've been quitting emacs and relaunching it after I make changes to the .emacs file.

Here is my ~/.emacs.d/elpa directory (which I haven't touched):

% ls
archives               macrostep-0.9.2.signed slime-2.29.1
gnupg                  paredit-26             slime-2.29.1.signed
macrostep-0.9.2        paredit-26.signed

There were a bunch of warnings when I installed slime, but I can't find where those warnings are logged, so I can't post them.

I was able to successfully install and use the package paredit. When I open a .lisp file, it opens in Lisp major-mode, and if I do M-x paredit-mode, that adds Paredit as a minor-mode:

enter image description here

After adding Paredit as a minor-mode, parentheses get matched, so it works.

I'm on macOS 12.5.1, and I installed emacs with:

% sudo port install emacs-app 

Edit: =======

I unistalled slime by displaying the package list, M-x list-packages, then searching for the slime listing, C-s, then typing d on the slime listing, then typing x. I reinstalled slime by finding the slime listing again, then typing i on the slime line, then x. Here are the warnings:

⛔ Warning (comp): slime-autodoc.el:51:17: Warning: ‘eldoc-message’ is an obsolete function (as of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): slime-autodoc.el:52:15: Warning: ‘eldoc-message’ is an obsolete function (as of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): slime-autodoc.el:64:8: Warning: ‘eldoc-message’ is an obsolete function (as of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): slime-autodoc.el:106:8: Warning: ‘font-lock-fontify-buffer’ is for interactive use only; use ‘font-lock-ensure’ or ‘font-lock-flush’ instead.
⛔ Warning (comp): slime-autodoc.el:165:14: Warning: ‘eldoc-display-message-p’ is an obsolete function (as of eldoc-1.6.0); Use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): slime-autodoc.el:166:10: Warning: ‘eldoc-message’ is an obsolete function (as of eldoc-1.1.0); use ‘eldoc-documentation-functions’ instead.
⛔ Warning (comp): bridge.el:115:2: Warning: defvar `bridge-leftovers' docstring wider than 80 characters
⛔ Warning (comp): slime-cl-indent.el:115:2: Warning: custom-declare-variable `lisp-align-keywords-in-calls' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-cl-indent.el:1448:2: Warning: defvar `common-lisp-indent-clause-joining-loop-macro-keyword' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): hyperspec.el:1320:4: Warning: Alias for ‘common-lisp-hyperspec-glossary-function’ should be declared before its referent
⛔ Warning (comp): slime.el:112:2: Warning: Alias for ‘slime-contribs’ should be declared before its referent
⛔ Warning (comp): slime.el:277:12: Warning: defcustom for ‘slime-completion-at-point-functions’ fails to specify type
⛔ Warning (comp): slime.el:689:4: Warning: Doc string after `declare'
⛔ Warning (comp): slime.el:1160:6: Warning: ‘byte-compile-file’ called with 2 arguments, but accepts only 1
⛔ Warning (comp): slime.el:2408:10: Warning: ‘hide-entry’ is an obsolete function (as of 25.1); use ‘outline-hide-entry’ instead.
⛔ Warning (comp): slime.el:3081:12: Warning: ‘beginning-of-sexp’ is an obsolete function (as of 25.1); use ‘thing-at-point--beginning-of-sexp’ instead.
⛔ Warning (comp): slime.el:3392:16: Warning: ‘beginning-of-sexp’ is an obsolete function (as of 25.1); use ‘thing-at-point--beginning-of-sexp’ instead.
⛔ Warning (comp): slime.el:3681:20: Warning: ‘find-tag-marker-ring’ is an obsolete variable (as of 25.1); use ‘xref-push-marker-stack’ or ‘xref-go-back’ instead.
⛔ Warning (comp): slime.el:4113:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime.el:4960:6: Warning: ‘font-lock-fontify-buffer’ is for interactive use only; use ‘font-lock-ensure’ or ‘font-lock-flush’ instead.
⛔ Warning (comp): slime.el:5536:10: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime.el:5692:10: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime.el:5795:10: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime.el:6329:8: Warning: Obsolete calling convention for 'sit-for'
⛔ Warning (comp): slime.el:6611:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime.el:7187:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime.el:7194:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime.el:7312:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-parse.el:319:20: Warning: Stray ‘declare’ form: (declare (ignore args))
⛔ Warning (comp): slime-repl.el:130:2: Warning: defvar `slime-repl-history-use-mark' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-repl.el:138:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-repl.el:978:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): slime-repl.el:1580:22: Warning: Stray ‘declare’ form: (declare (ignore args))
⛔ Warning (comp): slime-repl.el:1689:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-presentations.el:601:2: Warning: docstring wider than 80 characters
⛔ Warning (comp): slime-presentations.el:759:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-presentations.el:760:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-presentations.el:761:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-presentations.el:762:4: Warning: ‘easy-menu-add’ is an obsolete function (as of 28.1); this was always a no-op in Emacs and can be safely removed.
⛔ Warning (comp): slime-references.el:102:67: Warning: reference to free variable ‘name’
⛔ Warning (comp): slime-references.el:107:15: Warning: ‘:info’ called as a function
⛔ Warning (comp): slime-references.el:109:15: Warning: ‘t’ called as a function
⛔ Warning (comp): slime-references.el:109:15: Warning: the function ‘t’ is not known to be defined.
⛔ Warning (comp): slime-references.el:107:15: Warning: the function ‘:info’ is not known to be defined.
⛔ Warning (comp): slime-references.el:106:13: Warning: the function ‘case’ is not known to be defined.
⛔ Warning (comp): slime-package-fu.el:226:21: Warning: ‘looking-back’ called with 1 argument, but requires 2 or 3
⛔ Warning (comp): slime-package-fu.el:263:14: Warning: ‘looking-back’ called with 1 argument, but requires 2 or 3
⛔ Warning (comp): slime-trace-dialog.el:162:12: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime-trace-dialog.el:248:16: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime-trace-dialog.el:261:28: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime-trace-dialog.el:352:13: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): slime-trace-dialog.el:478:12: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead

I checked the output in *Messages*, but it's too voluminous to post here. Here is the end of the output:

...
...
Warning: Optimization failure for make-ert-test: Handler: make-ert-test--cmacro
(error "Keyword argument :file-name not one of (:name :documentation :body :most-recent-result :expected-result-type :tags)")
Warning: Optimization failure for make-ert-test: Handler: make-ert-test--cmacro
(error "Keyword argument :file-name not one of (:name :documentation :body :most-recent-result :expected-result-type :tags)")
Warning: Optimization failure for make-ert-test: Handler: make-ert-test--cmacro
(error "Keyword argument :file-name not one of (:name :documentation :body :most-recent-result :expected-result-type :tags)")
Wrote /Users/7stud/.emacs.d/elpa/slime-2.29.1/contrib/test/slime-repl-tests.elc
Checking /Users/7stud/.emacs.d/elpa/slime-2.29.1/contrib/test...
Done (Total of 57 files compiled, 2 skipped in 4 directories)
ad-handle-definition: ‘slime-note.message’ got redefined
Package ‘slime’ installed.
Operation [ Install 1 ] finished
2

There are 2 best solutions below

2
Ehvince On BEST ANSWER

You were nearly there:

However, when I type M-x slime, I get [No match]

you are missing

(require 'slime)

You must add this in your ~/.emacs (or "~/.emacs.d/init.el") and you can evaluate in your current session with M-: or M-x eval-expression<Ret> (require 'slime)<Ret>.

12
7stud On

I was never able to get slime to work when I followed the slime install instructions. I decided to look around for another emacs distribution and try something else. I visited the emacs4cl repo, and they have a .emacs file you can download. I decided to try that .emacs file with my current emacs install.

First, I moved the current ~/.emacs file and the ~/.emacs.d/ directory to ~/.xemacs and ~/.xemacs.d/, then I put the .emacs file from emacs4cl in my home directory: ~/.emacs. After that, I started up emacs, and once again there were lots of warnings from the various packages that were installed, but when I typed M-x slime, another window opened up:

enter image description here

Here's the .emacs file from emacs4cl:

;; Customize user interface.
(when (display-graphic-p)
  (tool-bar-mode 0)
  (scroll-bar-mode 0))
(setq inhibit-startup-screen t)

;; Dark theme.
(load-theme 'wombat)
(set-face-background 'default "#111")

;; Use spaces, not tabs, for indentation.
(setq-default indent-tabs-mode nil)

;; Highlight matching pairs of parentheses.
(setq show-paren-delay 0)
(show-paren-mode)

;; Workaround for https://debbugs.gnu.org/34341 in GNU Emacs <= 26.3.
(when (and (version< emacs-version "26.3") (>= libgnutls-version 30603))
  (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))

;; Write customizations to a separate file instead of this file.
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file t)

;; Enable installation of packages from MELPA.
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

;; Install packages.
(dolist (package '(slime paredit rainbow-delimiters))
  (unless (package-installed-p package)
    (package-install package)))

;; Configure SBCL as the Lisp program for SLIME.
(add-to-list 'exec-path "/usr/local/bin")
(setq inferior-lisp-program "sbcl")

;; Enable Paredit.
(add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook 'enable-paredit-mode)
(add-hook 'ielm-mode-hook 'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook 'enable-paredit-mode)
(add-hook 'lisp-mode-hook 'enable-paredit-mode)
(add-hook 'slime-repl-mode-hook 'enable-paredit-mode)
(require 'paredit)
(defun override-slime-del-key ()
  (define-key slime-repl-mode-map
    (read-kbd-macro paredit-backward-delete-key) nil))
(add-hook 'slime-repl-mode-hook 'override-slime-del-key)

;; Enable Rainbow Delimiters.
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
(add-hook 'ielm-mode-hook 'rainbow-delimiters-mode)
(add-hook 'lisp-interaction-mode-hook 'rainbow-delimiters-mode)
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
(add-hook 'slime-repl-mode-hook 'rainbow-delimiters-mode)

;; Customize Rainbow Delimiters.
(require 'rainbow-delimiters)
(set-face-foreground 'rainbow-delimiters-depth-1-face "#c66")  ; red
(set-face-foreground 'rainbow-delimiters-depth-2-face "#6c6")  ; green
(set-face-foreground 'rainbow-delimiters-depth-3-face "#69f")  ; blue
(set-face-foreground 'rainbow-delimiters-depth-4-face "#cc6")  ; yellow
(set-face-foreground 'rainbow-delimiters-depth-5-face "#6cc")  ; cyan
(set-face-foreground 'rainbow-delimiters-depth-6-face "#c6c")  ; magenta
(set-face-foreground 'rainbow-delimiters-depth-7-face "#ccc")  ; light gray
(set-face-foreground 'rainbow-delimiters-depth-8-face "#999")  ; medium gray
(set-face-foreground 'rainbow-delimiters-depth-9-face "#666")  ; dark gray 

I opened a hello world .lisp file in the top window, C-x C-f. Then I put the cursor to the right of the last parenthesis of a function definition, then I hit C-x C-e, and the name of the function appeared in the echo line below the slime window. But I couldn't execute the function in the slime repl: I got an error saying the function name wasn't recognized. I also noticed the rainbow parentheses weren't working. Hold on...I just quit emacs and relaunched it, and now C-x C-e works as expected: I see the function name returned on the echo line below the slime window, then I can execute the function in the slime repl...and now I can see the rainbow parentheses.

Also, on my first try with the new .emacs file, when I put the cursor in the middle of a function and typed C-c C-c, the echo window said something like "unrecognized command", and now that works just like C-x C-e. Hallelujah!

Here are the differences in the directories:

~/.emacs.d% ls
auto-save-list custom.el      eln-cache      elpa
~/.emacs.d% cd elpa
~/.emacs.d/elpa  ls
archives                         paredit-20221127.1452
gnupg                            rainbow-delimiters-20210515.1254
macrostep-20230813.2123          slime-20240125.1336

~/.xemacs.d% ls
auto-save-list eln-cache      elpa
~/.xemacs.d% cd elpa
~/.xemacs.d/elpa%  ls
archives               macrostep-0.9.2.signed slime-2.29.1
gnupg                  paredit-26             slime-2.29.1.signed
macrostep-0.9.2        paredit-26.signed

The directories look different, but I don't know what the significance of that is.

Some other things I did:

  1. To increase font size: C-x C-+ (command + stopped working). Or, permanently set the font size in ~/.emacs:

    (set-face-attribute 'default nil :font "Menlo" :height 180)
    ;; The "height" is 100 times the font size.
    
  2. To change meta key from command to option: In .emacs I added:

     (setq mac-command-key-is-meta nil) ; set cmd-key to nil   
     (setq mac-option-modifier 'meta) ; set option-key to meta