[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: transient-mark-mode in 22.0
From: |
Stefan Monnier |
Subject: |
Re: transient-mark-mode in 22.0 |
Date: |
Thu, 09 Jun 2005 17:39:29 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>> I noticed that setting the transient-mark-mode variable no longer does
>> anything
>>
>> As far as I can see, it still does what it always did.
>> Did you actually observe that it fails to work?
> Only in so far as I expected transient-mark-mode to allow mouse-drag-
> region to return upon mouse-up, which it used to do under 21.x. So in
> that sense, it fails to work. It may well be that all other features of
> transient-mark-mode do work when the variable is set.
> In Emacs 21.X, when bound to a mouse-down event, this:
> (defun do-drag (event)
> (interactive "e")
> (let ((transient-mark-mode t)) ; transient mark
> (message "DRAG STARTED")
> (mouse-drag-region event)
> (message "DRAG FINISHED")))
> and this:
> (defun do-drag (event)
> (interactive "e")
> (let ((transient-mark-mode nil)) ; no transient-mark
> (message "DRAG STARTED")
> (mouse-drag-region event)
> (message "DRAG FINISHED")))
> produce different behavior w.r.t. mouse-up. In 22.0, they produce the
> same behavior. Unfortunately, it's not the behavior I need.
I believe this is due to the change
revision 1.252
date: 2004/10/27 17:44:59; author: rms; state: Exp; lines: +49 -48
(mouse-show-mark): Do most processing the same
regardless of transient-mark-mode.
----------------------------
This code in mouse-show-mark is also responsible for the problem where
flyspell's mouse-2 also does a yank, reported a while back, and probably
a few other similar bug reports. Before 1.252 the problem was only
affecting users who don't use transient-mark-mode.
To fix this problem, I maybe mouse-show-mark should be rewritten to not use
(read-event), but instead to use something like pre-command-hook.
Looking at the code of mouse-show-mark, it's pretty messed up:
- in the code below,
(and (consp event)
(or (eq (car event) 'switch-frame)
(eq (posn-point (event-end event))
'vertical-scroll-bar))
(let ((keys (vector 'vertical-scroll-bar event)))
(and (key-binding keys)
(progn
(call-interactively (key-binding keys)
nil keys)
(setq events nil)))))))
if the event is `switch-frame', we'll do a key lookup for
[vertical-scroll-bar switch-frame] which of course will fail.
- since the while loop is expected to execute code such as
handle-switch-frame (which it luckily doesn't), the selected buffer might
get changed before we reach the end where we do (delete-region (mark t)
(point)), so if we fix the above error, we bump into another.
- the overlay management has apparently been rendered completely useless by
the use of the temporary transient-mark-mode. So all that this code
really does is implement the mouse-region-delete-keys. This variable was
introduced in 1996, but is not documented anywhere. Does anybody use
this? (I expect that people who want such a functionality probably use
delete-selection-mode instead anyway). I.e. if could drop
mouse-region-delete-keys, then we could completely remove mouse-show-mark
and the associated bugs.
Stefan
- Re: transient-mark-mode in 22.0, (continued)
- Re: transient-mark-mode in 22.0, Richard Stallman, 2005/06/08
- Re: transient-mark-mode in 22.0, JD Smith, 2005/06/08
- Re: transient-mark-mode in 22.0, Richard Stallman, 2005/06/09
- Re: transient-mark-mode in 22.0, JD Smith, 2005/06/09
- Re: transient-mark-mode in 22.0, Richard Stallman, 2005/06/10
- Re: transient-mark-mode in 22.0, JD Smith, 2005/06/10
- Re: transient-mark-mode in 22.0, Richard Stallman, 2005/06/11
- Re: transient-mark-mode in 22.0, Stefan Monnier, 2005/06/12
- Re: transient-mark-mode in 22.0, Stefan Monnier, 2005/06/12
- Re: transient-mark-mode in 22.0, Richard Stallman, 2005/06/13
- Re: transient-mark-mode in 22.0,
Stefan Monnier <=