summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2011-04-11 22:50:30 +0000
committerTaylor R Campbell <campbell@mumble.net>2011-04-11 22:50:30 +0000
commit951813a685cab22b8d20118fa2823ed7c6ed0cc4 (patch)
treee98b57c5aab0dd7eff6b32221bc6e7fa00f80003
parent2463273cabb1ac803ef6765fe2d2f9ec4902ce60 (diff)
Fix `paredit-move-past-close' within a character escape.
Ignore-this: ed55179d0138b72dbe408836bb9f9403 It should move past the close, not stay where it is. `paredit-move-past-close-and-newline' already did this; the two now share the common code. darcs-hash:20110411225030-00fcc-202b9f3f93aab76ddae1c8bb10f9f605fee949d4
-rw-r--r--paredit.el36
1 files changed, 19 insertions, 17 deletions
diff --git a/paredit.el b/paredit.el
index 860caed..b13ca92 100644
--- a/paredit.el
+++ b/paredit.el
@@ -676,30 +676,32 @@ Used by `paredit-yank-pop'; for internal paredit use only.")
'paredit-close-square-and-newline)
(defun paredit-move-past-close (close)
- (cond ((or (paredit-in-string-p)
- (paredit-in-comment-p))
- (insert close))
- ((not (paredit-in-char-p))
- (paredit-move-past-close-and-reindent close)
- (paredit-blink-paren-match nil))))
+ (paredit-move-past-close-and close
+ (lambda ()
+ (paredit-blink-paren-match nil))))
(defun paredit-move-past-close-and-newline (close)
+ (paredit-move-past-close-and close
+ (lambda ()
+ (let ((comment.point (paredit-find-comment-on-line)))
+ (newline)
+ (if comment.point
+ (save-excursion
+ (forward-line -1)
+ (end-of-line)
+ (indent-to (cdr comment.point))
+ (insert (car comment.point)))))
+ (lisp-indent-line)
+ (paredit-ignore-sexp-errors (indent-sexp))
+ (paredit-blink-paren-match t))))
+
+(defun paredit-move-past-close-and (close if-moved)
(if (or (paredit-in-string-p)
(paredit-in-comment-p))
(insert close)
(if (paredit-in-char-p) (forward-char))
(paredit-move-past-close-and-reindent close)
- (let ((comment.point (paredit-find-comment-on-line)))
- (newline)
- (if comment.point
- (save-excursion
- (forward-line -1)
- (end-of-line)
- (indent-to (cdr comment.point))
- (insert (car comment.point)))))
- (lisp-indent-line)
- (paredit-ignore-sexp-errors (indent-sexp))
- (paredit-blink-paren-match t)))
+ (funcall if-moved)))
(defun paredit-find-comment-on-line ()
"Find a margin comment on the current line.