smartparens
smartparens copied to clipboard
Cannot insert quotes when sp-escape-quotes-after-insert is nil
I just disabled sp-escape-quotes-after-insert, and now I cannot insert "
inside a " "
region anymore.
Can you give some more information: what mode, what sp version, what emacs version.
scratch mode
, smartparens 20170129.956
, emacs 26.0.50.1
.
I just tried Fish mode
with string " safasdf(cursor point)asdf "
. It still inputs escaped quote.
I have the same problem, smartparens 20170209
, emacs 26.0.50.2
. sp-escape-quotes-after-insert
and sp-escape-wrapped-region
are both set to nil
.
This seems to be an emacs 26 issue. I guess they changed the syntax tables once again :/
I'll try to get some tests running on that and see what's going on. Personally, I still use 24.5 :/ (I have zero time to update my config, sigh)
Confirmed to be a problem on 25.1
Could it be a bug in sp-escape-open-delimiter
? This function doesn't seem to check the values of sp-escape-quotes-after-insert
and sp-escape-wrapped-region
, and disabling it completely (with advice-add) fixes the problem for me.
This is really stupid on my part. There are two escaping features both of which kind of do the same but not. It is really confusing.
The option you refer to enables or disables escaping of pairs inserted when autopair is enabled. So if we have a buffer " foo | bar"
and you press "
it inserts " foo \"|\" bar"
.
If we have autopair disabled inside strings we still want to escape quotes so that it doesn't break the string structure when we insert a single quote. This is however controlled by the escape
action attribute on the pair itself (and this is handled by the function you've mentioned). So to disable that behaviour you would need to remove the escape action from the quote.
It seems that the issue here is misconfiguration. Admittedly it is really badly designed. Maybe the option could be renamed to better indicate that it only relates to inserted pairs and not any inserted quotes.
The relevant documentation is here http://smartparens.readthedocs.io/en/latest/automatic-escaping.html
Have tried everything, even (sp-local-pair "\"" nil :actions nil)
and stills does that annoying thing 😩 , I just want to go from this: "something|"
to this "something"|
instead of "something\"|\""
on elisp, mabe it's indeed a bug as in #961.
@ZzAntares that seems like a different issue because for me it does what you describe.
Try setting (setq sp-autoskip-closing-pair (quote always))
Thanks for the help, but sadly it still doesn't work, should I file an issue? This is what I'm using:
(use-package smartparens
:defer 3
:diminish smartparens-mode
:commands smartparens-mode
:hook (prog-mode . smartparens-mode)
:config
(setq sp-autoskip-closing-pair (quote always))
(require 'smartparens-config)
(sp-with-modes 'emacs-lisp-mode
(sp-local-pair "'" nil :actions nil)
(sp-local-pair "`" "'" :when '(sp-in-string-p sp-in-comment-p)))
(sp-with-modes 'markdown-mode
(sp-local-pair "_" "_")
(sp-local-pair "**" "**")
(sp-local-pair "~~" "~~"))
;; Indent a new line when pressing RET after pair insertion
(sp-pair "{" nil :post-handlers '((zz-newline-and-enter-sexp "RET")))
(sp-pair "(" nil :post-handlers '((zz-newline-and-enter-sexp "RET")))
(sp-pair "[" nil :post-handlers '((zz-newline-and-enter-sexp "RET"))))