summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-10-31 10:31:27 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2019-10-31 17:41:29 +0100
commitd75794fd5c168fb76406b88e231d8749160f934a (patch)
treef2ca99dbdca855ddc4d182658fda10233c44cac3 /lisp/mouse.el
parent111a95fe6d209aff6e7f26cb6777fbdf02aae15d (diff)
downloademacs-d75794fd5c168fb76406b88e231d8749160f934a.tar.gz
Inhibit undo-in-region for mouse-drag-region (bug#37700)
'mouse-drag-region' leaves the region active around the dragged text, so a straight undo did not revert the entire operation. To remedy this, inhibit undo-in-region when the last command was mouse-drag-region. (Method suggested by Stefan Monnier.) * lisp/mouse.el (undo-drag-region): Set the undo-inhibit-region property. * lisp/simple.el (undo): Inhibit undo-in-region if the last command had the undo-inhibit-region property set. * doc/lispref/symbols.texi (Standard Properties): * doc/lispref/text.texi (Undo): Document undo-inhibit-region. * etc/NEWS: Announce the property.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el6
1 files changed, 6 insertions, 0 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