summaryrefslogtreecommitdiff
path: root/paredit.el
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2011-03-20 18:34:22 +0000
committerTaylor R Campbell <campbell@mumble.net>2011-03-20 18:34:22 +0000
commit00110906360df491b3dc925ba11f156a98ee59d7 (patch)
tree6155ed928b3071d1f489752c90cefecdc862f5b5 /paredit.el
parent2b094afae39ff239eef85134fd7b67dc8ae4710f (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
Diffstat (limited to 'paredit.el')
-rw-r--r--paredit.el8
1 files 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