[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mouse.el patch for region tracking
From: |
JD Smith |
Subject: |
Re: mouse.el patch for region tracking |
Date: |
Sat, 31 Dec 2005 12:19:23 -0700 |
On Dec 31, 2005, at 8:13 AM, Chong Yidong wrote:
JD Smith <address@hidden> writes:
Recently I found that Emacs 22 breaks a simple usage of mouse-drag-
region for defining regions by mouse drag. When transient-mark-mode
is set, mouse-drag-region under Emacs 21 would let you define a
region by dragging, and when the drag is released, it completes (at
which point you can operate on the region). This is somewhat similar
to the XEmacs function 'mouse-track'.
You're not very clear about what exactly is broken. Could you give a
recipe to reproduce the bug, whatever the bug is?
Sure, sorry. I'm not sure it can be classified as a bug, since the
behavior I was using wasn't really documented, and the changes which
"broke" it were actually improvements to mouse.el. Nonetheless, it's
a useful capability which XEmacs has and which Emacs 22 doesn't
(without the patch).
Try:
(defun do-drag (event)
(interactive "e")
(let ((transient-mark-mode t)) ; transient mark
(message "DRAG STARTED")
(mouse-drag-region event)
(message "DRAG FINISHED")))
(global-set-key [(control shift down-mouse-2)] 'do-drag)
On shift-mouse-2-drag, under Emacs 21, this code would complete after
the drag. With Emacs 22, this is no longer the case; you need
another event, like a key press, to return. See this thread for more
detail:
http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg00214.html
With the patch I submitted, I can do:
(defun do-drag (event)
"Print value of variable at the mouse position, with `help'"
(interactive "e")
(message "DRAG STARTED")
(mouse-drag-track event)
(message "DRAG FINISHED"))
and it works as desired under Emacs 22 (I'd use this new function if
bound, and fall back on the transient-mark-mode trick otherwise).
JD