bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#24315: 25.1.50; re-search-forward errors with "Variable binding dept


From: npostavs
Subject: bug#24315: 25.1.50; re-search-forward errors with "Variable binding depth exceeds max-specpdl-size"
Date: Thu, 01 Sep 2016 21:58:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

pok@netfonds.no (Peder O. Klingenberg) writes:

> `icalendar--get-unfolded-buffer' takes care of all those pesky line
> continuations, and returns a buffer with each element occupying exactly
> one line.  So essentially `icalendar--read-event' was using a regexp to
> extract the rest of the line, and that failed with a line nearly 40k
> characters long.
>
> The only other in-tree caller of `icalendar--read-event' (excluding
> itself) also calls `icalendar--get-unfolded-buffer' first, and indeed,
> `icalendar-read-event' already relies on this to take care of line
> continuations in element parameters (as opposed to values).
>
> Attached is a patch that uses buffer-substring to accomplish the same
> thing as the offending regexp, and documents the dependency on
> `icalendar--get-unfolded-buffer'.  This fixes the problem for me.

If it works without the regexp, that's even better.

> -it finds."
> +it finds. The current buffer should be an unfolded buffer as returned
            ^
Sentences should be double spaced.

> +from `icalendar--get-unfolded-buffer'."
>    (let (element children line name params param param-name param-value
>                  value
>                  (continue t))
> @@ -391,8 +392,8 @@ icalendar--read-element
>        (unless (looking-at ":")
>          (error "Oops"))
>        (forward-char 1)
> -      (re-search-forward  "\\(.*\\)\\(\r?\n[ \t].*\\)*" nil t)
> -      (setq value (icalendar--rris "\r?\n[ \t]" "" (match-string 0)))
> +      (setq value (buffer-substring (point) (line-end-position)))
> +      (end-of-line)

Might be better to avoid finding the end of line twice (since apparently
40k lines do happen, I guess it's worth thinking a bit about
optimizing):

(let ((start (prog1 (point) (end-of-line))))
  (setq value (buffer-substring start (point))))





reply via email to

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