summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mouse.el6
-rw-r--r--lisp/simple.el7
2 files changed, 12 insertions, 1 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 76fec507e71..4a351f7be25 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1104,6 +1104,12 @@ is dragged over to."
(run-hooks 'mouse-leave-buffer-hook)
(mouse-drag-track start-event)))
+;; Inhibit the region-confinement when undoing mouse-drag-region
+;; immediately after the command. Otherwise, the selection left
+;; active around the dragged text would prevent an undo of the whole
+;; operation.
+(put 'mouse-drag-region 'undo-inhibit-region t)
+
(defun mouse-posn-property (pos property)
"Look for a property at click position.
POS may be either a buffer position or a click position like
diff --git a/lisp/simple.el b/lisp/simple.el
index 29e195bca6c..10aecd651f3 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2508,6 +2508,10 @@ as an argument limits undo to changes within the current region."
(base-buffer (or (buffer-base-buffer) (current-buffer)))
(recent-save (with-current-buffer base-buffer
(recent-auto-save-p)))
+ ;; Allow certain commands to inhibit an immediately following
+ ;; undo-in-region.
+ (inhibit-region (and (symbolp last-command)
+ (get last-command 'undo-inhibit-region)))
message)
;; If we get an error in undo-start,
;; the next command should not be a "consecutive undo".
@@ -2525,7 +2529,8 @@ as an argument limits undo to changes within the current region."
;; it shows nothing else happened in between.
(gethash list undo-equiv-table))))
(setq undo-in-region
- (or (region-active-p) (and arg (not (numberp arg)))))
+ (and (or (region-active-p) (and arg (not (numberp arg))))
+ (not inhibit-region)))
(if undo-in-region
(undo-start (region-beginning) (region-end))
(undo-start))