* bug#38775: (kbd "C-x ( ... C-x )") gulps "C-x (" and "C-x )"
@ 2019-12-28 15:12 Kritixi Lithos
2019-12-28 15:46 ` Andreas Schwab
0 siblings, 1 reply; 8+ messages in thread
From: Kritixi Lithos @ 2019-12-28 15:12 UTC (permalink / raw)
To: 38775
From `emacs -Q`, I write `(kbd "C-x ( C-d C-x )")` in the buffer, then
evaluate it using `C-M-x`, which gives "^D" instead of the expected
"^X(^D^X)". This can be seen more clearly by calling `key-description`
with the result from `kbd`, resulting in "C-d" instead of the expected
original string "C-x ( C-d C-x )". (Thanks to thblt from #emacs for this
minimal example).
The original problem was found when trying to call emacs keystrokes on
an input file (with the goal of achieving something like vim with the
`-c` flag) like so,
`emacs -Q --insert input.txt --eval '(command-execute(kbd"C-x ( C-d M-0
C-x )"))'`
Running this removes only 1 character from the input file instead of
every character being deleted as expected.
Another instance of this bug is https://emacs.stackexchange.com/q/33395
(thanks again to thblt for finding this).
These results were as tested on GNU Emacs 26.3.
In GNU Emacs 26.3 (build 1, x86_64-apple-darwin19.0.0)
of 2019-10-01 built on Catalina.local
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list... [2 times]
Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs/26.3/share/info/emacs
--prefix=/usr/local/Cellar/emacs/26.3 --with-gnutls --without-x
--with-xml2 --without-dbus --with-modules --without-ns
--without-imagemagick'
Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB MODULES THREADS
Important settings:
value of $LC_ALL: en_US.UTF-8
value of $LC_CTYPE: UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail tool-bar rmail-loaddefs mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
regexp-opt rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
term/screen term/xterm xterm time-date elec-pair mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type tabulated-list
replace newcomment text-mode elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow isearch timer select mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors 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 composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray 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 threads kqueue
multi-tty make-network-process emacs)
Memory information:
((conses 16 93401 5763)
(symbols 48 19401 1)
(miscs 40 35 71)
(strings 32 27575 976)
(string-bytes 1 742301)
(vectors 16 11803)
(vector-slots 8 448648 7552)
(floats 8 49 254)
(intervals 56 209 13)
(buffers 992 12))
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#38775: (kbd "C-x ( ... C-x )") gulps "C-x (" and "C-x )"
2019-12-28 15:12 bug#38775: (kbd "C-x ( ... C-x )") gulps "C-x (" and "C-x )" Kritixi Lithos
@ 2019-12-28 15:46 ` Andreas Schwab
2019-12-28 17:24 ` Eli Zaretskii
2019-12-28 19:36 ` Kritixi Lithos
0 siblings, 2 replies; 8+ messages in thread
From: Andreas Schwab @ 2019-12-28 15:46 UTC (permalink / raw)
To: Kritixi Lithos; +Cc: 38775
On Dez 28 2019, Kritixi Lithos wrote:
> From `emacs -Q`, I write `(kbd "C-x ( C-d C-x )")` in the buffer, then
> evaluate it using `C-M-x`, which gives "^D" instead of the expected
> "^X(^D^X)".
That's because kbd is just a wrapper around read-kbd-macro.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#38775: (kbd "C-x ( ... C-x )") gulps "C-x (" and "C-x )"
2019-12-28 15:46 ` Andreas Schwab
@ 2019-12-28 17:24 ` Eli Zaretskii
2019-12-28 19:36 ` Kritixi Lithos
1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2019-12-28 17:24 UTC (permalink / raw)
To: Andreas Schwab; +Cc: kritixilithos, 38775
> From: Andreas Schwab <schwab@linux-m68k.org>
> Date: Sat, 28 Dec 2019 16:46:25 +0100
> Cc: 38775@debbugs.gnu.org
>
> On Dez 28 2019, Kritixi Lithos wrote:
>
> > From `emacs -Q`, I write `(kbd "C-x ( C-d C-x )")` in the buffer, then
> > evaluate it using `C-M-x`, which gives "^D" instead of the expected
> > "^X(^D^X)".
>
> That's because kbd is just a wrapper around read-kbd-macro.
Yes, and FWIW Emacs always worked like that (I checked a far back as
Emacs 23.1).
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#38775: (kbd "C-x ( ... C-x )") gulps "C-x (" and "C-x )"
2019-12-28 15:46 ` Andreas Schwab
2019-12-28 17:24 ` Eli Zaretskii
@ 2019-12-28 19:36 ` Kritixi Lithos
2021-08-30 2:24 ` Lars Ingebrigtsen
2022-05-03 14:21 ` Lars Ingebrigtsen
1 sibling, 2 replies; 8+ messages in thread
From: Kritixi Lithos @ 2019-12-28 19:36 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 38775
> That's because kbd is just a wrapper around read-kbd-macro.
Ah, intended behaviour then, read-kbd-macro's help file documents this
so that resolves the issue. Thank you all for your swift replies.
So how would you solve the original problem of calling emacs
keystrokes with potential keyboard macros inside them?
`command-execute` appears to use `execute-kbd-macro` according to the
source, so trying `command-execute` on each keystroke does not work as
intended with `C-x ( ... C-x )` among the commands.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#38775: (kbd "C-x ( ... C-x )") gulps "C-x (" and "C-x )"
2019-12-28 19:36 ` Kritixi Lithos
@ 2021-08-30 2:24 ` Lars Ingebrigtsen
2022-05-03 14:21 ` Lars Ingebrigtsen
1 sibling, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-30 2:24 UTC (permalink / raw)
To: Kritixi Lithos; +Cc: 38775, Andreas Schwab
Kritixi Lithos <kritixilithos@gmail.com> writes:
> So how would you solve the original problem of calling emacs
> keystrokes with potential keyboard macros inside them?
> `command-execute` appears to use `execute-kbd-macro` according to the
> source, so trying `command-execute` on each keystroke does not work as
> intended with `C-x ( ... C-x )` among the commands.
Good question. More generally, given the textual representations of any
number of Emacs keystrokes, do we have a way to get those replayed
programmatically? I thought we had (on top of `call-last-kbd-macro' or
edmacro), but I can't really find anything now?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#38775: (kbd "C-x ( ... C-x )") gulps "C-x (" and "C-x )"
2019-12-28 19:36 ` Kritixi Lithos
2021-08-30 2:24 ` Lars Ingebrigtsen
@ 2022-05-03 14:21 ` Lars Ingebrigtsen
2022-05-03 14:39 ` Kritixi Lithos
1 sibling, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-03 14:21 UTC (permalink / raw)
To: Kritixi Lithos; +Cc: eliz, 38775, Andreas Schwab
Kritixi Lithos <kritixilithos@gmail.com> writes:
> So how would you solve the original problem of calling emacs
> keystrokes with potential keyboard macros inside them?
> `command-execute` appears to use `execute-kbd-macro` according to the
> source, so trying `command-execute` on each keystroke does not work as
> intended with `C-x ( ... C-x )` among the commands.
I've now fixed this in Emacs 29. `key-parse' now returns [24 40 4 24
41] for that sequence, while `kbd' maintains the backwards-compat code.
(This has been broken for half a year and nobody noticed -- in Emacs 29,
(kbd "C-x ( C-d C-x )") returned "" instead of "^D", so it's debatable
whether it makes sense to keep the compat code, but at least we do for
now.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <<783E4006-081B-404D-A606-30862A0BA1CF@gmail.com>]
end of thread, other threads:[~2022-05-03 14:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-28 15:12 bug#38775: (kbd "C-x ( ... C-x )") gulps "C-x (" and "C-x )" Kritixi Lithos
2019-12-28 15:46 ` Andreas Schwab
2019-12-28 17:24 ` Eli Zaretskii
2019-12-28 19:36 ` Kritixi Lithos
2021-08-30 2:24 ` Lars Ingebrigtsen
2022-05-03 14:21 ` Lars Ingebrigtsen
2022-05-03 14:39 ` Kritixi Lithos
[not found] <<783E4006-081B-404D-A606-30862A0BA1CF@gmail.com>
[not found] ` <<87woagzc4u.fsf@igel.home>
[not found] ` <<83mubcnz16.fsf@gnu.org>
2019-12-28 18:22 ` Drew Adams
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.