smartparens
smartparens copied to clipboard
smartparens and use-package
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!
: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.
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.
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.
)
I don't know if it makes sense to add examples of changing faces to smartparens documentation. All these are use-package features.
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.
I think if someone wants one could add a paragraph to this Wiki entry https://github.com/Fuco1/smartparens/wiki/Installation