branch: elpa/paredit
commit a79aa2c61e8127ff3f2c0c63a772b6d3b12cf785
Author: Taylor R Campbell <[email protected]>
Commit: Taylor R Campbell <[email protected]>
Fix end-of-line and end-of-buffer corner cases of `paredit-semicolon'.
Ignore-this: 799e1e911ebd252aec4ce53d85935236
Don't break the line if the point is at the end of the line already,
or if the point is on the last line of the buffer and there is no
trailing line break.
darcs-hash:20110322074906-00fcc-768c7e264b5142c25909573edaf157b79a44ccbb
---
paredit.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/paredit.el b/paredit.el
index f11fc7b..a887ddc 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1045,7 +1045,8 @@ If a list begins on the line after the point but ends on
a different
(defun paredit-semicolon-find-line-break-point ()
(let ((line-break-point nil)
(eol (point-at-eol)))
- (and (save-excursion
+ (and (not (eolp)) ;Implies (not (eobp)).
+ (save-excursion
(paredit-handle-sexp-errors
(progn
(while
@@ -1055,7 +1056,10 @@ If a list begins on the line after the point but ends on
a different
(and (eq eol (point-at-eol))
(not (eobp)))))
(backward-sexp)
- (eq eol (point-at-eol)))
+ (and (eq eol (point-at-eol))
+ ;; Don't break the line if the end of the last
+ ;; S-expression is at the end of the buffer.
+ (progn (forward-sexp) (not (eobp)))))
;; If we hit the end of an expression, but the closing
;; delimiter is on another line, don't break the line.
(save-excursion