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

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

Bug in `reindent-then-newline-and-indent'


From: David K?hling
Subject: Bug in `reindent-then-newline-and-indent'
Date: Thu, 22 Mar 2001 12:17:43 +0100 (CET)

While devoloping an autoindentation engine for Forth code, I stumbled into
a bug in `reindent-then-newline-and-indent'. One of many texts that cause
that bug is:

   foo IF
      foo IF
      THEN THEN
           
Where the cursor is positioned at the letter T of the second
THEN. `reindent-then-newline-and-indent' now makes the following mistake:
it deletes the space before the second THEN, resulting in "THENTHEN", and
then tries to indent that line, which of course leads to bad results.

I'm working with "GNU Emacs 20.7.2 (i386-debian-linux-gnu, X toolkit) of
Tue Jun 20 2000 on raven"

I had a look at `simple.el', and located the bug in the body of 
`reindent-then-newline-and-indent':

  (save-excursion
    ;; the `delete-region' will concatenate consecutive words, which will
    ;; cause bad indentation by `indent-according-to-mode'
    (delete-region (point) (progn (skip-chars-backward " \t") (point)))
    (indent-according-to-mode))
  (newline)
  (indent-according-to-mode))

Hope that helps, 

bye,
                                                            David Kuehling






reply via email to

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