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

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

Re: reindent-then-newline-and-indent doesn't indent properly in emacs 22


From: nuxdoors
Subject: Re: reindent-then-newline-and-indent doesn't indent properly in emacs 22.1
Date: Fri, 19 Oct 2007 03:07:17 +0200
User-agent: Icedove 1.5.0.12 (X11/20070607)

Here is a concrete example to illustrate my previous remark with respect
to the need of removing spaces around point when calling
delete-horizontal-space.

Tested with GNU Emacs 23.0.50.1 (with the new
reindent-then-newline-and-indent)

Let's create indentation_test.txt like this :

cat > indentation_test.txt <<EOF
    First line.
    Second line.
1234 -- columns
EOF

emacs was called like this :
emacs -Q -nw indentation_test.txt

"_" represents a space, "|" represents cursor position.
Place the cursor on the fourth column ( on the space preceding "S" ),
like this :

____First line.
___|Second line.
1234 -- columns

Then do a reindent-then-newline-and-indent, you will get this :

____First line.
_
____|Second line.
1234 -- columns

With the previous version of reindent-then-newline-and-indent you would
get this :

____First line.

____|Second line.
1234 -- columns

The patch to restore previous behavior that works for me :

*** lisp/simple.el.orig Thu Oct 18 06:52:06 2007
--- lisp/simple.el      Fri Oct 19 02:41:22 2007
***************
*** 636,642 ****
        ;; Usually indent-according-to-mode should "preserve" point, but
it is
        ;; not guaranteed; e.g. indent-to-left-margin doesn't.
        (save-excursion (indent-according-to-mode))
!       (delete-horizontal-space t))
      (indent-according-to-mode)))

  (defun quoted-insert (arg)
--- 636,644 ----
        ;; Usually indent-according-to-mode should "preserve" point, but
it is
        ;; not guaranteed; e.g. indent-to-left-margin doesn't.
        (save-excursion (indent-according-to-mode))
!       ;; Delete forward too in case reindent-then-newline-and-indent
!       ;; was called while point was within the line indentation.
!       (delete-horizontal-space))
      (indent-according-to-mode)))

  (defun quoted-insert (arg)





reply via email to

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