From owner-ntemacs-users@june  Mon Aug 19 02:00:10 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Mon" "19" "August" "1996" "10:11:39" "+0200" "Kim F. Storm" "storm@olicom.dk" nil "77" "Re: EMACS vs. Windows GUI: Region highlight confusion" "^From:" nil nil "8" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id CAA03037 for <voelker@june.cs.washington.edu>; Mon, 19 Aug 1996 02:00:10 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id CAA42428 for <voelker@joker.cs.washington.edu>; Mon, 19 Aug 1996 02:00:08 -0700
Received: from olicom.olicom.dk (eolicom.olicom.dk [194.255.19.1]) by june.cs.washington.edu (8.7.5/7.2ju) with ESMTP id BAA00533 for <ntemacs-users@cs.washington.edu>; Mon, 19 Aug 1996 01:17:15 -0700
Received: from kfs.olicom.dk (kfs.olicom.dk [172.16.99.27]) by olicom.olicom.dk (8.7.5/8.7.3/efh.2.13) with SMTP id KAA19814; Mon, 19 Aug 1996 10:11:39 +0200 (MET DST)
Message-Id: <199608190811.KAA19814@olicom.olicom.dk>
In-reply-to: <wohgq3o3wi.fsf@cheux.ecs.umass.edu> (message from Jack Vinson on 	16 Aug 1996 09:27:25 -0400)
From: "Kim F. Storm" <storm@olicom.dk>
To: ntemacs-users@cs.washington.edu
CC: rms@gnu.ai.mit.edu
Subject: Re: EMACS vs. Windows GUI: Region highlight confusion
Date: Mon, 19 Aug 1996 10:11:39 +0200 (MET DST)


   >>>>> "KFS" == Kim F Storm <storm@olicom.dk> writes:

   KFS> In windows, I think most applications behave as follows:

   KFS> 	When a piece of text is highlighted in a window (typically
   KFS> 	selected with the mouse) then pressing DELETE will delete the
   KFS> 	highlighted text, and entering other text will replace the
   KFS> 	highlighted text.


   From: Jack Vinson <jvinson@cheux.ecs.umass.edu>
   Date: 16 Aug 1996 09:27:25 -0400

   What happens to Unix users who are not familiar with Windows?  If you want
   to cut a region that you've marked with the mouse, you may as well continue
   using the mouse:  Mark a region and then double click the left mouse button
   (mouse 3).  Actually, just double clicking mouse 3 will kill the region
   between the point and the mouse cursor.

I don't see how adding the ability to delete the selected region using
DELETE can make such a difference to non-Windows (and non-DOS) users;
since the temporary highlighting of the mouse region is a fairly new
feature (19.31), there is really little previous experience to break...

   From: rjf@infograph.com
   Date: Fri, 16 Aug 1996 13:19:01 -0700

   ... (pc-selection-mode) ... gives me a CUA type selection
   mechanism. Shift arrows to select, then typing replaces, DEL
   deletes, etc.

Yes, there are packages (such as pc-select.el and delsel.el) which
will change the overall functionality of the region in emacs towards a
more DOS/Windows like manner; this may be good for those who would
like that.


   Date: Fri, 16 Aug 1996 12:14:34 -0700
   From: Kin Cho <kin@isi.com>

   KFS> I'm really not interested in having normal text replacing the
   KFS> temporarily highlighted region, so it is only the DELETE function I'm
   KFS> interested in.

   If emacs is going to imitate the Windows behavior, either it should
   do so completely or not at all.

Well, as rjf@infograph.com has pointed out, there are packages which
will make the region in emacs work more like ordinary DOS and Windows
editors (and other GUI applications) - for all editing.

But that is not my purpose here!

What I want is just to make the temporary mouse region highlight
(which was introducted in 19.31) *less confusing* to the casual
windows user - without making severe changes to the way emacs works as
such. 

Making DELETE delete the selected region doesn't seem to be a
change which will impact general emacs use in a negative way - while
making newly typed text replace the region definitely will.

And I would think some users would like the new functionality; hitting
DELETE to delete the just selected text may sometimes be easier than
having to double-click mouse-3 at the same location where you released
mouse-1.

   Date: Fri, 16 Aug 1996 13:31:17 -0400
   From: Richard Stallman <rms@gnu.ai.mit.edu>

   I guess it is ok to make this the default.

I still think it is.

--
Kim F. Storm <storm@olicom.dk>

From rms@gnu.ai.mit.edu  Sat Aug 17 00:23:21 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Sat" "17" "August" "1996" "03:23:11" "-0400" "Richard Stallman" "rms@gnu.ai.mit.edu" nil "98" "[storm@olicom.dk: EMACS vs. Windows GUI: Region highlight confusion]" "^From:" nil nil "8" nil nil nil nil]
	nil)
