[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: select and META key
From: |
Herbert Euler |
Subject: |
RE: select and META key |
Date: |
Wed, 28 Mar 2007 11:46:40 +0800 |
However, there is surely a bug. Since you press the Meta key
only before releasing mouse-1, the event is slightly different from
pressing the Meta key before pressing mouse-1: in the former
case the first event is `down-mouse-1', and in the latter the
first event is `M-down-mouse-1'. Although the outcome is the
event `M-drag-mouse-1' in both cases, `mouse-drag-secondary'
seems not to get executed and other secondary selection
relating commands, such as `mouse-yank-secondary' fails to be
executed.
I solved the bug, more or less. To reproduce the bug, follow these
steps:
1. Run Emacs in a window system and switch to the *scratch* buffer.
2. Press mouse-1.
3. Drag the mouse to somewhere else, and press the Meta key. With
keeping mouse-1 pressed in the whole progress.
4. Now release mouse-1 with holding the Meta key. You will see the
secondary selection is made.
5. Move point to the end of the *scratch* buffer, and press M-mouse-2.
Although there are secondary selected text (showed by an overlay in
the *scratch* buffer), you cannot yank it at all. This is because
when `mouse-set-secondary' gets executed when a `M-drag-mouse-1' event
is generated at the end of the above steps, the `SECONDARY' property
of symbol `x-selections' is not set correctly (actually it is nil).
The below patch solves the problem.
*** mouse.el.~1.241.8.44.~ 2007-03-19 09:11:41.000000000 +0800
--- mouse.el 2007-03-28 11:26:41.000000000 +0800
***************
*** 1522,1528 ****
(with-current-buffer (window-buffer (posn-window posn))
(if (numberp (posn-point posn))
(setq beg (posn-point posn)))
! (move-overlay mouse-secondary-overlay beg (posn-point end)))))
(defun mouse-drag-secondary (start-event)
"Set the secondary selection to the text that the mouse is dragged over.
--- 1522,1532 ----
(with-current-buffer (window-buffer (posn-window posn))
(if (numberp (posn-point posn))
(setq beg (posn-point posn)))
! (move-overlay mouse-secondary-overlay beg (posn-point end))
! (x-set-selection
! 'SECONDARY
! (buffer-substring (overlay-start mouse-secondary-overlay)
! (overlay-end mouse-secondary-overlay))))))
(defun mouse-drag-secondary (start-event)
"Set the secondary selection to the text that the mouse is dragged over.
However, there are several questions I want to ask:
[1] Is the patch appropriate? Although I have tested it, it may cause
other potential problems.
[2] I do not read all code in mouse.el. Are there other possible
problems like this one?
Thanks.
Regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/