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 ", t will be returned unless the " is marked with a string fence syntax-table text property. For other characters, 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 \", t will be returned unless the \" is marked with
a string fence syntax-table text property.  For other characters,
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 (eq char ?\")
      (not (equal (get-text-property (1- (point)) 'c-fl-syn-tab) '(15)))
    (funcall (default-value 'electric-pair-inhibit-predicate) char)))