From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.bugs Subject: bug#24992: 25.1; Using mouse, can put empty keyboard macro in macro ring Date: Tue, 22 Nov 2016 14:32:18 -0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1479854230 2830 195.159.176.226 (22 Nov 2016 22:37:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 22 Nov 2016 22:37:10 +0000 (UTC) To: 24992@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 22 23:37:03 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9JgR-0007oC-N8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Nov 2016 23:36:59 +0100 Original-Received: from localhost ([::1]:58328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9JgV-00070R-Am for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Nov 2016 17:37:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9Jch-0003Zh-Lo for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 17:33:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9Jcc-0006r4-Js for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 17:33:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c9Jcc-0006qv-GR for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 17:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c9Jcb-0003YS-RG for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 17:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Nov 2016 22:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24992 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.147985396913643 (code B ref -1); Tue, 22 Nov 2016 22:33:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Nov 2016 22:32:49 +0000 Original-Received: from localhost ([127.0.0.1]:38686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9JcP-0003Xx-3w for submit@debbugs.gnu.org; Tue, 22 Nov 2016 17:32:49 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9JcM-0003Xj-Bt for submit@debbugs.gnu.org; Tue, 22 Nov 2016 17:32:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9JcF-0006cI-VT for submit@debbugs.gnu.org; Tue, 22 Nov 2016 17:32:41 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:52142) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c9JcF-0006c9-SK for submit@debbugs.gnu.org; Tue, 22 Nov 2016 17:32:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9JcE-00030N-Dr for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 17:32:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9Jc9-0006Yo-CK for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 17:32:38 -0500 Original-Received: from aibo.runbox.com ([91.220.196.211]:44390) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c9Jc9-0006Y7-5E for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 17:32:33 -0500 Original-Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1c9Jc7-0007nT-SQ for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 23:32:31 +0100 Original-Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=rainbow.local) by mailfront12.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1c9Jbw-0004nQ-PO for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 23:32:21 +0100 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125999 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Don-t-add-empty-keyboard-macro-to-macro-ring.patch >From 2e5a84b47b72519aabe8e4aa392e2b53858aa8cf Mon Sep 17 00:00:00 2001 From: gazally 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 --=-=-= Content-Type: text/plain 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)) --=-=-=--