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

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

tcl mode: endless loop in tcl-do-fill-paragraph


From: Ralf Fassel
Subject: tcl mode: endless loop in tcl-do-fill-paragraph
Date: Thu, 11 Apr 2002 21:06:46 +0200 (MDT)

In GNU Emacs 21.2.1 (mips-sgi-irix6.5, X toolkit)
 of 2002-04-05 on merkur
configured using `configure  --prefix=/software/emacs/21.2 
-exec-prefix=/software/emacs/21.2/IRIX-6 --with-pop --with-x-toolkit=athena'
Important settings:
  value of $LC_ALL: C
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: nil

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

In TCL mode, calling `fill-paragraph' in the first line of the buffer
runs into endless loop when the first line is a comment.

Reproduce:

% emacs -q -no-site-file   # start fresh emacs
C-x C-f /tmp/foo.tcl       # should be in TCL mode now
# foobar                   # insert in buffer, keep cursor at end of
                           # first line in buffer
M-x fill-paragraph RET     # endless loop


Analysis:
`tcl-mode' binds `fill-paragraph-function' to `tcl-do-fill-paragraph',
this function tries to move before the current comment, which fails if
the comment is the first line in the buffer (or a narrowed region, FWIW).

share/emacs/21.2/lisp/progmodes/tcl.el, #1543 ff

           ;; Search backwards.
           (save-excursion
!            (while (looking-at "^[ \t]*#")
!              (forward-line -1))
             (forward-line)
             (setq p-start (point)))

The lines marked `!' are the endless loop.

The return-value of `forward-line' should be taken into account, if
non-zero the loop should stop.

R'



reply via email to

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