unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* RE: select and META key
       [not found] <23544965.637781174907413197.JavaMail.www@wwinf4004>
@ 2007-03-26 11:23 ` Herbert Euler
  2007-03-26 11:32   ` Herbert Euler
  2007-03-28  3:46   ` Herbert Euler
  0 siblings, 2 replies; 6+ messages in thread
From: Herbert Euler @ 2007-03-26 11:23 UTC (permalink / raw)
  To: alinsoar; +Cc: bug-gnu-emacs, emacs-devel

> > >1. Emacs -Q
> > >
> > >2. open en elisp file. for example edebug.el
> > >
> > >3. Press left mouse button and select a region. Before to release left
> > >mouse button press ALT. While keepeng ALT pressed release mouse button
> > >
> > >Result: a region is selected, and it cannot be unsected.
> > >
> > >This is a bug or an feature of emacs unknown by me?
> >
> > I think it is secondary selection.  See also (info "(emacs) Secondary
> > Selection").
> >
> >
>
>
>You are right. Thanks.

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.

Regards,
Guanpeng Xu

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: select and META key
  2007-03-26 11:23 ` Herbert Euler
@ 2007-03-26 11:32   ` Herbert Euler
  2007-03-28  3:46   ` Herbert Euler
  1 sibling, 0 replies; 6+ messages in thread
From: Herbert Euler @ 2007-03-26 11:32 UTC (permalink / raw)
  To: herberteuler, alinsoar; +Cc: bug-gnu-emacs, emacs-devel

>> > >1. Emacs -Q
>> > >
>> > >2. open en elisp file. for example edebug.el
>> > >
>> > >3. Press left mouse button and select a region. Before to release left
>> > >mouse button press ALT. While keepeng ALT pressed release mouse button
>> > >
>> > >Result: a region is selected, and it cannot be unsected.
>> > >
>> > >This is a bug or an feature of emacs unknown by me?
>> >
>> > I think it is secondary selection.  See also (info "(emacs) Secondary
>> > Selection").
>> >
>> >
>>
>>
>>You are right. Thanks.
>
>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.

And the opposite behaves in this way:

1. Press M-mouse-1 to generate a M-down-mouse-1 event.
2. Move mouse to generate a mouse-movement event.
3. First release the Meta key and then mouse-1.

The outcome is drag-mouse-1 event.  However, secondary
selection has been successfully executed and pressing
M-mouse-2 can certainly yank secondary selected texts.

Are these behaviors desired?

Regards,
Guanpeng Xu

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: select and META key
@ 2007-03-26 11:58 A Soare
  0 siblings, 0 replies; 6+ messages in thread
From: A Soare @ 2007-03-26 11:58 UTC (permalink / raw)
  To: Herbert Euler; +Cc: Emacs   Dev  [emacs-devel]

> >> > >1. Emacs -Q
> >> > >
> >> > >2. open en elisp file. for example edebug.el
> >> > >
> >> > >3. Press left mouse button and select a region. Before to release left
> >> > >mouse button press ALT. While keepeng ALT pressed release mouse button
> >> > >
> >> > >Result: a region is selected, and it cannot be unsected.
> >> > >
> >> > >This is a bug or an feature of emacs unknown by me?
> >> >
> >> > I think it is secondary selection.  See also (info "(emacs) Secondary
> >> > Selection").
> >> >
> >> >
> >>
> >>
> >>You are right. Thanks.
> >
> >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.
> 
> And the opposite behaves in this way:
> 
> 1. Press M-mouse-1 to generate a M-down-mouse-1 event.
> 2. Move mouse to generate a mouse-movement event.
> 3. First release the Meta key and then mouse-1.
> 
> The outcome is drag-mouse-1 event.  However, secondary
> selection has been successfully executed and pressing
> M-mouse-2 can certainly yank secondary selected texts.
> 
> Are these behaviors desired?
> 


I do not have time now for this issue. I will check as soon as I do.

It is just evervant because the selection does not dissapear.


Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: select and META key
  2007-03-26 11:23 ` Herbert Euler
  2007-03-26 11:32   ` Herbert Euler
@ 2007-03-28  3:46   ` Herbert Euler
  2007-04-01 14:00     ` Richard Stallman
  1 sibling, 1 reply; 6+ messages in thread
From: Herbert Euler @ 2007-03-28  3:46 UTC (permalink / raw)
  To: herberteuler, alinsoar; +Cc: bug-gnu-emacs, emacs-devel

>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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: select and META key
  2007-03-28  3:46   ` Herbert Euler
@ 2007-04-01 14:00     ` Richard Stallman
  2007-04-01 17:45       ` Chong Yidong
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2007-04-01 14:00 UTC (permalink / raw)
  To: emacs-devel; +Cc: alinsoar, herberteuler, emacs-devel

Would someone please check this for correctness?
If it is correct, please install it.
Then please report and ack.

(From herberteuler.)

*** 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: select and META key
  2007-04-01 14:00     ` Richard Stallman
@ 2007-04-01 17:45       ` Chong Yidong
  0 siblings, 0 replies; 6+ messages in thread
From: Chong Yidong @ 2007-04-01 17:45 UTC (permalink / raw)
  To: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> Would someone please check this for correctness?
> If it is correct, please install it.
> Then please report and ack.

Looks correct to me.  I've checked it in.

> *** 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-04-01 17:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-26 11:58 select and META key A Soare
     [not found] <23544965.637781174907413197.JavaMail.www@wwinf4004>
2007-03-26 11:23 ` Herbert Euler
2007-03-26 11:32   ` Herbert Euler
2007-03-28  3:46   ` Herbert Euler
2007-04-01 14:00     ` Richard Stallman
2007-04-01 17:45       ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).