From: Gemini Lasswell <gazally@runbox.com>
To: 24992@debbugs.gnu.org
Subject: bug#24992: 25.1; Using mouse, can put empty keyboard macro in macro ring
Date: Tue, 22 Nov 2016 14:32:18 -0800 [thread overview]
Message-ID: <m2r363qh71.fsf@rainbow.local> (raw)
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
The commentary in lisp/kmacro.el says "Note: an empty macro is never
added to the macro ring.", but here is a way to add an empty macro to
the ring using kmacro-end-call-mouse, which is by default bound to
S-mouse-3. I am not aware of any serious side effects of there being an
empty macro in the ring.
To reproduce, with emacs -Q and the mouse pointer positioned over your
Emacs window:
C-x ( aaa S-mouse-3
C-x ( S-mouse-3
C-x ( bbb S-mouse-3
C-x C-k C-n C-n C-n
This defines three macros, one which inserts "aaa", an empty one, and one
which inserts "bbb". Then the repeated C-n's of the last step cycle
through the macros in the ring and display them in the echo area.
I'm attaching a patch which makes kmacro-end-call-mouse do the same
thing that kmacro-end-and-call-macro does in this case, which is to end
the definition of the empty macro, pop the empty macro off the ring, and
then run the macro which becomes current.
[-- Attachment #2: 0001-Don-t-add-empty-keyboard-macro-to-macro-ring.patch --]
[-- Type: text/plain, Size: 1069 bytes --]
From 2e5a84b47b72519aabe8e4aa392e2b53858aa8cf Mon Sep 17 00:00:00 2001
From: gazally <gazally@users.noreply.github.com>
Date: Sun, 20 Nov 2016 14:24:51 -0800
Subject: [PATCH] Don't add empty keyboard macro to macro ring
* lisp/kmacro.el (kmacro-end-call-mouse): Don't save a newly defined
macro if it is empty.
---
lisp/kmacro.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 2e743b4..49787f5 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -744,7 +744,13 @@ kmacro-end-call-mouse
If kbd macro currently being defined end it before activating it."
(interactive "e")
(when defining-kbd-macro
- (end-kbd-macro))
+ (end-kbd-macro)
+ (when (and last-kbd-macro (= (length last-kbd-macro) 0))
+ (setq last-kbd-macro nil)
+ (message "Ignore empty macro")
+ ;; Don't call `kmacro-ring-empty-p' to avoid its messages.
+ (while (and (null last-kbd-macro) kmacro-ring)
+ (kmacro-pop-ring1))))
(mouse-set-point event)
(kmacro-call-macro nil t))
--
2.10.1
[-- Attachment #3: Type: text/plain, Size: 2803 bytes --]
GNU Emacs 25.1.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G1004))
of 2016-10-09 built on rainbow.local
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs/25.1/share/info/emacs
--prefix=/usr/local/Cellar/emacs/25.1 --without-x --with-xml2
--without-dbus --with-gnutls --with-imagemagick --with-rsvg --with-ns
--disable-ns-self-contained'
Configured features:
JPEG RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS
NS
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
Defining kbd macro...
Keyboard macro defined
Defining kbd macro...
Keyboard macro defined
Macro: aaa
Macro:
Macro: bbb
Macro: aaa
Macro:
Macro: bbb
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils cl-seq
cl-extra help-mode easymenu edmacro cl-loaddefs pcase cl-lib kmacro
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel ns-win ucs-normalize term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote kqueue cocoa ns
multi-tty make-network-process emacs)
Memory information:
((conses 16 197854 6343)
(symbols 48 19937 0)
(miscs 40 49 173)
(strings 32 15610 5377)
(string-bytes 1 449702)
(vectors 16 33190)
(vector-slots 8 656305 5396)
(floats 8 159 206)
(intervals 56 215 0)
(buffers 976 17))
next reply other threads:[~2016-11-22 22:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 22:32 Gemini Lasswell [this message]
2017-12-08 3:01 ` bug#24992: 25.1; Using mouse, can put empty keyboard macro in macro ring Noam Postavsky
2017-12-31 19:34 ` Gemini Lasswell
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=m2r363qh71.fsf@rainbow.local \
--to=gazally@runbox.com \
--cc=24992@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 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.