smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

smartparens and use-package

Open scmbradley opened this issue 3 years ago • 5 comments

I am using smartparens with use-package. The following works fine:

(use-package smartparens-mode
  :ensure smartparens
  :hook (prog-mode text-mode markdown-mode)
  :init
  (require 'smartparens-config)
  )

but smartparens-config is not loaded if I replace :init with :config. This might be as expected behaviour, but perhaps the README could include a sample use-package configuration, because it took a few tries to get it to work!

scmbradley avatar Jun 03 '21 11:06 scmbradley

:config only runs after the autoloads or when the package is actually loaded. Look at the expanded use-package code to figure out what's happening (I don't know). This is 100% not a smartparens issue.

Fuco1 avatar Jun 04 '21 13:06 Fuco1

No the issue I am pointing to is one for smartparens documentation: it would be nice if the docs gave a minimal working use-package configuration.

scmbradley avatar Jun 05 '21 14:06 scmbradley

I agree it would be helpful, and here's an example that includes changing a face, which I just figured out.

(use-package smartparens
  :diminish smartparens-mode ;; Do not show in modeline
  :init
  (require 'smartparens-config)
  :config
  (smartparens-global-mode t) ;; These options can be t or nil.
  (show-smartparens-global-mode t)
  (setq sp-show-pair-from-inside t)
  :custom-face
  (sp-show-pair-match-face ((t (:foreground "White")))) ;; Could also have :background "Grey" for example.
  )

wdenton avatar Sep 27 '21 22:09 wdenton

I don't know if it makes sense to add examples of changing faces to smartparens documentation. All these are use-package features.

Fuco1 avatar Nov 01 '21 11:11 Fuco1

It's one example of how to install and configure smartparens, and as someone who often struggles with configuring packages, I say the more examples the better. The means is use-package, but the end is the same as any other mechanism: a customized smartparens configuration that people can copy, paste and modify. I think this would be helpful to users, but it's up to you, of course.

Thanks for all your work on this package, which I greatly appreciate.

wdenton avatar Nov 04 '21 02:11 wdenton

I think if someone wants one could add a paragraph to this Wiki entry https://github.com/Fuco1/smartparens/wiki/Installation

Hi-Angel avatar Jan 31 '23 07:01 Hi-Angel