all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* dabbrev-expand should escape kbd macros, shouldn't it?
@ 2019-07-17 15:13 Daniel Colascione
  2019-07-17 15:52 ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Colascione @ 2019-07-17 15:13 UTC (permalink / raw)
  To: emacs-devel

Right now, if you record a kbd macro and hit M-/, the act of hitting M-/
is recorded like any other command in the kbd macro. On replay, we'll run
dabbrev-expand. The problem is that dabbrev-expand produces radically
different results depending on buffer context, making macro replay
unpredictable. Should the *result* of dabbrev-expand just get put into the
kbd macro instead?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dabbrev-expand should escape kbd macros, shouldn't it?
  2019-07-17 15:13 dabbrev-expand should escape kbd macros, shouldn't it? Daniel Colascione
@ 2019-07-17 15:52 ` Andreas Schwab
  2019-07-17 17:39   ` Drew Adams
  2019-07-17 18:30   ` Daniel Colascione
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Schwab @ 2019-07-17 15:52 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel

On Jul 17 2019, "Daniel Colascione" <dancol@dancol.org> wrote:

> Right now, if you record a kbd macro and hit M-/, the act of hitting M-/
> is recorded like any other command in the kbd macro. On replay, we'll run
> dabbrev-expand. The problem is that dabbrev-expand produces radically
> different results depending on buffer context, making macro replay
> unpredictable. Should the *result* of dabbrev-expand just get put into the
> kbd macro instead?

How is that different from any other key that is part of the macro?  The
point of a kbd macro is to record keys, not their effect (or even their
binding).

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: dabbrev-expand should escape kbd macros, shouldn't it?
  2019-07-17 15:52 ` Andreas Schwab
@ 2019-07-17 17:39   ` Drew Adams
  2019-07-17 18:30   ` Daniel Colascione
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2019-07-17 17:39 UTC (permalink / raw)
  To: Andreas Schwab, Daniel Colascione; +Cc: emacs-devel

> > Right now, if you record a kbd macro and hit M-/, the act of hitting M-/
> > is recorded like any other command in the kbd macro. On replay, we'll run
> > dabbrev-expand. The problem is that dabbrev-expand produces radically
> > different results depending on buffer context, making macro replay
> > unpredictable. Should the *result* of dabbrev-expand just get put into the
> > kbd macro instead?
> 
> How is that different from any other key that is part of the macro?
> The point of a kbd macro is to record keys, not their effect (or even their
> binding).

+1

A keyboard macro is essentially a command.

You generally want to be able to replay a keyboard macro
(keystrokes) in various contexts.  You generally do not
want to capture the original context as part of the macro.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dabbrev-expand should escape kbd macros, shouldn't it?
  2019-07-17 15:52 ` Andreas Schwab
  2019-07-17 17:39   ` Drew Adams
@ 2019-07-17 18:30   ` Daniel Colascione
  2019-07-18  7:32     ` Andreas Schwab
  2019-07-18 22:22     ` Juri Linkov
  1 sibling, 2 replies; 6+ messages in thread
From: Daniel Colascione @ 2019-07-17 18:30 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Daniel Colascione, emacs-devel

> On Jul 17 2019, "Daniel Colascione" <dancol@dancol.org> wrote:
>
>> Right now, if you record a kbd macro and hit M-/, the act of hitting M-/
>> is recorded like any other command in the kbd macro. On replay, we'll
>> run
>> dabbrev-expand. The problem is that dabbrev-expand produces radically
>> different results depending on buffer context, making macro replay
>> unpredictable. Should the *result* of dabbrev-expand just get put into
>> the
>> kbd macro instead?
>
> How is that different from any other key that is part of the macro?  The
> point of a kbd macro is to record keys, not their effect (or even their
> binding).

Sort of. We make keyboard macros in the first place so we can do a thing
over and over. It turns out that dumbly recording and replaying keystrokes
is a pretty good strategy for lightweight automation. But dumb key
recording doesn't work well in some cases, and dabbrev is one of those. I
use dabbrev because I want to insert a specific string, cycling through
alternatives until I find the one I want. That's going to produce
different results on different occasions. Most of the time, recorded
keystrokes in macros aren't that sensitive to _temporal_ and _interbuffer_
context, and dabbrev is, so I think we should make an exception for
dabbrev.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dabbrev-expand should escape kbd macros, shouldn't it?
  2019-07-17 18:30   ` Daniel Colascione
@ 2019-07-18  7:32     ` Andreas Schwab
  2019-07-18 22:22     ` Juri Linkov
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2019-07-18  7:32 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel

You can edit the kbd macro if you want to do something different from
what you typed.  But the macro recorder doesn't even *know* what is
being executed.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dabbrev-expand should escape kbd macros, shouldn't it?
  2019-07-17 18:30   ` Daniel Colascione
  2019-07-18  7:32     ` Andreas Schwab
@ 2019-07-18 22:22     ` Juri Linkov
  1 sibling, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2019-07-18 22:22 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: Andreas Schwab, emacs-devel

> Most of the time, recorded keystrokes in macros aren't that sensitive
> to _temporal_ and _interbuffer_ context, and dabbrev is, so I think we
> should make an exception for dabbrev.

Recently I had the same thoughts when a kbd macro recorded the paste
keystroke and not the text it pasted (as a sequence of self-inserting
keys).  I know that it records just plain keystrokes, but in that context
the result was unexpected.  However, I don't think that pasting should be
an exception.  Maybe keyboard macros should provide a special macro-escape
feature (like there is a macro-query feature available via ‘C-x q’) to ask
whether to record the keystroke literally or to record the effect of
the command.

This ambiguity demonstrates why it's impossible to implement a package
that would convert keyboard macros to programs - because there are too
many logical levels of how the result of every keystroke can be interpreted
depending on expectancy even of the same user in different contexts.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-07-18 22:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-17 15:13 dabbrev-expand should escape kbd macros, shouldn't it? Daniel Colascione
2019-07-17 15:52 ` Andreas Schwab
2019-07-17 17:39   ` Drew Adams
2019-07-17 18:30   ` Daniel Colascione
2019-07-18  7:32     ` Andreas Schwab
2019-07-18 22:22     ` Juri Linkov

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.