all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Herbert Euler" <herberteuler@hotmail.com>
To: herberteuler@hotmail.com, alinsoar@voila.fr
Cc: bug-gnu-emacs@gnu.org, emacs-devel@gnu.org
Subject: RE: select and META key
Date: Wed, 28 Mar 2007 11:46:40 +0800	[thread overview]
Message-ID: <BAY143-F22344C039C13ED81C59A1ADA6D0@phx.gbl> (raw)
In-Reply-To: <BAY143-F8209A186ED0DDF29767C7DA6F0@phx.gbl>

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

  parent reply	other threads:[~2007-03-28  3:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26 11:10 select and META key A Soare
2007-03-26 11:23 ` Herbert Euler
2007-03-26 11:32   ` Herbert Euler
2007-03-28  3:46   ` Herbert Euler [this message]
2007-04-01 14:00     ` Richard Stallman
2007-04-01 17:45       ` Chong Yidong
  -- strict thread matches above, loose matches on Subject: below --
2007-03-26 11:58 A Soare
2007-03-26 10:57 A Soare
2007-03-26 11:06 ` Herbert Euler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY143-F22344C039C13ED81C59A1ADA6D0@phx.gbl \
    --to=herberteuler@hotmail.com \
    --cc=alinsoar@voila.fr \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.