Skip to content

Instantly share code, notes, and snippets.

@cabo
Created April 10, 2013 18:34
Show Gist options
  • Save cabo/5357238 to your computer and use it in GitHub Desktop.
Save cabo/5357238 to your computer and use it in GitHub Desktop.
electric-pair-better-inhibit: Use this as electric-pair-inhibit-predicate if you want parentheses to come in pairs. (Works from Emacs 24 bzr-version ~ 112221 upwards.)
(defun electric-pair-better-inhibit (char)
(or
(eq char (char-after))
(and
(eq char (char-before (1- (point))))
(let* ((syntax (electric-pair-syntax char)))
(not (eq syntax ?\())))
(eq (char-syntax (following-char)) ?w)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment