unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* kill-region
@ 2003-05-21 14:47 Luc Teirlinck
  2003-05-22 14:58 ` kill-region Kai Großjohann
  2003-05-23 12:03 ` kill-region Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Luc Teirlinck @ 2003-05-21 14:47 UTC (permalink / raw)


kill-region sets this-command to 'kill-region even if the last command
was not a kill command *and* kill-region did not make a new entry on
the kill-ring (which happens if kill-region is called on an empty
region).

This can lead to strange consequences.  Start out with some non-empty
kill ring.  Go to the end of some buffer containing at least two lines.
Do M-2 k.  Nothing got killed, since we are at the end of the buffer.
Now do M--2 k. (What we probably wanted to do, we just forgot the
"-".)  Now C-y.  The last two lines of the buffer got prepended to the
previous kill ring entry.  Does this make sense?  We could have
avoided the mess by doing a C-g after the erroneous M-2 k, but it
still seems very counter-intuitive.

Might it be better for kill-region to either not set this-command to
'kill-region if the last command was not already a kill command and
kill-region did not make a new entry on the kill ring, or,
alternatively, make kill-region add an empty string to the end of the
kill ring in the described situation, to which subsequent kill
commands could append or prepend?

Sincerely,

Luc.

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

* kill-region
@ 2003-05-21 15:31 Luc Teirlinck
  0 siblings, 0 replies; 5+ messages in thread
From: Luc Teirlinck @ 2003-05-21 15:31 UTC (permalink / raw)


Fom my previous message on the topic:

   Do M-2 k.  Nothing got killed, since we are at the end of the buffer.
   Now do M--2 k.

Meant was M-2 C-k and M--2 C-k.

   We could have avoided the mess by doing a C-g after the erroneous
   M-2 k,

M-2 C-k again.

   or, alternatively, make kill-region add an empty string to the end
   of the kill ring

Meant was, of course, the beginning of the kill ring.

Sorry for all these typos.

Sincerely,

Luc.

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

* Re: kill-region
  2003-05-21 14:47 kill-region Luc Teirlinck
@ 2003-05-22 14:58 ` Kai Großjohann
  2003-05-23 12:03 ` kill-region Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Kai Großjohann @ 2003-05-22 14:58 UTC (permalink / raw)


Luc Teirlinck <teirllm@dms.auburn.edu> writes:

> Might it be better for kill-region to either not set this-command to
> 'kill-region if the last command was not already a kill command and
> kill-region did not make a new entry on the kill ring, or,
> alternatively, make kill-region add an empty string to the end of the
> kill ring in the described situation, to which subsequent kill
> commands could append or prepend?

I guess it's better to avoid empty strings on the kill ring, if
possible.

I can't say what might be the consequences of frobbing this-command.
-- 
This line is not blank.

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

* Re: kill-region
  2003-05-21 14:47 kill-region Luc Teirlinck
  2003-05-22 14:58 ` kill-region Kai Großjohann
@ 2003-05-23 12:03 ` Richard Stallman
  2003-05-23 19:42   ` kill-region Kai Großjohann
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2003-05-23 12:03 UTC (permalink / raw)
  Cc: emacs-devel

    Might it be better for kill-region to either not set this-command to
    'kill-region if the last command was not already a kill command and
    kill-region did not make a new entry on the kill ring, or,
    alternatively, make kill-region add an empty string to the end of the
    kill ring in the described situation, to which subsequent kill
    commands could append or prepend?

I agree that we should do one or the other.  I think the former is
better, since I don't see much use in putting the empty region in the
kill ring.  As long as we can provide fairly consistent behavior
while not putting the empty region in the kill ring, let's do so.

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

* Re: kill-region
  2003-05-23 12:03 ` kill-region Richard Stallman
@ 2003-05-23 19:42   ` Kai Großjohann
  0 siblings, 0 replies; 5+ messages in thread
From: Kai Großjohann @ 2003-05-23 19:42 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

>     Might it be better for kill-region to either not set this-command to
>     'kill-region if the last command was not already a kill command and
>     kill-region did not make a new entry on the kill ring, or,
>     alternatively, make kill-region add an empty string to the end of the
>     kill ring in the described situation, to which subsequent kill
>     commands could append or prepend?
>
> I agree that we should do one or the other.  I think the former is
> better, since I don't see much use in putting the empty region in the
> kill ring.  As long as we can provide fairly consistent behavior
> while not putting the empty region in the kill ring, let's do so.

How about this?

--- simple.el.~1.604.~	Thu May 22 09:59:08 2003
+++ simple.el	Fri May 23 21:40:41 2003
@@ -1913,7 +1913,8 @@
 	  (if (eq last-command 'kill-region)
 	      (kill-append string (< end beg) yank-handler)
 	    (kill-new string nil yank-handler)))
-	(setq this-command 'kill-region))
+	(when (or string (eq last-command 'kill-region))
+	  (setq this-command 'kill-region)))
     ((buffer-read-only text-read-only)
      ;; The code above failed because the buffer, or some of the characters
      ;; in the region, are read-only.

-- 
This line is not blank.

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

end of thread, other threads:[~2003-05-23 19:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-21 14:47 kill-region Luc Teirlinck
2003-05-22 14:58 ` kill-region Kai Großjohann
2003-05-23 12:03 ` kill-region Richard Stallman
2003-05-23 19:42   ` kill-region Kai Großjohann
  -- strict thread matches above, loose matches on Subject: below --
2003-05-21 15:31 kill-region Luc Teirlinck

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