Status: RO
Received: from psilocin.gnu.ai.mit.edu (psilocin.gnu.ai.mit.edu [128.52.46.62]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id AAA28242 for <voelker@cs.washington.edu>; Sat, 17 Aug 1996 00:23:21 -0700
Received: by psilocin.gnu.ai.mit.edu (8.6.12/8.6.12GNU) id DAA21048; Sat, 17 Aug 1996 03:23:11 -0400
Message-Id: <199608170723.DAA21048@psilocin.gnu.ai.mit.edu>
From: Richard Stallman <rms@gnu.ai.mit.edu>
To: voelker@cs.washington.edu, andrewi@harlequin.co.uk
Subject: [storm@olicom.dk: EMACS vs. Windows GUI: Region highlight confusion]
Date: Sat, 17 Aug 1996 03:23:11 -0400

What do you think about this matter?

------- Start of forwarded message -------
Date: Fri, 16 Aug 1996 11:06:46 +0200 (MET DST)
From: "Kim F. Storm" <storm@olicom.dk>
To: ntusers@olicom.dk
CC: rms@gnu.ai.mit.edu
Subject: EMACS vs. Windows GUI: Region highlight confusion


In windows, I think most applications behave as follows:

	When a piece of text is highlighted in a window (typically
	selected with the mouse) then pressing DELETE will delete the
	highlighted text, and entering other text will replace the
	highlighted text.

Prior to emacs 19.31, there were normally no region highlighting
(unless you had transient-mark-mode turned on, and in that case you
could use the delsel.el package to more or less get the above
behaviour).

Since emacs 19.31, selecting a region with the mouse now leaves the
region highlighted (without setting transient-mark-mode) until the
next input event occurs (e.g. hitting a key).

Now, if I select a region with the mouse, and then hit DELETE, the
highlight disappears, but it is the character which FOLLOWS the region
that is deleted!  If one is not careful, then the removal of the
highlight may easily be mentally interpreted as a deletion of the text
as well - especially because this is normal behaviour for other
windows applications!

The delsel.el package does not handle this case since it requires the
transient-mark-mode to be active - and I do not like that!

Looking at the code, the temporarily highlighting of the region
selected by the mouse is done in the mouse-show-mark function; it
simply reads the next event itself, then removes the highlight and
pushes the event back on the "unread event" queue.

So the delete-char command bound to the DELETE key is actually
executed after the region highlight has been removed; so just writing
another handler for the DELETE key (delete-char-or-mouse-region)
doesn't seem to be possible (or at least hard to do)?!

I'm really not interested in having normal text replacing the
temporarily highlighted region, so it is only the DELETE function I'm
interested in.

When 19.31 was released, I suggested to RMS to handle DELETE as a
special case directly in mouse-show-mark (mouse-drag-region in 19.31),
but he didn't want to do that (I do admit, it was a rather ugly hack).

I have since made the feature configurable via a list of keys which
should delete the highlighted mouse region and adapted my code to
mouse.el from 19.33; the updated mouse-show-mark function is attached
below.

I would like to hear whether other nt-emacs users have any opinions on
this subject, and whether you would like this to be a standard emacs
feature.

- --
Kim F. Storm <storm@olicom.dk>

- ----- put this in mouse.el or in your .emacs ------

(defvar mouse-region-delete-keys '([delete] [backspace])
  "List of keys which shall cause the mouse region to be deleted.")

(defun mouse-show-mark ()
  (if transient-mark-mode
      (if window-system
	  (delete-overlay mouse-drag-overlay))
    (if window-system
	(let ((inhibit-quit t)
	      (echo-keystrokes 0)
	      event events key)
	  (move-overlay mouse-drag-overlay (point) (mark t))
	  (while (progn (setq event (read-event))
			(setq events (append events (list event)))
			(setq key (apply 'vector events))
			(and (memq 'down (event-modifiers event))
			     (not (key-binding key))
			     (not (member key mouse-region-delete-keys))
			     (not (mouse-undouble-last-event events)))))
	  (if (member key mouse-region-delete-keys)
	      (delete-region (overlay-start mouse-drag-overlay)
			     (overlay-end mouse-drag-overlay))
	    (setq unread-command-events
		  (nconc events unread-command-events)))
	  (setq quit-flag nil)
	  (delete-overlay mouse-drag-overlay))
      (save-excursion
       (goto-char (mark t))
       (sit-for 1)))))
------- End of forwarded message -------

From owner-ntemacs-users@june  Fri Aug 16 14:26:50 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Fri" "16" "August" "1996" "13:19:01" "-0700" "rjf@infograph.com" "rjf@infograph.com" nil "25" "Re: EMACS vs. Windows GUI: Region highlight confusion" "^From:" nil nil "8" nil nil nil nil]
	nil)
Status: RO
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id OAA12358 for <voelker@june.cs.washington.edu>; Fri, 16 Aug 1996 14:26:50 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id OAA43206 for <voelker@joker.cs.washington.edu>; Fri, 16 Aug 1996 14:26:49 -0700
Received: from globe.indirect.com (globe.indirect.com [165.247.1.4]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id NAA07504 for <ntemacs-users@cs.washington.edu>; Fri, 16 Aug 1996 13:40:36 -0700
Received: (from Uinfogrf@localhost) by globe.indirect.com (8.6.12/8.6.9) with UUCP id NAA17568; Fri, 16 Aug 1996 13:28:34 -0700
Received: from krusty.infograph.com by infograph.com (1.38.193.4/3.2.083191-Informative Graphics) 	id AA15957; Fri, 16 Aug 1996 13:19:01 -0700
Message-Id: <9608162019.AA15957@infograph.com>
In-Reply-To: <199608161914.MAA29942@sampras.isi.com>
References: <199608160922.LAA25619@olicom.olicom.dk> 	<199608161914.MAA29942@sampras.isi.com>
From: rjf@infograph.com
To: Kin Cho <kin@isi.com>
Cc: storm@olicom.dk, ntemacs-users@cs.washington.edu
Subject: Re: EMACS vs. Windows GUI: Region highlight confusion
Date: Fri, 16 Aug 1996 13:19:01 -0700

>>>>> "Kin" == Kin Cho <kin@isi.com> writes:

    >> I'm really not interested in having normal text replacing the
    >> temporarily highlighted region, so it is only the DELETE
    >> function I'm interested in.

    Kin> If emacs is going to imitate the Windows behavior, either it
    Kin> should do so completely or not at all.

    Kin> -kin

Placing:

(pc-selection-mode) 

in my .emacs gives me a CUA type selection mechanism. Shift arrows to
select, then typing replaces, DEL deletes, etc. There was another mode
someone pointed out that does this for any selection (i.e. mouse,
etc), but I don't remember what it was...

rjf

--
"...fame is a cancer and ego its seed...",Toad the Wet Sprocket
For pgp key, finger rjf@infograph.com

From owner-ntemacs-users@june  Fri Aug 16 07:12:26 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "" "16" "August" "1996" "09:27:25" "-0400" "Jack Vinson" "jvinson@cheux.ecs.umass.edu" nil "22" "Re: EMACS vs. Windows GUI: Region highlight confusion" "^From:" nil nil "8" nil nil nil nil]
	nil)
Status: RO
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id HAA26039 for <voelker@june.cs.washington.edu>; Fri, 16 Aug 1996 07:12:26 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id HAA41723 for <voelker@joker.cs.washington.edu>; Fri, 16 Aug 1996 07:12:25 -0700
Received: from cheux.ecs.umass.edu (cheux.ecs.umass.edu [128.119.82.11]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id GAA22701 for <ntemacs-users@cs.washington.edu>; Fri, 16 Aug 1996 06:30:05 -0700
Received: by cheux.ecs.umass.edu (5.65/DEC-Ultrix/4.3) 	id AA07715; Fri, 16 Aug 1996 09:27:27 -0400
References: <199608160922.LAA25619@olicom.olicom.dk>
In-Reply-To: "Kim F. Storm"'s message of Fri, 16 Aug 1996 11:22:30 +0200 (MET DST)
Message-Id: <wohgq3o3wi.fsf@cheux.ecs.umass.edu>
Lines: 22
X-Mailer: Red Gnus v0.11/Emacs 19.31
From: Jack Vinson <jvinson@cheux.ecs.umass.edu>
To: ntemacs-users@cs.washington.edu
Subject: Re: EMACS vs. Windows GUI: Region highlight confusion
Date: 16 Aug 1996 09:27:25 -0400

>>>>> "KFS" == Kim F Storm <storm@olicom.dk> writes:

KFS> In windows, I think most applications behave as follows:

KFS> 	When a piece of text is highlighted in a window (typically
KFS> 	selected with the mouse) then pressing DELETE will delete the
KFS> 	highlighted text, and entering other text will replace the
KFS> 	highlighted text.

[snip idea for making this work in emacs]

What happens to Unix users who are not familiar with Windows?  If you want
to cut a region that you've marked with the mouse, you may as well continue
using the mouse:  Mark a region and then double click the left mouse button
(mouse 3).  Actually, just double clicking mouse 3 will kill the region
between the point and the mouse cursor.


-- 
Jack Vinson                       jvinson@cheux.ecs.umass.edu
"I Spit on Your Grave"            -- double feature at the drive-in as seen
"I Thumb Through Your Magazines"     from the Qwik-E mart

From owner-ntemacs-users@june  Fri Aug 16 03:05:22 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Fri" "16" "August" "1996" "11:22:30" "+0200" "Kim F. Storm" "storm@olicom.dk" nil "89" "EMACS vs. Windows GUI: Region highlight confusion" "^From:" nil nil "8" nil nil nil nil]
	nil)
Status: RO
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.5/7.2ju) with SMTP id DAA10682 for <voelker@june.cs.washington.edu>; Fri, 16 Aug 1996 03:05:22 -0700
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id DAA37612 for <voelker@joker.cs.washington.edu>; Fri, 16 Aug 1996 03:05:21 -0700
Received: from olicom.olicom.dk (eolicom.olicom.dk [194.255.19.1]) by june.cs.washington.edu (8.7.5/7.2ju) with ESMTP id CAA07349 for <ntemacs-users@cs.washington.edu>; Fri, 16 Aug 1996 02:25:20 -0700
Received: from kfs.olicom.dk (kfs.olicom.dk [172.16.99.27]) by olicom.olicom.dk (8.7.5/8.7.3/efh.2.13) with SMTP id LAA25619; Fri, 16 Aug 1996 11:22:30 +0200 (MET DST)
Message-Id: <199608160922.LAA25619@olicom.olicom.dk>
From: "Kim F. Storm" <storm@olicom.dk>
To: ntemacs-users@cs.washington.edu
CC: rms@gnu.ai.mit.edu
Subject: EMACS vs. Windows GUI: Region highlight confusion
Date: Fri, 16 Aug 1996 11:22:30 +0200 (MET DST)


In windows, I think most applications behave as follows:

	When a piece of text is highlighted in a window (typically
	selected with the mouse) then pressing DELETE will delete the
	highlighted text, and entering other text will replace the
	highlighted text.

Prior to emacs 19.31, there were normally no region highlighting
(unless you had transient-mark-mode turned on, and in that case you
could use the delsel.el package to more or less get the above
behaviour).

Since emacs 19.31, selecting a region with the mouse now leaves the
region highlighted (without setting transient-mark-mode) until the
next input event occurs (e.g. hitting a key).

Now, if I select a region with the mouse, and then hit DELETE, the
highlight disappears, but it is the character which FOLLOWS the region
that is deleted!  If one is not careful, then the removal of the
highlight may easily be mentally interpreted as a deletion of the text
as well - especially because this is normal behaviour for other
windows applications!

The delsel.el package does not handle this case since it requires the
transient-mark-mode to be active - and I do not like that!

Looking at the code, the temporarily highlighting of the region
selected by the mouse is done in the mouse-show-mark function; it
simply reads the next event itself, then removes the highlight and
pushes the event back on the "unread event" queue.

So the delete-char command bound to the DELETE key is actually
executed after the region highlight has been removed; so just writing
another handler for the DELETE key (delete-char-or-mouse-region)
doesn't seem to be possible (or at least hard to do)?!

I'm really not interested in having normal text replacing the
temporarily highlighted region, so it is only the DELETE function I'm
interested in.

When 19.31 was released, I suggested to RMS to handle DELETE as a
special case directly in mouse-show-mark (mouse-drag-region in 19.31),
but he didn't want to do that (I do admit, it was a rather ugly hack).

I have since made the feature configurable via a list of keys which
should delete the highlighted mouse region and adapted my code to
mouse.el from 19.33; the updated mouse-show-mark function is attached
below.

I would like to hear whether other nt-emacs users have any opinions on
this subject, and whether you would like this to be a standard emacs
feature.

--
Kim F. Storm <storm@olicom.dk>

----- put this in mouse.el or in your .emacs ------

(defvar mouse-region-delete-keys '([delete] [backspace])
  "List of keys which shall cause the mouse region to be deleted.")

(defun mouse-show-mark ()
  (if transient-mark-mode
      (if window-system
	  (delete-overlay mouse-drag-overlay))
    (if window-system
	(let ((inhibit-quit t)
	      (echo-keystrokes 0)
	      event events key)
	  (move-overlay mouse-drag-overlay (point) (mark t))
	  (while (progn (setq event (read-event))
			(setq events (append events (list event)))
			(setq key (apply 'vector events))
			(and (memq 'down (event-modifiers event))
			     (not (key-binding key))
			     (not (member key mouse-region-delete-keys))
			     (not (mouse-undouble-last-event events)))))
	  (if (member key mouse-region-delete-keys)
	      (delete-region (overlay-start mouse-drag-overlay)
			     (overlay-end mouse-drag-overlay))
	    (setq unread-command-events
		  (nconc events unread-command-events)))
	  (setq quit-flag nil)
	  (delete-overlay mouse-drag-overlay))
      (save-excursion
       (goto-char (mark t))
       (sit-for 1)))))


