[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38013: [PATCH] Rectangular region selection with mouse
From: |
Mattias Engdegård |
Subject: |
bug#38013: [PATCH] Rectangular region selection with mouse |
Date: |
Sat, 23 Nov 2019 13:46:08 +0100 |
23 nov. 2019 kl. 12.57 skrev Eli Zaretskii <eliz@gnu.org>:
>> +@defvar fine-grained-mouse-movement
>
> I think this variable's name should start with "mouse-". Like
> mouse-fine-grained-movement or something.
True, but since the variable pertains to the 'mouse-movement' event in
particular and not to moving the mouse about in general, it is also useful to
have the name reflect that relation.
'mouse-movement-fine-grained' is possible but a bit awkward. What about
'mouse-fine-grained-tracking'?
>> + (setq fine-grained-mouse-movement t)
>
> What happens if this function signals an error? won't
> fine-grained-mouse-movement be left at its non-nil value?
Good question. Ideally, the variable (and 'track-mouse') would be dynamically
bound during the drag. However, since the function,
mouse-drag-region-rectangle, returns as the drag commences, this is not
possible.
The code follows the pattern of other functions in the same file in that it
trusts the exit function of the transient map to be executed eventually, and
the first thing done in that exit function is to reset the variables.
All these functions have a small hole between setting the variables and the
successful return of set-transient-map, during which an error will not result
in the variables being reset. We could wrap the set-transient-map calls in
condition-case everywhere, if we think that this would increase robustness.
Basically,
(condition-case err
(set-transient-map ...)
(error (setq fine-grained-mouse-movement nil)
(setq track-mouse nil)
(signal (car err) (cdr err))))
An earlier version of the patch used the 'track-mouse' macro instead, which
does not have this problem, but I changed after complaints that it does not
permit independent use of the mouse click event. (For instance, if the
selection uses M-down-mouse-1 and M-drag-mouse-1, M-mouse-1 could not be used
for anything else.) However, I'm not convinced that this would be much of a
limitation.
(Some code in mouse.el uses the track-mouse macro: mouse-drag-and-drop-region
and mouse-drag-secondary.)
- bug#38013: [PATCH] Rectangular region selection with mouse, (continued)
- bug#38013: [PATCH] Rectangular region selection with mouse, Mattias Engdegård, 2019/11/19
- bug#38013: [PATCH] Rectangular region selection with mouse, Eli Zaretskii, 2019/11/19
- bug#38013: [PATCH] Rectangular region selection with mouse, Drew Adams, 2019/11/19
- bug#38013: [PATCH] Rectangular region selection with mouse, Eli Zaretskii, 2019/11/19
- bug#38013: [PATCH] Rectangular region selection with mouse, Drew Adams, 2019/11/19
- bug#38013: [PATCH] Rectangular region selection with mouse, Eli Zaretskii, 2019/11/19
- bug#38013: [PATCH] Rectangular region selection with mouse, Juri Linkov, 2019/11/20
- bug#38013: [PATCH] Rectangular region selection with mouse, Juri Linkov, 2019/11/19
- bug#38013: [PATCH] Rectangular region selection with mouse, martin rudalics, 2019/11/20
- bug#38013: [PATCH] Rectangular region selection with mouse, Eli Zaretskii, 2019/11/23
- bug#38013: [PATCH] Rectangular region selection with mouse,
Mattias Engdegård <=
- bug#38013: [PATCH] Rectangular region selection with mouse, Eli Zaretskii, 2019/11/23
- bug#38013: [PATCH] Rectangular region selection with mouse, Mattias Engdegård, 2019/11/23
- bug#38013: [PATCH] Rectangular region selection with mouse, Mattias Engdegård, 2019/11/27
- bug#38013: [PATCH] Rectangular region selection with mouse, Richard Stallman, 2019/11/09
bug#38013: [PATCH] Rectangular region selection with mouse, martin rudalics, 2019/11/01