Skip to content
This repository has been archived by the owner on Apr 11, 2021. It is now read-only.

Commit

Permalink
cleaup: whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
joaotavora committed Jul 3, 2012
1 parent 3badbda commit cad8e58
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions autopair.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
;;
;; Another stab at making braces and quotes pair like in
;; TextMate:
;;
;;
;; * Opening braces/quotes are autopaired;
;; * Closing braces/quotes are autoskipped;
;; * Backspacing an opening brace/quote autodeletes its adjacent pair.
Expand Down Expand Up @@ -97,7 +97,7 @@
;; wrap the selection region with the delimiters you're trying to
;; insert. This is done conditionally based of syntaxes of the two
;; ends of the selection region. It is compatible with `cua-mode's
;; typing-deletes-selection behaviour.
;; typing-deletes-selection behaviour.
;;
;; If you find the paren-blinking annoying, turn `autopair-blink' to
;; nil.
Expand Down Expand Up @@ -217,7 +217,7 @@ It's a Common-lisp-style even-numbered property list, each pair
of elements being of the form (TYPE , PAIRS). PAIRS is a mixed
list whose elements are cons cells, which look like cells look
like (OPENING . CLOSING). Autopair pairs these like
parenthesis.
parenthesis.
TYPE can be one of:
Expand Down Expand Up @@ -307,7 +307,7 @@ list, or call it from your handlers.")
(defvar autopair-handle-wrap-action-fns '()
"Autopair wrap handlers to run *instead* of the default handler.
Each element is a function taking four arguments (ACTION, PAIR,
Each element is a function taking four arguments (ACTION, PAIR,
POS-BEFORE and REGION-BEFORE), which are the three elements of the
`autopair-wrap-action' variable, which see.
Expand Down Expand Up @@ -531,7 +531,7 @@ A list of four elements is returned:
(beyond-autopair (autopair-original-binding fallback-keys)))
(when autopair-autowrap
(setq autopair-wrap-action (autopair-calculate-wrap-action)))

(setq this-original-command beyond-cua)
;; defer to "paredit-mode" if that is installed and running
(when (and (featurep 'paredit)
Expand Down Expand Up @@ -618,7 +618,7 @@ returned) and uplisting stops there."
(error nil)))

;; interactive commands and their associated predicates
;;
;;
(defun autopair-insert-or-skip-quote ()
(interactive)
(setq autopair-inserted (autopair-calculate-inserted))
Expand All @@ -631,7 +631,7 @@ returned) and uplisting stops there."
(inside-string (and (eq where-sym :string)
(fourth orig-info)))
(escaped-p (autopair-escaped-p syntax-info))

)
(cond (;; decides whether to skip the quote...
;;
Expand Down Expand Up @@ -688,7 +688,7 @@ returned) and uplisting stops there."

(defun autopair-in-unterminated-string-p (autopair-triplet)
(and (eq autopair-inserted (fourth (third autopair-triplet)))
(condition-case nil (progn (scan-sexps (ninth (third autopair-triplet)) 1) nil) (error t))))
(condition-case nil (progn (scan-sexps (ninth (third autopair-triplet)) 1) nil) (error t))))


(defun autopair-insert-opening ()
Expand Down Expand Up @@ -793,12 +793,12 @@ by this command. Then place point after the first, indented.\n\n"
;; `autopair-forward') returned an error.
;; typically we don't want to autopair,
;; unless one of the following occurs:
;;
;;
(cond (;; 1. The error is *not* of type "containing
;; expression ends prematurely", which means
;; we're in the "too-many-openings" situation
;; and thus want to autopair.
(not (string-match "prematurely" (second err)))
(not (string-match "prematurely" (second err)))
t)
(;; 2. We stopped at a closing parenthesis. Do
;; autopair if we're in a mixed parens situation,
Expand All @@ -809,14 +809,14 @@ by this command. Then place point after the first, indented.\n\n"
;; also different from the expected. The second
;; `scan-lists' places point at the closing of the
;; last list we forwarded over.
;;
;;
(condition-case err
(prog1
(eq (char-after (scan-lists (point) -1 0))
autopair-inserted)
(goto-char (scan-lists (point) -1 -1)))
(error t))

(or
;; mixed () ] for input (, yes autopair
(not (eq expected-closing (char-after (third err))))
Expand All @@ -841,7 +841,7 @@ by this command. Then place point after the first, indented.\n\n"
`autopair-wrap-action'. "
(when (and autopair-wrap-action
(notany #'null autopair-wrap-action))

(if autopair-handle-wrap-action-fns
(condition-case err
(mapc #'(lambda (fn)
Expand All @@ -852,7 +852,7 @@ by this command. Then place point after the first, indented.\n\n"
(autopair-mode -1))))
(apply #'autopair-default-handle-wrap-action autopair-wrap-action))
(setq autopair-wrap-action nil))

(when (and autopair-action
(notany #'null autopair-action))
(if autopair-handle-action-fns
Expand Down Expand Up @@ -987,7 +987,7 @@ by this command. Then place point after the first, indented.\n\n"
(t
t)))

;; example latex paired-delimiter helper
;; example latex paired-delimiter helper
;;
(defun autopair-latex-mode-paired-delimiter-action (action pair pos-before)
"Pair or skip latex's \"paired delimiter\" syntax in math mode. Added AucText support, thanks Massimo Lauria"
Expand All @@ -1013,7 +1013,7 @@ by this command. Then place point after the first, indented.\n\n"
(insert pair)
(backward-char)))))

;; Commands and predicates for the autopair-extra* feature
;; Commands and predicates for the autopair-extra* feature
;;

(defun autopair-extra-insert-opening ()
Expand Down Expand Up @@ -1064,7 +1064,7 @@ by this command. Then place point after the first, indented.\n\n"

;; Commands and tex-mode specific handler functions for the "paired
;; delimiter" syntax class.
;;
;;
(defun autopair-insert-or-skip-paired-delimiter ()
" insert or skip a character paired delimiter"
(interactive)
Expand Down Expand Up @@ -1107,10 +1107,11 @@ by this command. Then place point after the first, indented.\n\n"
(unless (autopair-should-autowrap) ad-do-it))

(defadvice delete-selection-pre-hook (around autopair-override activate)
"Don't actually do anything if autopair is about to autowrap. "
"Don't actually do anything if autopair is about to autowrap. "
(unless (autopair-should-autowrap) ad-do-it))



;; hihi
;;
(eval-when '(eval)
Expand Down

0 comments on commit cad8e58

Please sign in to comment.