0

I'm using smartparens-global-strict-modeand having issues quoting variables. How do I get something like 'varname? My current strategy, which seems ridiculous, is to do:

'|' (sp inserts both pairs)

'varname' (write the varname)

at this point, I do M-x smartparens-strict-mode, which toggles it off, delete the right ', then do M-x smartparens-strict-mode again to turn it back on. But there's got to be a better way, right? Am I missing something simple?

2

What major mode are you using? In emacs-lisp-mode, Smartparens does not automatically close single quotes.

To insert a single character, use C-q, quoted-insert, followed by the character. E.g. C-q ' to insert a single quote.

  • Huh. This happens in all major modes, including emacs-lisp-mode. I guess something else in my init file is causing that, then... The C-q tip works. Thanks for that. – Alex Aug 23 '16 at 1:31
1

Specific answer: The default configuration for smartparens should cover this, but perhaps you aren't loading the default config. Make sure that

(require 'smartparens-config)

is in your .emacs.d instead of just (require 'smartparens).

More generally, to see the delimiters that smartparens is currently tracking, inspect variable sp-pair-list. You can use the functions sp-pair and sp-local-pair to configure it. For example to globally disable autoinsertion of closing single quotes you can write:

(sp-pair "'" "'" :actions nil)

Or to disable for specific modes:

(sp-local-pair '(emacs-lisp-mode) "'" "'" :actions nil)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.