unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33930: 26.1; [PATCH] Fix `C-x C-k l' (`kmacro-edit-lossage') so it ignores mouse events
@ 2018-12-30 19:37 Drew Adams
  2019-01-05  9:38 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Adams @ 2018-12-30 19:37 UTC (permalink / raw)
  To: 33930

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

If you have used the mouse at all during the last 300 events then `C-x
C-k l' (`kmacro-edit-lossage') is broken: it just raises an error,
rather than showing you your keyboard events as a keyboard macro and
letting you edit the macro.  That's not very helpful.

This happens because `edmacro-fix-menu-commands' just punts, not
bothering to try to handle mouse events the same way it handles events
such as help-echo and switch-frame events.

The attached patch fixes that.  It also makes the error message explicit
about any unsupported event, instead of assuming that every unsupported
event is necessarily a mouse event.

In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-30
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor `Microsoft Corp.', version 10.0.16299
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''

[-- Attachment #2: edmacro-2018-12-30a.patch --]
[-- Type: application/octet-stream, Size: 1377 bytes --]

diff -u edmacro.el edmacro-2018-12-30a-PATCHED.el
--- edmacro.el	2018-12-30 11:25:33.813651100 -0800
+++ edmacro-2018-12-30a-PATCHED.el	2018-12-30 11:30:04.941233800 -0800
@@ -613,22 +613,21 @@
 	;; Make a list of the elements.
 	(setq macro (append macro nil))
 	(dolist (ev macro)
-	  (cond ((atom ev)
-		 (push ev result))
+	  (cond ((atom ev) (push ev result))
 		((eq (car ev) 'help-echo))
 		((eq (car ev) 'switch-frame))
-		((equal ev '(menu-bar))
-		 (push 'menu-bar result))
+		((equal ev '(menu-bar)) (push 'menu-bar result))
+                ((or (mouse-event-p ev)  (mouse-movement-p ev)
+                     (memq (event-basic-type ev)
+                           (list mouse-wheel-down-event mouse-wheel-up-event
+                                 mouse-wheel-right-event mouse-wheel-left-event)))
+                 nil)
 		((equal (cl-cadadr ev) '(menu-bar))
 		 (push (vector 'menu-bar (car ev)) result))
 		;; It would be nice to do pop-up menus, too, but not enough
 		;; info is recorded in macros to make this possible.
-		(noerror
-		 ;; Just ignore mouse events.
-		 nil)
-		(t
-		 (error "Macros with mouse clicks are not %s"
-			"supported by this command"))))
+		(noerror nil)
+		(t (error "`edmacro-fix-menu-commands': Unsupported event: %S" ev))))
 	;; Reverse them again and make them back into a vector.
 	(vconcat (nreverse result)))
     macro))

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

* bug#33930: 26.1; [PATCH] Fix `C-x C-k l' (`kmacro-edit-lossage') so it ignores mouse events
  2018-12-30 19:37 bug#33930: 26.1; [PATCH] Fix `C-x C-k l' (`kmacro-edit-lossage') so it ignores mouse events Drew Adams
@ 2019-01-05  9:38 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2019-01-05  9:38 UTC (permalink / raw)
  To: Drew Adams; +Cc: 33930-done

> Date: Sun, 30 Dec 2018 11:37:28 -0800 (PST)
> From: Drew Adams <drew.adams@oracle.com>
> 
> If you have used the mouse at all during the last 300 events then `C-x
> C-k l' (`kmacro-edit-lossage') is broken: it just raises an error,
> rather than showing you your keyboard events as a keyboard macro and
> letting you edit the macro.  That's not very helpful.
> 
> This happens because `edmacro-fix-menu-commands' just punts, not
> bothering to try to handle mouse events the same way it handles events
> such as help-echo and switch-frame events.
> 
> The attached patch fixes that.  It also makes the error message explicit
> about any unsupported event, instead of assuming that every unsupported
> event is necessarily a mouse event.

Thanks, installed on the master branch.





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

end of thread, other threads:[~2019-01-05  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-30 19:37 bug#33930: 26.1; [PATCH] Fix `C-x C-k l' (`kmacro-edit-lossage') so it ignores mouse events Drew Adams
2019-01-05  9:38 ` Eli Zaretskii

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