unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ehud Karni" <ehud@unix.mvs.co.il>
Cc: emacs-devel@gnu.org
Subject: Re: [arensb@ooblick.com: Feature suggestion: split-line]
Date: Fri, 3 Jan 2003 01:33:27 +0200	[thread overview]
Message-ID: <200301022333.h02NXR0v001405@beta.mvs.co.il> (raw)
In-Reply-To: <E18UAEc-00043S-00@fencepost.gnu.org> (message from Richard Stallman on Thu, 02 Jan 2003 13:38:26 -0500)

On Thu, 02 Jan 2003 13:38:26 -0500, Richard Stallman <rms@gnu.org> 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:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry

  reply	other threads:[~2003-01-02 23:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-02 18:38 [arensb@ooblick.com: Feature suggestion: split-line] Richard Stallman
2003-01-02 23:33 ` Ehud Karni [this message]
2003-01-03  9:43   ` Kim F. Storm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301022333.h02NXR0v001405@beta.mvs.co.il \
    --to=ehud@unix.mvs.co.il \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).