comparison 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
comparison
equal deleted inserted replaced
125:8b0638b347ec 126:1370575f1259
46 (extent-end-position zmacs-region-extent))) 46 (extent-end-position zmacs-region-extent)))
47 (zmacs-deactivate-region) 47 (zmacs-deactivate-region)
48 t))) 48 t)))
49 49
50 (defun pending-delete-pre-hook () 50 (defun pending-delete-pre-hook ()
51 (let ((type (and (symbolp this-command) 51 ;; don't ever signal an error in pre-command-hook!
52 (get this-command 'pending-delete)))) 52 (condition-case e
53 (cond ((eq type 'kill) 53 (let ((type (and (symbolp this-command)
54 (delete-active-region t)) 54 (get this-command 'pending-delete))))
55 ((eq type 'supersede) 55 (cond ((eq type 'kill)
56 (if (delete-active-region ()) 56 (delete-active-region t))
57 (setq this-command '(lambda () (interactive))))) 57 ((eq type 'supersede)
58 (type 58 (if (delete-active-region ())
59 (delete-active-region ()))))) 59 (setq this-command '(lambda () (interactive)))))
60 (type
61 (delete-active-region ()))))
62 (error
63 (warn "Error caught in `pending-delete-pre-hook': %s" e))))
60 64
61 (put 'self-insert-command 'pending-delete t) 65 (put 'self-insert-command 'pending-delete t)
62 66
63 (put 'yank 'pending-delete t) 67 (put 'yank 'pending-delete t)
64 (put 'x-yank-clipboard-selection 'pending-delete t) 68 (put 'x-yank-clipboard-selection 'pending-delete t)