Say we have a folder with the following content:

  -rw-rw-rw-  1 dan Domain Users    2934 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_2.TIF
  -rw-rw-rw-  1 dan Domain Users    2736 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_3.TIF
  -rw-rw-rw-  1 dan Domain Users    3216 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_4.TIF
  -rw-rw-rw-  1 dan Domain Users   62512 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_5.TIF
  -rw-rw-rw-  1 dan Domain Users   59536 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_6.TIF

Using an Emacs keyboard macro, we want to substitute every '_' occurence with '-' in every filename.


With GNU Emacs 30.1 (build 2, x86_64-w64-mingw32) of 2025-02-23

and the macro:
C-x C-q C-SPC C-e ESC x r e p l a c e - s t r i n g RET _ RET -

we get:

  -rw-rw-rw-  1 dan Domain Users    2934 2004-08-27  TOM-I-RESULT-EXERCISE-1-DELAWARE-2.TIF
  -rw-rw-rw-  1 dan Domain Users    2736 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_3.TIF
  -rw-rw-rw-  1 dan Domain Users    3216 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_4.TIF
  -rw-rw-rw-  1 dan Domain Users   62512 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_5.TIF
  -rw-rw-rw-  1 dan Domain Users   59536 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_6.TIF

During the macro recording, when hitting RET after '-', then the following message appears:

  Invalid search bound (wrong side of point)

The macro recording ended abnormally but the Dired buffer content changed as intended
(but not the underlying filenames in the file system; reasonably as editing mode
wasn't yet ended with C-c C-c).


The same behavior happens with GNU Emacs 29.4 (build 2, x86_64-w64-mingw32) of 2024-07-05.


With GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29
and the same macro as before:
C-x C-q C-SPC C-e ESC x r e p l a c e - s t r i n g RET _ RET - RET C-c C-c n

we get:

  -rw-rw-rw-  1 dan Domain Users    2934 2004-08-27  TOM-I-RESULT-EXERCISE-1-DELAWARE-2.TIF
  -rw-rw-rw-  1 dan Domain Users    2736 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_3.TIF
  -rw-rw-rw-  1 dan Domain Users    3216 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_4.TIF
  -rw-rw-rw-  1 dan Domain Users   62512 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_5.TIF
  -rw-rw-rw-  1 dan Domain Users   59536 2004-08-27  TOM_I_RESULT_EXERCISE_1_DELAWARE_6.TIF

Replaced 6 occurrences
Keyboard macro defined

Everything is fine, no error, macro recording ended normally and the filename was modified as expected.


In GNU Emacs 30.1 (build 2, x86_64-w64-mingw32) of 2025-02-23 built on
 AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.26100
System Description: Microsoft Windows 10 Pro (v10.0.2009.26100.2033)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation=aot
 --without-compress-install --with-tree-sitter CFLAGS=-O2
 prefix=/g/rel/install/emacs-30.1'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

(NATIVE_COMP present but libgccjit not available)

Important settings:
  value of $LANG: ESN
  locale-coding-system: cp1252

Major mode: Fundamental

Minor modes in effect:
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny rfc822
mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils image-mode exif time-date subr-x cl-seq
cl-extra help-mode edmacro misearch multi-isearch mule-util info
thingatpt wdired kmacro byte-opt gv bytecomp byte-compile dired-aux
dired dired-loaddefs time cus-edit pp cus-load icons wid-edit
cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
touch-screen dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
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 composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty move-toolbar make-network-process
native-compile emacs)

Memory information:
((conses 16 112404 36817) (symbols 48 8937 2) (strings 32 27488 2272)
 (string-bytes 1 636955) (vectors 16 14944)
 (vector-slots 8 163854 7618) (floats 8 57 106) (intervals 56 5780 22)
 (buffers 992 14))

Best regards.