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.82k stars 195 forks source link

Strict mode insert single quote #940

Closed someonewithpc closed 6 months ago

someonewithpc commented 5 years ago

I'm trying to make it so that I can insert a single quote for working in emacs lisp, with strict mode enabled. I found these, which both seem to work individually, with strict-mode disabled.

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

C-q is not a solution. Temporariily disabling strict mode is not a solution.

Environment & version information

Fuco1 commented 5 years ago

What happens with those two snippets when you enable strict mode? Does it still pair up? Or is the issue that you can not delete the quotes? I'm using the same setup and it works (no pairing, can delete)

someonewithpc commented 5 years ago

Ok, I think the issue was actually caused by having

(sp-local-pair 'emacs-lisp-mode "`" "'")

in there as well. It was giving me and error saying it can't insert closing unmatched delimiters in strict mode, or something to that effect, which should have tipped me off in the right direction. Aside from that, since I'm now experimenting with running emacs as a server, I think I just wasn't restarting it properly or something. So, without that line above, it does indeed work, with it, it doesn't.

Fuco1 commented 5 years ago

For the backtick-quote pair you need some more setup because it is only valid in some cases (backtick can also be used in code as a prefix). There is setup for this in smartparens-config.el which I recommend using.