From xemacs-m  Tue Apr 15 18:20:51 1997
Received: from CNRI.Reston.VA.US (CNRI.Reston.VA.US [132.151.1.1])
	by xemacs.org (8.8.5/8.8.5) with SMTP id SAA03903
	for <xemacs-beta@xemacs.org>; Tue, 15 Apr 1997 18:20:51 -0500 (CDT)
Received: from newcnri.cnri.reston.va.us by CNRI.Reston.VA.US id aa22982;
          15 Apr 97 19:20 EDT
Received: from anthem.CNRI.Reston.Va.US by newcnri.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id TAA28944; Tue, 15 Apr 1997 19:20:21 -0400
Received: by anthem.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id TAA07319; Tue, 15 Apr 1997 19:20:20 -0400
Date: Tue, 15 Apr 1997 19:20:20 -0400
Message-Id: <199704152320.TAA07319@anthem.CNRI.Reston.Va.US>
From: "Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US>
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="ydibl7gTMrv/Zh4XJIgMNCGCcB06Zafp3Rfvktxx"
Content-Transfer-Encoding: 7bit
To: xemacs-beta@xemacs.org
Subject: pending-del.el citizenship
X-Mailer: VM 6.23 under 19.15 XEmacs Lucid
Reply-To: "Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US>
X-Attribution: BAW
X-Oblique-Strategy: Water
X-Url: http://www.python.org/~bwarsaw


--ydibl7gTMrv/Zh4XJIgMNCGCcB06Zafp3Rfvktxx
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


pending-del.el isn't a good citizen because pending-delete-pre-hook
can propagate errors, causing pre-command-hook to wipe itself clean.
Here's a patch so that pending-del.el plays nice.  Note this is
against 19.15's lisp tree.

As a meta note, I wonder if pre- and post-command-hook shouldn't do
something like this instead of the current error-wipes-all behavior?

-Barry


--ydibl7gTMrv/Zh4XJIgMNCGCcB06Zafp3Rfvktxx
Content-Type: text/plain
Content-Description: packages/pending-del.el patch
Content-Disposition: inline;
	filename="p1"
Content-Transfer-Encoding: 7bit

*** pending-del.el	1997/04/15 23:13:57	1.1
--- pending-del.el	1997/04/15 23:16:26
***************
*** 49,61 ****
  
  (defun pending-delete-pre-hook ()
!   (let ((type (and (symbolp this-command)
! 		   (get this-command 'pending-delete))))
!     (cond ((eq type 'kill)
! 	   (delete-active-region t))
! 	  ((eq type 'supersede)
! 	   (if (delete-active-region ())
! 	       (setq this-command '(lambda () (interactive)))))
! 	  (type
! 	   (delete-active-region ())))))
  
  (put 'self-insert-command 'pending-delete t)
--- 49,65 ----
  
  (defun pending-delete-pre-hook ()
!   ;; don't ever signal an error in pre-command-hook!
!   (condition-case e
!       (let ((type (and (symbolp this-command)
! 		       (get this-command 'pending-delete))))
! 	(cond ((eq type 'kill)
! 	       (delete-active-region t))
! 	      ((eq type 'supersede)
! 	       (if (delete-active-region ())
! 		   (setq this-command '(lambda () (interactive)))))
! 	      (type
! 	       (delete-active-region ()))))
!     (error
!      (warn "Error caught in `pending-delete-pre-hook': %s" e))))
  
  (put 'self-insert-command 'pending-delete t)

--ydibl7gTMrv/Zh4XJIgMNCGCcB06Zafp3Rfvktxx--

