summaryrefslogtreecommitdiff
path: root/lisp/rect.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-10-25 11:16:39 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2019-11-27 13:40:29 +0100
commit4eb7db5d4b84708912c63a77569c8adeeff6c640 (patch)
treee4f014f3b2b2407ec74e875a8ef2ab3bc37b2225 /lisp/rect.el
parente7b4c248a6d2a2eca19a2a362103a7f24cfe30fc (diff)
downloademacs-4eb7db5d4b84708912c63a77569c8adeeff6c640.tar.gz
Mouse rectangular region selection (bug#38013)
Make it possible to select a rectangular region using the mouse. The standard binding is C-M-mouse-1. * lisp/mouse.el (mouse-scroll-subr): Add ADJUST argument. (mouse-drag-region-rectangle): New. * lisp/rect.el (rectangle--reset-point-crutches): New. (rectangle--reset-crutches): Use 'rectangle--reset-point-crutches'. * src/xdisp.c (remember_mouse_glyph, syms_of_xdisp): Add 'mouse-fine-grained-tracking'. * doc/lispref/commands.texi (Motion Events): Document 'mouse-fine-grained-tracking'. * doc/emacs/frames.texi (Mouse Commands): * doc/emacs/killing.texi (Rectangles): * etc/NEWS: Document rectangular selection with the mouse.
Diffstat (limited to 'lisp/rect.el')
-rw-r--r--lisp/rect.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/rect.el b/lisp/rect.el
index 4d4d6146f21..1109786fc5b 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -133,11 +133,15 @@ Point is at the end of the segment of this line within the rectangle."
(defun rectangle--crutches ()
(cons rectangle--mark-crutches
(window-parameter nil 'rectangle--point-crutches)))
-(defun rectangle--reset-crutches ()
- (kill-local-variable 'rectangle--mark-crutches)
+
+(defun rectangle--reset-point-crutches ()
(if (window-parameter nil 'rectangle--point-crutches)
(setf (window-parameter nil 'rectangle--point-crutches) nil)))
+(defun rectangle--reset-crutches ()
+ (kill-local-variable 'rectangle--mark-crutches)
+ (rectangle--reset-point-crutches))
+
;;; Rectangle operations.
(defun apply-on-rectangle (function start end &rest args)