unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24991: 25.1; 7 bugs in kmacro-step-edit-macro
@ 2016-11-22 22:10 Gemini Lasswell
  0 siblings, 0 replies; only message in thread
From: Gemini Lasswell @ 2016-11-22 22:10 UTC (permalink / raw)
  To: 24991

1. It is possible to change a numeric argument during step-editing, but
the number gets inserted into the buffer.

F3 C-u 3 a RET F4
C-x C-k SPC
SPC R 8 !
F4

Result: during the step-editing process the 8 gets inserted into the
buffer instead of being passed as an argument to self-insert-command.
The editing of the macro is successful however: running the macro
after editing will insert 8 a's.

If you use C-3 instead of C-u 3, kmacro-step-edit-macro also fails to
pass the numeric argument during editing:

F3 C-3 a RET F4
C-x C-k SPC
R C-8 !
F4


2. Appending to the end of a macro doesn't work.

F3 a RET F4
C-x C-k SPC
SPC A b RET C-j
F4

Result: "After 0 kbd macro iterations: Keyboard macro terminated by a
command ringing the bell" in the echo area. If you use C-x C-k C-v to
show the macro in the echo area, it shows: "Last macro: a RET <nil> b
RET".


3. Skipping or deleting every event in the macro produces an empty
macro.

F3 hello F4
C-x C-k SPC
C-k
C-x C-k C-v

Result: "Last macro:" appears in the echo area. If you try C-x C-k SPC
again, nothing happens, because the head of the kmacro ring (the
variable last-kbd-macro) is set to "". According to the commentary at
the beginning of kmacro.el, an empty macro should never be added to the
macro ring.

It is also possible to make an empty macro by skipping the macro events
individually by typing d repeatedly instead of C-k, or by deleting
events by replacing them with nothing by repeatedly typing r C-j.


4. A macro which uses a negative universal argument is corrupted by
step-editing.

F3 hello C-u - M-u F4
C-x C-k SPC
SPC !
F4

Result: "After 0 kbd macro iterations: funcall-interactively: Negative
repetition argument -1". The text "hello" is inserted in the buffer by
the last F4 instead of "HELLO". C-x C-k C-v will reveal that the macro
has been changed to "Last macro: hello C-u - \365". In this case,
the bug does not occur if you use C-- in the macro instead of C-u -.


5. Step-editing corrupts a macro which uses quoted-insert.

F3 C-q 17051 i there F4
C-x C-k SPC
SPC !
F4

Result: "After 0 kbd macro iterations: read-quoted-char: Args out of
range: [], 0". C-x C-k C-v will reveal that the macro has been
truncated.

Step-edit works as expected if you define the macro this way
instead:

F3 C-q 17051 RET i there F4


6. The prompt disappears when trying to edit a quoted-insert command,
and then the C-j used to end a replaced sequence gets inserted into the
macro.

F3 C-q 17051 RET i there RET F4
C-x C-k SPC
r C-q 17052 C-j C-j !
F4

Result: kmacro-step-edit-macro's minibuffer prompt disappears when you
type C-q. But step-edit is still active. Instead of the first C-j
exiting replace mode, it exits quoted-insert and inserts the C-j (LFD)
in the macro. The LFD in the macro causes the F4 to send you to
*Backtrace* headed by this message: "Debugger entered--Lisp error:
(void-variable Ḫ)".

Comment: It could probably be argued that inserting the line feed is the
expected behavior of quoted-insert, but it's pretty confusing from a
user's point of view. Since kmacro-step-edit-macro has special case code
already to handle quoted-insert, that special case code could make sure
LFD doesn't end up in the macro.


7. Replacing C-w with M-w produces an unexpected result.

F3 abc C-b C-b C-SPC C-f C-w C-e C-y RET F4
C-x C-k C-SPC
TAB TAB TAB TAB r M-w C-j !
F4

Result: "ab÷cb" is inserted in the buffer by the F4.


In 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:
next-line: End of buffer [2 times]
Defining kbd macro...
Keyboard macro defined
After 0 kbd macro iterations: undefined: Keyboard macro terminated by a command ringing the bell
Defining kbd macro...
Mark set
Keyboard macro defined
Defining kbd macro...
Mark set [2 times]
Keyboard macro defined

Load-path shadows:
None found.

Features:
(debug ido seq byte-opt gv bytecomp byte-compile cconv ispell novice
rect pp 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 217601 34764)
 (symbols 48 21346 5)
 (miscs 40 136 419)
 (strings 32 22114 4019)
 (string-bytes 1 637033)
 (vectors 16 35956)
 (vector-slots 8 684530 15007)
 (floats 8 193 526)
 (intervals 56 675 195)
 (buffers 976 22))





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-22 22:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22 22:10 bug#24991: 25.1; 7 bugs in kmacro-step-edit-macro Gemini Lasswell

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