Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bug#14381: 24.3; smie-auto-fill infinite loop

4 views
Skip to first unread message

Leo Liu

unread,
May 10, 2013, 9:06:15 AM5/10/13
to 14...@debbugs.gnu.org
1. emacs -q
2. open the attached bug.m file
3. move to the end of second line
4. M-: (smie-auto-fill)

Should enter an infinite loop.

Debugger entered--Lisp error: (quit)
syntax-ppss()
smie-indent-comment-inside()
run-hook-with-args-until-success(smie-indent-comment-inside)
smie-indent-calculate()
(let* ((newcol (smie-indent-calculate)) (newgain (- curcol newcol))) (when (> newgain gain) (setq gain newgain) (setq bsf (point))))
(while (<= (setq curcol (current-column)) fc) (let* ((newcol (smie-indent-calculate)) (newgain (- curcol newcol))) (when (> newgain gain) (setq gain newgain) (setq bsf (point)))) (smie-indent-forward-token))
(let ((bsf (point)) (gain 0) curcol) (while (<= (setq curcol (current-column)) fc) (let* ((newcol (smie-indent-calculate)) (newgain (- curcol newcol))) (when (> newgain gain) (setq gain newgain) (setq bsf (point)))) (smie-indent-forward-token)) (when (> gain 0) (goto-char bsf) (newline-and-indent)))
(save-excursion (beginning-of-line) (smie-indent-forward-token) (let ((bsf (point)) (gain 0) curcol) (while (<= (setq curcol (current-column)) fc) (let* ((newcol (smie-indent-calculate)) (newgain (- curcol newcol))) (when (> newgain gain) (setq gain newgain) (setq bsf (point)))) (smie-indent-forward-token)) (when (> gain 0) (goto-char bsf) (newline-and-indent))))
(cond ((not (or (nth 8 (save-excursion (syntax-ppss (line-beginning-position)))) (nth 8 (syntax-ppss)))) (save-excursion (beginning-of-line) (smie-indent-forward-token) (let ((bsf (point)) (gain 0) curcol) (while (<= (setq curcol (current-column)) fc) (let* ((newcol ...) (newgain ...)) (when (> newgain gain) (setq gain newgain) (setq bsf ...))) (smie-indent-forward-token)) (when (> gain 0) (goto-char bsf) (newline-and-indent))))) (t (do-auto-fill)))
(while (and fc (> (current-column) fc)) (cond ((not (or (nth 8 (save-excursion (syntax-ppss ...))) (nth 8 (syntax-ppss)))) (save-excursion (beginning-of-line) (smie-indent-forward-token) (let ((bsf (point)) (gain 0) curcol) (while (<= (setq curcol ...) fc) (let* (... ...) (when ... ... ...)) (smie-indent-forward-token)) (when (> gain 0) (goto-char bsf) (newline-and-indent))))) (t (do-auto-fill))))
(let ((fc (current-fill-column))) (while (and fc (> (current-column) fc)) (cond ((not (or (nth 8 (save-excursion ...)) (nth 8 (syntax-ppss)))) (save-excursion (beginning-of-line) (smie-indent-forward-token) (let ((bsf ...) (gain 0) curcol) (while (<= ... fc) (let* ... ...) (smie-indent-forward-token)) (when (> gain 0) (goto-char bsf) (newline-and-indent))))) (t (do-auto-fill)))))
smie-auto-fill()
eval((smie-auto-fill) nil)
eval-expression((smie-auto-fill) nil)
call-interactively(eval-expression nil nil)


bug.m

Leo Liu

unread,
May 11, 2013, 11:29:01 PM5/11/13
to 14...@debbugs.gnu.org
Hi Stefan,

On 2013-05-10 21:06 +0800, Leo Liu wrote:
> Should enter an infinite loop.

I would like to simplify and fix octave's fill-paragraph and auto-fill
feature. Could you help fix or direct me how to fix this bug and
bug#14303?

Thanks,
Leo



Stefan Monnier

unread,
May 13, 2013, 11:43:38 AM5/13/13
to Leo Liu, 14...@debbugs.gnu.org
>> Should enter an infinite loop.
> I would like to simplify and fix octave's fill-paragraph and auto-fill
> feature.

Very good idea (when I moved octave to SMIE, I wanted to do that as
well, but ended up leaving it for later).

> Could you help fix or direct me how to fix this bug and bug#14303?

I think to fix/simplify them well, you'll need to touch some of the
generic code. For bug#14303, the first ting to do is to read the code
of comment-search-backward.

If I were you, I'd start with octave-auto-fill, trying to replace it
with something that hooks elsewhere, such as in fill-nobreak-predicate
and in comment-line-break-function.

For octave-fill-paragraph, I'm not sure what should be done there, but
the functionality looks like it could be useful in many
programming modes. So maybe it should be moved to prog-mode.


Stefan



Leo Liu

unread,
May 17, 2013, 7:16:16 PM5/17/13
to Stefan Monnier, 14...@debbugs.gnu.org
On 2013-05-13 23:43 +0800, Stefan Monnier wrote:
> If I were you, I'd start with octave-auto-fill, trying to replace it
> with something that hooks elsewhere, such as in fill-nobreak-predicate
> and in comment-line-break-function.

Yes, this was exactly what I tried i.e. set comment-line-break-function
to a octave-specific function but found this hangs due to this bug. smie
sets normal-auto-fill-function to smie-auto-fill.

Leo



Stefan Monnier

unread,
May 23, 2013, 1:45:32 PM5/23/13
to Leo Liu, 14...@debbugs.gnu.org
> 4. M-: (smie-auto-fill)
> Should enter an infinite loop.

I believe it's fixed now.


Stefan "who has the impression you're not familiar with Edebug"



0 new messages