How can I get
electric-pair-mode to not pair quotation marks (single or double)? I still want it to pair everything else (brackets, braces, etc.), just not quotes.
Add the following to your emacs init file:
(setq electric-pair-inhibit-predicate (lambda (c) (if (char-equal c ?\") t (electric-pair-default-inhibit c))))
Reference from my blog post: https://www.topbug.net/blog/2016/09/29/emacs-disable-certain-pairs-for-electric-pair-mode/
It appears you cannot. The various customizations only allow you to add pairs.
If you're willing to use a different package to do your pairing, you can try smartparens. You can set quotation marks to not pair as follows:
(sp-pair "'" nil :actions :rem) (sp-pair "\"" nil :actions :rem)
Update: @xuhdev's answer is preferable as it doesn't interfere with Emacs' code.
Might be worth a feature request having that customizable. For the moment, it looks trivial to modify the code in question.
Afterwards load your own variant of electric-pair-post-self-insert-function
Open elec-pair.el and copy from there
(defun electric-pair-post-self-insert-function () [ ... ] )
Then look into the body for any
(memq syntax '(?\( ?\) ?\" ?\$))
and delete the
?\" from there, i.e.
(memq syntax '(?\( ?\) ?\$))
but not delete ?\" at other places(!)
and reload i.e. evaluate the changed function.
To reload at next session put it into some file "my-changed-stuff.el" and load this from your init-file.
I think it could be simpler, based on @xuhdev's answer:
(setq electric-pair-inhibit-predicate (lambda (c) (char-equal c ?\")))
The doc says
The function is called with a single char (the opening char just inserted). If it returns non-nil, then ‘electric-pair-mode’ will not insert a matching closer.
So the lambda only needs to return a boolean.