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

Use-package declaration in readme doesn't load properly #1207

Closed Esnos33 closed 6 days ago

Esnos33 commented 1 month ago

Expected behavior

When code from readme is in init.el

(use-package smartparens-mode
  :ensure smartparens  ;; install the package
  :hook (prog-mode text-mode markdown-mode) ;; add `smartparens-mode` to these hooks
  :config
  ;; load default config
  (require 'smartparens-config))

The smartparens-config should be loaded when opening .lisp or .el file, in particular

(sp-with-modes sp-lisp-modes
  ;; disable ', it's the quote character!
  (sp-local-pair "'" nil :actions nil))

should be loaded, and typing quote ' shouldn't make pair ''.

Actual behavior

After typing ', the pair '' is typed.

My current fix to is to change :config to :init in use-package declaration.

Steps to reproduce the problem

Copy paste use-package declaration to init.el eval init.el type ' in blank line

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

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.

sg2002 commented 1 week ago

It seems like absolutely nothing from the :config section gets evaluated. This can be easily tested by trying something like (message "smartparens loaded") there.

In addition non-defered loading causes an error: "Error (use-package): Cannot load smartparens-mode" This can be reproduced by removing the :hook section from the above recipe.

Fuco1 commented 6 days ago

The package name after use-package needs to be the provide of the packege, so smartparens, not smartparens-mode. I will fix it.