diff options
author | Taylor R Campbell <campbell@mumble.net> | 2011-03-22 07:49:06 +0000 |
---|---|---|
committer | Taylor R Campbell <campbell@mumble.net> | 2011-03-22 07:49:06 +0000 |
commit | a79aa2c61e8127ff3f2c0c63a772b6d3b12cf785 (patch) | |
tree | b3e759e3f521826e2e5fc6a6c5b68a8c176816de | |
parent | f5e7959cddf6cdf29cfbfc499eec57903b9a07e5 (diff) |
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
-rw-r--r-- | paredit.el | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |