Browse files

* Added code in place to work around issue 32.

git-svn-id: https://autopair.googlecode.com/svn/trunk@42 56c4f94e-c24a-11de-a250-c7f789e21d83
  • Loading branch information...
1 parent 5410708 commit 3a5fdd74df5f8691e265bd2761f58b31dee12933 joaotavora committed May 8, 2011
Showing with 11 additions and 2 deletions.
  1. +11 −2 autopair.el
View
13 autopair.el
@@ -195,7 +195,12 @@ criterious when skipping.")
syntax table.")
(defvar autopair-dont-activate nil
- "If non-nil `autopair-global-mode' does not activate in buffer")
+ "Control activation of `autopair-global-mode'.
+
+Set this to a non-nil value to skip activation of `autopair-mode'
+in certain contexts. If however the value satisfies `functionp'
+and is a function of no arguments, the function is called and it is
+the return value that decides.")
(make-variable-buffer-local 'autopair-dont-activate)
(defvar autopair-extra-pairs nil
@@ -321,7 +326,11 @@ For now, simply returns `last-command-event'"
;;
(define-globalized-minor-mode autopair-global-mode autopair-mode autopair-on)
-(defun autopair-on () (unless (or buffer-read-only autopair-dont-activate) (autopair-mode 1)))
+(defun autopair-on () (unless (or buffer-read-only
+ (if (functionp autopair-dont-activate)
+ (funcall autopair-dont-activate)
+ autopair-dont-activate))
+ (autopair-mode 1)))
(define-minor-mode autopair-mode
"Automagically pair braces and quotes like in TextMate."

0 comments on commit 3a5fdd7

Please sign in to comment.