all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [arensb@ooblick.com: Feature suggestion: split-line]
@ 2003-01-02 18:38 Richard Stallman
  2003-01-02 23:33 ` Ehud Karni
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2003-01-02 18:38 UTC (permalink / raw)


What do other people think of this idea?

------- Start of forwarded message -------
Date: Tue, 31 Dec 2002 14:22:20 -0500
From: Andrew Arensburger <arensb@ooblick.com>
To: bug-gnu-emacs@gnu.org
Content-Disposition: inline
X-Message-Flag: Your mailbox is corrupt. Upgrade your mail software.
cc: Andrew &urger <arensb@ooblick.com>
Subject: Feature suggestion: split-line
Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org


- --bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

	Hi! I'd like to suggest a change to the split-line function,
defined in "simple.el" (I'm attaching a patch).
	Currently (as of Emacs 21.1), split-line simply inserts
whitespace when splitting a line. The change I'm proposing inserts the
value of fill-prefix, if it is non-nil, and then inserts whitespace.
That is, it gives you

	> The quick 
	>           brown fox
instead of
	> The quick 
	            brown fox

- -- 
Andrew Arensburger                      This message *does* represent the
arensb@ooblick.com                      views of ooblick.com
	      Quidquid latine dictum sit, altum viditur.



- --bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="simple.el.patch"

- --- simple.el-21.1	Tue Dec 31 14:16:42 2002
+++ simple.el	Tue Dec 31 14:16:49 2002
@@ -162,6 +162,7 @@
   (let ((col (current-column))
 	(pos (point)))
     (newline 1)
+    (if fill-prefix (insert-and-inherit fill-prefix))
     (indent-to col 0)
     (goto-char pos)))
 

- --bg08WKrSYDhXBjb5
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

- --bg08WKrSYDhXBjb5--
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [arensb@ooblick.com: Feature suggestion: split-line]
  2003-01-02 18:38 [arensb@ooblick.com: Feature suggestion: split-line] Richard Stallman
@ 2003-01-02 23:33 ` Ehud Karni
  2003-01-03  9:43   ` Kim F. Storm
  0 siblings, 1 reply; 3+ messages in thread
From: Ehud Karni @ 2003-01-02 23:33 UTC (permalink / raw)
  Cc: emacs-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [arensb@ooblick.com: Feature suggestion: split-line]
  2003-01-02 23:33 ` Ehud Karni
@ 2003-01-03  9:43   ` Kim F. Storm
  0 siblings, 0 replies; 3+ messages in thread
From: Kim F. Storm @ 2003-01-03  9:43 UTC (permalink / raw)
  Cc: emacs-devel

"Ehud Karni" <ehud@unix.mvs.co.il> writes:

> 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.

I like that!

In message buffers, I'd rather like it to insert message-yank-prefix
with the same semantics!  But I guess a message-split-line would be
better for that; and [remap split-line] to it in the message-mode-map.


Something like this:

(defun message-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 message-yank-prefix
                   (string= message-yank-prefix
                            (buffer-substring (line-beginning-position)
                                              (+ (line-beginning-position)
                                                 (length message-yank-prefix)))))))
    (newline 1)
    (if prfx (insert-and-inherit message-yank-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).

I'd second that too.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-03  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-02 18:38 [arensb@ooblick.com: Feature suggestion: split-line] Richard Stallman
2003-01-02 23:33 ` Ehud Karni
2003-01-03  9:43   ` Kim F. Storm

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.