diff lisp/packages/pending-del.el @ 126:1370575f1259 xemacs-20-1p1

Import from CVS: tag xemacs-20-1p1
author cvs
date Mon, 13 Aug 2007 09:27:39 +0200
parents 131b0175ea99
children 3bb7ccffb0c0
line wrap: on
line diff
--- a/lisp/packages/pending-del.el	Mon Aug 13 09:26:41 2007 +0200
+++ b/lisp/packages/pending-del.el	Mon Aug 13 09:27:39 2007 +0200
@@ -48,15 +48,19 @@
 	t)))
 
 (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 ())))))
+  ;; 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)