diff options
author | Taylor R Campbell <campbell@mumble.net> | 2011-03-20 18:34:22 +0000 |
---|---|---|
committer | Taylor R Campbell <campbell@mumble.net> | 2011-03-20 18:34:22 +0000 |
commit | 00110906360df491b3dc925ba11f156a98ee59d7 (patch) | |
tree | 6155ed928b3071d1f489752c90cefecdc862f5b5 | |
parent | 2b094afae39ff239eef85134fd7b67dc8ae4710f (diff) |
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
-rw-r--r-- | paredit.el | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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 |