emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: Feature suggestion: split-line]


From: Ehud Karni
Subject: Re: address@hidden: Feature suggestion: split-line]
Date: Fri, 3 Jan 2003 01:33:27 +0200

On Thu, 02 Jan 2003 13:38:26 -0500, Richard Stallman <address@hidden> wrote:
> 
>       > The quick 
>       >           brown fox
> instead of
>       > The quick 
>                   brown fox

Since `delete-indentation' (aka join-line) is deleting `fill-prefix',
it is reasonable that `split-line' should add it. `delete-indentation'
checks for the `fill-prefix' existence. I think `split-line' should
check it too, i.e. Add IT ONLY IF the current line HAS IT.

So here is my suggestion for `split-line':

(defun split-line ()
  "Split current line, moving portion beyond point vertically down.
If fill-prefix is set and the current line has it, put it on the new line"
  (interactive "*")
  (skip-chars-forward " \t")
  (let ((col (current-column))
        (pos (point))
        (prfx (and fill-prefix
                   (string= fill-prefix
                            (buffer-substring (line-beginning-position)
                                              (+ (line-beginning-position)
                                                 (length fill-prefix)))))))
    (newline 1)
    (if prfx (insert-and-inherit fill-prefix))
    (indent-to col 0)
    (goto-char pos)))


BTW. I would have changed the behavior of `open-line' to the same
     logic, i.e. - Add fill-prefix if the current line has it (instead
     of its current behavior - adding it only when you are at bolp).


Ehud.


-- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:address@hidden                  Better  Safe  Than  Sorry



reply via email to

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