Fuco1 / smartparens

Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
GNU General Public License v3.0
1.8k stars 193 forks source link

Error when running smartparens in python mode #1165

Closed arozbiz closed 8 months ago

arozbiz commented 1 year ago

Expected behavior

When switching a buffer to python mode, I should not get a smartparens related error.

Actual behavior

I get the following error: run-hooks: Autoloading file /home/alan/.emacs.d/elpa/smartparens-20230529.1017/smartparens.elc failed to define function smartparents-mode

Steps to reproduce the problem

Install smartparens as follows:

(use-package smartparens
  :hook (python-mode . smartparents-mode)
  :bind (:map python-mode-map
              ("M-<right>" . sp-forward-slurp-sexp)
              ("M-<left>" . sp-forward-barf-sexp)))

Create a new buffer and run python-mode.

Backtraces if necessary (M-x toggle-debug-on-error)

Debugger entered--Lisp error: (error "Autoloading file /home/alan/.emacs.d/elpa/smartpar...")
  smartparents-mode()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook python-base-mode-hook python-mode-hook)
  apply(run-hooks change-major-mode-after-body-hook (prog-mode-hook python-base-mode-hook python-mode-hook))
  run-mode-hooks(python-mode-hook)
  python-mode()
  funcall-interactively(python-mode)
  command-execute(python-mode record)
  #<subr execute-extended-command>(nil "python-mode" "python")
  ad-Advice-execute-extended-command(#<subr execute-extended-command> nil "python-mode" "python")
  apply(ad-Advice-execute-extended-command #<subr execute-extended-command> (nil "python-mode" "python"))
  execute-extended-command(nil "python-mode" "python")
  funcall-interactively(execute-extended-command nil "python-mode" "python")
  command-execute(execute-extended-command)

Environment & version information

In recent enough smartparens you can call M-x sp-describe-system to generate this report. Please fill manually what we could not detect automatically. Edit the output as you see fit to protect your privacy.

- `smartparens` version: 20230529.1017
- Active `major-mode`: `python-mode`
- Smartparens strict mode: nil
- Emacs version (`M-x emacs-version`): GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.17.8) of 2023-06-06
- Starterkit/Distribution: Vanilla
- OS: gnu/linux
Fuco1 commented 8 months ago

This is a typo in your config: :hook (python-mode . smartparents-mode) smart parents should be smart parens.