Function: c-electric-pair-inhibit-predicate
c-electric-pair-inhibit-predicate is a byte-compiled function defined
in cc-mode.el.gz.
Signature
(c-electric-pair-inhibit-predicate CHAR)
Documentation
Return t to inhibit the insertion of a second copy of CHAR.
At the time of call, point is just after the newly inserted CHAR.
When CHAR is " and not within a comment, t will be returned if the quotes on the current line are already balanced. For other cases, the default value of `electric-pair-inhibit-predicate' is called and its value returned.
This function is the appropriate value of
`electric-pair-inhibit-predicate' for CC Mode modes, which mark
invalid strings with such a syntax table text property on the
opening " and the next unescaped end of line.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-mode.el.gz
;; Connection with Emacs's electric-pair-mode
(defun c-electric-pair-inhibit-predicate (char)
"Return t to inhibit the insertion of a second copy of CHAR.
At the time of call, point is just after the newly inserted CHAR.
When CHAR is \" and not within a comment, t will be returned if
the quotes on the current line are already balanced. For other
cases, the default value of `electric-pair-inhibit-predicate' is
called and its value returned.
This function is the appropriate value of
`electric-pair-inhibit-predicate' for CC Mode modes, which mark
invalid strings with such a syntax table text property on the
opening \" and the next unescaped end of line."
(if (and (eq char ?\")
(not (memq (cadr (c-semi-pp-to-literal (1- (point)))) '(c c++))))
(not c-open-string-opener)
(funcall (default-value 'electric-pair-inhibit-predicate) char)))