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: martin rudalics
Subject: Re: reindent-then-newline-and-indent doesn't indent properly in emacs 22.1
Date: Sun, 14 Oct 2007 20:26:54 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> Here is the patch alone, hopefully without thunderbird mangling it.

With Thunderbird better send patches as attachments.

>
> --- lisp/simple.el.orig 2007-05-27 16:35:51.000000000 +0200
> +++ lisp/simple.el      2007-10-14 15:21:13.000000000 +0200
> @@ -618,7 +618,8 @@
>    (indent-according-to-mode))
>
>  (defun reindent-then-newline-and-indent ()
> -  "Reindent current line, insert newline, then indent the new line.
> +  "Reindent current line, insert newline deleting trailing spaces or tabs,
> +then indent the new line.

Note that the first sentence of a doc-string should fit on one line.

>  Indentation of both lines is done according to the current major mode,
>  which means calling the current value of `indent-line-function'.
>  In programming language modes, this is the same as TAB.
> @@ -631,8 +632,12 @@
>      (newline)
>      (save-excursion
>        (goto-char pos)
> -      (indent-according-to-mode)
> -      (delete-horizontal-space t))
> +      ;; Beware of indentation functions moving point.
> +      (save-excursion
> +       (indent-according-to-mode))
> +      ;; Delete all trailing spaces or tabs introduced by the newline command
> +      ;; or the new indentation. 0 is for no space.
> +      (just-one-space 0))

Why is this better than `delete-horizontal-space'?

>      (indent-according-to-mode)))
>
>  (defun quoted-insert (arg)

In any case you might have to convince other people first that your
solution is preferable to using, for example,

  (save-excursion (indent-line-to (current-left-margin))))

as `indent-line-function'.





reply via email to

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