unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* platforms with crippled mice or (error "mouse-yank-primary must be bound to an event with parameters")
@ 2017-10-20 16:59 Sam Steingold
  2017-10-21 14:15 ` Charles A. Roelli
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Steingold @ 2017-10-20 16:59 UTC (permalink / raw)
  To: emacs-devel

Hi,

Some platforms lack second mouse button (most laptops), and some lack
both 2nd and 3rd (mac).
The almighty internet (https://emacs.stackexchange.com/q/20946/795 &
https://superuser.com/q/364575/98857) suggests

(define-key key-translation-map (kbd "<s-mouse-1>") (kbd "<mouse-2>"))

Alas, when I actually do command-mouse-1, I get an error:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "mouse-yank-primary must be bound to an event with parameters")
  call-interactively(mouse-yank-primary nil nil)
  command-execute(mouse-yank-primary)
--8<---------------cut here---------------end--------------->8---

1. Is the `key-translation-map' the right map for this (as opposed to,
e.g., `function-key-map')? DIUC that `key-translation-map' is for the
user and `function-key-map' is for the system or packager?

2. Why am I getting the error? Am I doing something wrong? Is this a
(known) bug?

3. Shouldn't the solution for the problem be already in core? IOW, can
we detect the platform deficiency and install the alternative binding,
or maybe even install it unconditionally?

Thanks.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://honestreporting.com
http://mideasttruth.com http://thereligionofpeace.com http://www.memritv.org
Bus error -- driver executed.




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

* Re: platforms with crippled mice or (error "mouse-yank-primary must be bound to an event with parameters")
  2017-10-20 16:59 platforms with crippled mice or (error "mouse-yank-primary must be bound to an event with parameters") Sam Steingold
@ 2017-10-21 14:15 ` Charles A. Roelli
  0 siblings, 0 replies; 2+ messages in thread
From: Charles A. Roelli @ 2017-10-21 14:15 UTC (permalink / raw)
  To: sds; +Cc: emacs-devel

Looks like a bug.  When you add the key translation and type
s-mouse-1, the mouse click event ends up losing its location
information.

For example, the following:

(s-mouse-1 (#<window 3 on *scratch*> 227 (116 . 92) 143676325 nil 227 (16 . 5) nil (116 . 12) (7 . 16)))

gets turned into just:

mouse-2

which leads to the error about the missing parameters.

It happens in this part of keyboard.c:

      /* Does mock_input indicate that we are re-reading a key sequence?  */
      if (t < mock_input)
	{
	  key = keybuf[t];
	  add_command_key (key);
	  if (current_kboard->immediate_echo)
	    {
	      /* Set immediate_echo to false so as to force echo_now to
		 redisplay (it will set immediate_echo right back to true).  */
	      current_kboard->immediate_echo = false;
	      echo_now ();
	    }
	}

Note also the comments later on in keyboard.c, which imply that
function key expansion is not yet able to generate or handle mouse
events properly.

> Beyond that, only function key expansion could
> create more than two keys, but that should never
> generate mouse events, so it's okay to zero
> mock_input in that case too.

> FIXME: The above paragraph seems just plain
> wrong, if you consider things like
> xterm-mouse-mode.  -stef



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

end of thread, other threads:[~2017-10-21 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-20 16:59 platforms with crippled mice or (error "mouse-yank-primary must be bound to an event with parameters") Sam Steingold
2017-10-21 14:15 ` Charles A. Roelli

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