unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 33930@debbugs.gnu.org
Subject: bug#33930: 26.1; [PATCH] Fix `C-x C-k l' (`kmacro-edit-lossage') so it ignores mouse events
Date: Sun, 30 Dec 2018 11:37:28 -0800 (PST)	[thread overview]
Message-ID: <081600a4-0b81-4123-9214-c6db840e8169@default> (raw)

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

             reply	other threads:[~2018-12-30 19:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-30 19:37 Drew Adams [this message]
2019-01-05  9:38 ` bug#33930: 26.1; [PATCH] Fix `C-x C-k l' (`kmacro-edit-lossage') so it ignores mouse events Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=081600a4-0b81-4123-9214-c6db840e8169@default \
    --to=drew.adams@oracle.com \
    --cc=33930@debbugs.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 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).