aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorStefan Monnier1999-12-07 06:30:44 +0000
committerStefan Monnier1999-12-07 06:30:44 +0000
commita1eb02bddb07ce904f803c8b6fa2c1282e98938e (patch)
tree570bfecb58c03034e24cf82f145c69275bcc1339 /lisp/simple.el
parent1da04da19b299687d4100ba044c5cbcede5a0299 (diff)
downloademacs-a1eb02bddb07ce904f803c8b6fa2c1282e98938e.tar.gz
emacs-a1eb02bddb07ce904f803c8b6fa2c1282e98938e.zip
(kill-region): Use the new `delete-and-extract-region'
rather than the undo log (which is incorrect with *-change-functions).
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el29
1 files changed, 6 insertions, 23 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 63617178a67..9a44200059c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1633,29 +1633,12 @@ the text killed this time appends to the text killed last time
1633to make one entry in the kill ring." 1633to make one entry in the kill ring."
1634 (interactive "*r") 1634 (interactive "*r")
1635 (condition-case nil 1635 (condition-case nil
1636 ;; Don't let the undo list be truncated before we can even access it. 1636 (let ((string (delete-and-extract-region beg end)))
1637 (let ((undo-strong-limit (+ (- (max beg end) (min beg end)) 100)) 1637 (when string ;STRING is nil if BEG = END
1638 (old-list buffer-undo-list) 1638 ;; Add that string to the kill ring, one way or another.
1639 tail 1639 (if (eq last-command 'kill-region)
1640 ;; If we can't rely on finding the killed text 1640 (kill-append string (< end beg))
1641 ;; in the undo list, save it now as a string. 1641 (kill-new string)))
1642 (string (if (or (eq buffer-undo-list t)
1643 (= beg end))
1644 (buffer-substring beg end))))
1645 (delete-region beg end)
1646 ;; Search back in buffer-undo-list for this string,
1647 ;; in case a change hook made property changes.
1648 (setq tail buffer-undo-list)
1649 (unless string
1650 (while (not (stringp (car (car tail))))
1651 (setq tail (cdr tail)))
1652 ;; If we did not already make the string to use,
1653 ;; use the same one that undo made for us.
1654 (setq string (car (car tail))))
1655 ;; Add that string to the kill ring, one way or another.
1656 (if (eq last-command 'kill-region)
1657 (kill-append string (< end beg))
1658 (kill-new string))
1659 (setq this-command 'kill-region)) 1642 (setq this-command 'kill-region))
1660 ((buffer-read-only text-read-only) 1643 ((buffer-read-only text-read-only)
1661 ;; The code above failed because the buffer, or some of the characters 1644 ;; The code above failed because the buffer, or some of the characters