GNU bug report logs - #28955
27.0.50; mouse event translation loses parameters

Previous Next

Package: emacs;

Reported by: sds <at> gnu.org

Date: Mon, 23 Oct 2017 14:46:02 UTC

Severity: normal

Tags: confirmed

Found in version 27.0.50

To reply to this bug, email your comments to 28955 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28955; Package emacs. (Mon, 23 Oct 2017 14:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to sds <at> gnu.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 23 Oct 2017 14:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sam Steingold <sds <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; mouse event translation loses parameters
Date: Mon, 23 Oct 2017 10:44:30 -0400
In GNU Emacs 27.0.50 (build 3, x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G29))
 of 2017-10-16 built on Clr-Sam.local
Repository revision: eed3a3d9e95d2c5346a23c9d92ca4e5848330183
Windowing system distributor 'Apple', version 10.3.1504
Configured using:
 'configure --with-mailutils --with-ns
 PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/imagemagick/lib/pkgconfig/
 --without-makeinfo'

Configured features:
JPEG NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: C
  locale-coding-system: utf-8-unix

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

Charles writes:

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:

--8<---------------cut here---------------start------------->8---
      /* 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 ();
	    }
	}
--8<---------------cut here---------------end--------------->8---

For further details please see
https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00667.html
https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00678.html

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://camera.org
http://jij.org http://thereligionofpeace.com http://www.memritv.org
Daddy, why doesn't this magnet pick up this floppy disk?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28955; Package emacs. (Sun, 14 Jul 2019 21:53:02 GMT) Full text and rfc822 format available.

Message #8 received at 28955 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Sam Steingold <sds <at> gnu.org>
Cc: 28955 <at> debbugs.gnu.org
Subject: Re: bug#28955: 27.0.50; mouse event translation loses parameters
Date: Sun, 14 Jul 2019 23:52:11 +0200
Sam Steingold <sds <at> gnu.org> writes:

> (define-key key-translation-map (kbd "<s-mouse-1>") (kbd "<mouse-2>"))
>
> Alas, when I actually do command-mouse-1, I get an error:
>
> 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)
>
>
> Charles writes:
>
> 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.

I'm not quite sure what the test case is here, but if I do this:

(progn
  (define-key key-translation-map (kbd "<s-mouse-1>") (kbd "<mouse-2>"))
  (insert (format "%S" (read-event))))
=>
(S-down-mouse-1 (#<window 4 on  *Minibuf-0*> 1 (322 . 8) 1947797915 nil 1 (21 . 0) nil (322 . 8) (15 . 29)))

then things look pretty normal, I think?  So (unless this has fixed in
the meantime), how does one reproduce the error?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28955; Package emacs. (Mon, 15 Jul 2019 17:00:02 GMT) Full text and rfc822 format available.

Message #11 received at 28955 <at> debbugs.gnu.org (full text, mbox):

From: Sam Steingold <sds <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28955 <at> debbugs.gnu.org
Subject: Re: bug#28955: 27.0.50; mouse event translation loses parameters
Date: Mon, 15 Jul 2019 12:58:50 -0400
> * Lars Ingebrigtsen <ynefv <at> tahf.bet> [2019-07-14 23:52:11 +0200]:
>
> Sam Steingold <sds <at> gnu.org> writes:
>
>> (define-key key-translation-map (kbd "<s-mouse-1>") (kbd "<mouse-2>"))
>>
>> Alas, when I actually do command-mouse-1, I get an error:
>>
>> 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)
>>
>>
>> Charles writes:
>>
>> 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.
>
> I'm not quite sure what the test case is here, but if I do this:
>
> (progn
>   (define-key key-translation-map (kbd "<s-mouse-1>") (kbd "<mouse-2>"))
>   (insert (format "%S" (read-event))))
> =>
> (S-down-mouse-1 (#<window 4 on *Minibuf-0*> 1 (322 . 8) 1947797915 nil 1
> (21 . 0) nil (322 . 8) (15 . 29)))
>
> then things look pretty normal, I think?  So (unless this has fixed in
> the meantime), how does one reproduce the error?

Either of the following:

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

or

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

exhibit the same behavior:

1. `C-u C-h c s-mouse-1` ==>
```
   <mouse-2> (translated from <s-down-mouse-1> <s-mouse-1>) at that spot
   runs the command mouse-yank-primary
```

2. Actually clicking s-mouse-1:
```
Debugger entered--Lisp error: (error "mouse-yank-primary must be bound to an event with ...")
  call-interactively(mouse-yank-primary nil nil)
  command-execute(mouse-yank-primary)
```


-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1671
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
http://mideasttruth.com http://www.dhimmitude.org http://camera.org
Those who can't write, write manuals.




Added tag(s) confirmed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 15 Jul 2019 17:04:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28955; Package emacs. (Mon, 15 Jul 2019 17:05:01 GMT) Full text and rfc822 format available.

Message #16 received at 28955 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Sam Steingold <sds <at> gnu.org>
Cc: 28955 <at> debbugs.gnu.org
Subject: Re: bug#28955: 27.0.50; mouse event translation loses parameters
Date: Mon, 15 Jul 2019 19:04:32 +0200
Sam Steingold <sds <at> gnu.org> writes:

> Either of the following:
>
> ```
> (define-key key-translation-map (kbd "<s-mouse-1>") (kbd "<mouse-2>"))
> ```

[...]

> 2. Actually clicking s-mouse-1:
> ```
> Debugger entered--Lisp error: (error "mouse-yank-primary must be bound to an event with ...")
>   call-interactively(mouse-yank-primary nil nil)
>   command-execute(mouse-yank-primary)

I don't have a Super key here, but I was able to reproduce the bug with
Hyper:

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

H-click-1:

Debugger entered--Lisp error: (error "mouse-yank-primary must be bound to an event with ...")
  call-interactively(mouse-yank-primary nil nil)
  command-execute(mouse-yank-primary)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 5 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.