Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

autopair-on: bugfix: better control when autopair enables (never on h…

…idden tempbuffers, unless minibuffer)

             bugfix: add explicit fix for sldb mode (stefan's instructions don't apply clealy)
  • Loading branch information...
commit 83ca176564980162374b1524d6129e6d45428090 1 parent ddb9a8a
@capitaomorte authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 autopair.el
View
21 autopair.el
@@ -48,10 +48,15 @@
;; (add-hook 'c-mode-common-hook #'(lambda () (autopair-mode)))
;;
;; Alternatively, do use `autopair-global-mode' and create
-;; *exceptions* using the `autopair-dont-activate' local variable,
+;; *exceptions* using the `autopair-dont-activate' local variable (for
+;; emacs < 24), or just using (autopair-mode -1) (for emacs >= 24)
;; like:
;;
-;; (add-hook 'c-mode-common-hook #'(lambda () (setq autopair-dont-activate t)))
+;; (add-hook 'c-mode-common-hook
+;; #'(lambda ()
+;; (setq autopair-dont-activate t)
+;; (autopair-mode -1)))
+;;
;;
;;; Use:
;;
@@ -326,10 +331,14 @@ 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
- (and (boundp 'autopair-dont-activate)
- autopair-dont-activate))
- (autopair-mode 1)))
+(defun autopair-on ()
+ (unless (or buffer-read-only
+ (and (not (minibufferp))
+ (string-match "^ \\*" (buffer-name)))
+ (eq major-mode 'sldb-mode)
+ (and (boundp 'autopair-dont-activate)
+ autopair-dont-activate))
+ (autopair-mode 1)))
(define-minor-mode autopair-mode
"Automagically pair braces and quotes like in TextMate."
Please sign in to comment.
Something went wrong with that request. Please try again.