Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #13 from ptpt/master

Make sure `define-minor-mode` comes before `define-globalized-minor-mode`
  • Loading branch information...
commit d2346ce7f6e365e4aef024e33a8672e5f1b546dc 2 parents 274a54a + 8595ed2
João Távora authored
Showing with 20 additions and 20 deletions.
  1. +20 −20 autopair.el
40 autopair.el
View
@@ -332,6 +332,26 @@ For now, simply returns `last-command-event'"
;; minor mode and global mode
;;
;;;###autoload
+(define-minor-mode autopair-mode
+ "Automagically pair braces and quotes like in TextMate."
+ nil " pair" nil
+ (cond (autopair-mode
+ ;; Setup the dynamic emulation keymap, i.e. sets `autopair-emulation-alist'
+ ;;
+ (autopair-set-emulation-bindings)
+ (add-to-list 'emulation-mode-map-alists 'autopair-emulation-alist 'append)
+ ;; Init important vars
+ ;;
+ (setq autopair-action nil)
+ (setq autopair-wrap-action nil)
+ ;; Add the post command handler
+ ;;
+ (add-hook 'post-command-hook 'autopair-post-command-handler nil 'local))
+ (t
+ (set (make-local-variable 'autopair-emulation-alist) nil)
+ (remove-hook 'post-command-hook 'autopair-post-command-handler 'local))))
+
+;;;###autoload
(define-globalized-minor-mode autopair-global-mode autopair-mode autopair-on)
(when (eval-when-compile (>= emacs-major-version 24))
@@ -370,26 +390,6 @@ We want this advice to only kick in the *second* call to
autopair-dont-activate)
(autopair-mode 1))))
-;;;###autoload
-(define-minor-mode autopair-mode
- "Automagically pair braces and quotes like in TextMate."
- nil " pair" nil
- (cond (autopair-mode
- ;; Setup the dynamic emulation keymap, i.e. sets `autopair-emulation-alist'
- ;;
- (autopair-set-emulation-bindings)
- (add-to-list 'emulation-mode-map-alists 'autopair-emulation-alist 'append)
- ;; Init important vars
- ;;
- (setq autopair-action nil)
- (setq autopair-wrap-action nil)
- ;; Add the post command handler
- ;;
- (add-hook 'post-command-hook 'autopair-post-command-handler nil 'local))
- (t
- (set (make-local-variable 'autopair-emulation-alist) nil)
- (remove-hook 'post-command-hook 'autopair-post-command-handler 'local))))
-
(defun autopair-set-emulation-bindings ()
"Setup keymap MAP with keybindings based on the major-mode's
syntax table and the local value of `autopair-extra-pairs'."
Please sign in to comment.
Something went wrong with that request. Please try again.