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

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

[nongnu] elpa/paredit 0011090 066/224: Fix bounds checking in `paredit-f


From: ELPA Syncer
Subject: [nongnu] elpa/paredit 0011090 066/224: Fix bounds checking in `paredit-find-next-string-start'.
Date: Sat, 7 Aug 2021 09:22:20 -0400 (EDT)

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

    Fix bounds checking in `paredit-find-next-string-start'.
    
    Ignore-this: 4bf62fadcc0f90e2c582311eff1355d8
    
    Check for the beginning/end of buffer to avoid infinite loops there.
    
    Order points right to fix (|"foo" ()) ==C-M-d==> ("foo" (|)).
    
    Thanks to Eitan Postavsky for the report.
    
    darcs-hash:20110320183422-00fcc-8fe38d45bdd4e4e94925d56f537fd079111514f6
---
 paredit.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/paredit.el b/paredit.el
index 22927bf..23acb5f 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1778,13 +1778,15 @@ With a prefix argument N, encompass all N S-expressions 
forward."
                   'paredit-up/down)))))
 
 (defun paredit-find-next-string-start (horizontal-direction limit)
-  (let ((next-char (if (< 0 horizontal-direction) 'char-after 'char-before))
-        (pastp (if (< 0 horizontal-direction) '< '>)))
+  (let ((buffer-limit-p (if (< 0 horizontal-direction) 'eobp 'bobp))
+        (next-char (if (< 0 horizontal-direction) 'char-after 'char-before))
+        (pastp (if (< 0 horizontal-direction) '> '<)))
     (paredit-handle-sexp-errors
         (save-excursion
           (catch 'exit
             (while t
-              (if (and limit (funcall pastp (point) limit))
+              (if (or (funcall buffer-limit-p)
+                      (and limit (funcall pastp (point) limit)))
                   (throw 'exit nil))
               (forward-sexp horizontal-direction)
               (save-excursion



reply via email to

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