From xemacs-m  Sat Mar  1 18:45:03 1997
Received: from crystal.WonderWorks.COM (crystal.WonderWorks.com [192.203.206.1])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id SAA22666
	for <xemacs-beta@xemacs.org>; Sat, 1 Mar 1997 18:45:00 -0600 (CST)
Received: by crystal.WonderWorks.COM 
	id QQcfbc20498; Sat, 1 Mar 1997 19:08:00 -0500 (EST)
Date: Sat, 1 Mar 1997 19:08:00 -0500 (EST)
Message-Id: <QQcfbc20498.199703020008@crystal.WonderWorks.COM>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Kyle Jones <kyle_jones@wonderworks.com>
To: xemacs-beta@xemacs.org
Subject: [PATCH] 20.1-b3: mouse track highlighting without zmacs-regions
X-Face: /cA45WHG7jWq>(O3&Z57Y<"WsX5ddc,4c#w0F*zrV#=M
        0@~@,s;b,aMtR5Sqs"+nU.z^CSFQ9t`z2>W,S,]:[+2^
        Nbf6v4g>!&,7R4Ot4Wg{&tm=WX7P["9%a)_da48-^tGy
        ,qz]Z,Zz\{E.,]'EO+F)@$KtF&V

I don't use zmacs-regions.  But I like having the most recent
mouse slection stay lit up for a while so that I know I got the
selection endpoints right.  This is particularly useful for
seeing the results of extending a selection with Shift-button1,
or using multiple clicks to do a selection.

The patch below changes the mouse-track code to keep the
non-zmacs-regions mouse drag extents alive until you run another
command.  It also changes the face associated with these extents
from 'zmacs-regions to 'primary-selection after the drag to show
that zmacs-regions is not enabled.  The right thing to do might
be to use the 'primary-selection face at all times when
zmacs-regions is nil, but I'm not sure about that.

I am sure that I like this behavior better than the default.

===================================================================
RCS file: lisp/prim/mouse.el,v
retrieving revision 1.1
diff -c -r1.1 lisp/prim/mouse.el
*** 1.1	1997/03/01 21:50:45
--- lisp/prim/mouse.el	1997/03/01 23:16:04
***************
*** 1036,1047 ****
    (setq default-mouse-track-down-event (copy-event event))
    nil)
  
! (defun default-mouse-track-cleanup-hook ()
    (let ((extent default-mouse-track-extent))
      (if (consp extent) ; rectangle-p
  	(mapcar 'delete-extent extent)
        (if extent
  	  (delete-extent extent)))))
  
  (defun default-mouse-track-cleanup-extent ()
    (let ((dead-func
--- 1036,1059 ----
    (setq default-mouse-track-down-event (copy-event event))
    nil)
  
! (defun default-mouse-track-cleanup-extents-hook ()
!   (remove-hook 'pre-command-hook 'default-mouse-track-cleanup-extents-hook)
    (let ((extent default-mouse-track-extent))
      (if (consp extent) ; rectangle-p
  	(mapcar 'delete-extent extent)
        (if extent
  	  (delete-extent extent)))))
+ 
+ (defun default-mouse-track-cleanup-hook ()
+   (if zmacs-regions
+       (funcall 'default-mouse-track-cleanup-extents-hook)
+     (let ((extent default-mouse-track-extent)
+ 	  (func #'(lambda (e) (set-extent-face e 'primary-selection))))
+       (add-hook 'pre-command-hook 'default-mouse-track-cleanup-extents-hook)
+       (if (consp extent)		; rectangle-p
+ 	  (mapcar func extent)
+ 	(if extent
+ 	    (funcall func extent))))))
  
  (defun default-mouse-track-cleanup-extent ()
    (let ((dead-func

