emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/paredit a79aa2c 082/224: Fix end-of-line and end-of-buffer


From: ELPA Syncer
Subject: [nongnu] elpa/paredit a79aa2c 082/224: Fix end-of-line and end-of-buffer corner cases of `paredit-semicolon'.
Date: Sat, 7 Aug 2021 09:22:23 -0400 (EDT)

branch: elpa/paredit
commit a79aa2c61e8127ff3f2c0c63a772b6d3b12cf785
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>

    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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]