From: Richard M. Stallman Date: Sat, 3 Jul 1993 19:12:35 +0000 (+0000) Subject: (kill-region): Cope with change hooks that change props. X-Git-Tag: emacs-19.34~11884 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=12bcd3b6da0bff6893549ed528501d45f15c6593;p=emacs.git (kill-region): Cope with change hooks that change props. --- diff --git a/lisp/simple.el b/lisp/simple.el index ebf1a45812b..0416ba9bb26 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1040,11 +1040,18 @@ to make one entry in the kill ring." (eq last-command 'kill-region) (eq beg end))) ;; Don't let the undo list be truncated before we can even access it. - (let ((undo-strong-limit (+ (- (max beg end) (min beg end)) 100))) + (let ((undo-strong-limit (+ (- (max beg end) (min beg end)) 100)) + (old-list buffer-undo-list) + tail) (delete-region beg end) + ;; Search back in buffer-undo-list for this string, + ;; in case a change hook made property changes. + (setq tail buffer-undo-list) + (while (not (stringp (car (car tail)))) + (setq tail (cdr tail))) ;; Take the same string recorded for undo ;; and put it in the kill-ring. - (kill-new (car (car buffer-undo-list))) + (kill-new (car (car tail))) (setq this-command 'kill-region))) (t