unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46290: 28.0.50; repeat's ability to repeat complex commands is broken
@ 2021-02-04  7:56 Sean Whitton
  2021-02-04  8:30 ` Gregory Heytings
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Whitton @ 2021-02-04  7:56 UTC (permalink / raw)
  To: 46290

Hello,

In the definition of `repeat' there is

    (if (memq last-repeatable-command '(exit-minibuffer
                                        minibuffer-complete-and-exit
                                        self-insert-and-exit)
            (let ((repeat-command (car command-history)))
              (repeat-message "Repeating %S" repeat-command)
              (eval repeat-command))
          (if (null repeat-arg)
              (repeat-message "Repeating command %S" last-repeatable-command)
            (setq current-prefix-arg repeat-arg)
            (repeat-message
             "Repeating command %S %S" repeat-arg last-repeatable-command))
          ...)

In the "Repeating %S" branch, the idea seems to be that if the previous
command took minibuffer input, then repeat it again without prompting
for input by looking at command-history -- like typing C-x M-: RET.
Otherwise, in the "Repeating command %S" branch, just repeat what's in
last-repeatable-command.

Firstly, I note that there are some additional functions that ought to
go into the list of minibuffer-exiting functions --
read-char-from-minibuffer-insert-char and read--expression-try-read are
two I've found so far.  It's suggested in bug#5264 that this be a defvar.

But secondly, it doesn't seem like the "Repeating %S" branch works at
all.  For if you type M-! date RET C-x z then you get prompted for a
shell command, rather than date(1) just getting executed again right
away.

I added some debug printing to `repeat' and found that after M-! date
RET, last-repeatable-command is set to shell-command, not
exit-minibuffer.  So perhaps the way that last-repeatable-command gets
set has changed since this code in repeat.el was written?

Or does the "Repeating %S" branch have some completely different purpose?

Thanks!

-- 
Sean Whitton





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

* bug#46290: 28.0.50; repeat's ability to repeat complex commands is broken
  2021-02-04  7:56 bug#46290: 28.0.50; repeat's ability to repeat complex commands is broken Sean Whitton
@ 2021-02-04  8:30 ` Gregory Heytings
  2021-02-04 17:47   ` Sean Whitton
  0 siblings, 1 reply; 4+ messages in thread
From: Gregory Heytings @ 2021-02-04  8:30 UTC (permalink / raw)
  To: 46290


>
> But secondly, it doesn't seem like the "Repeating %S" branch works at 
> all.  For if you type M-! date RET C-x z then you get prompted for a 
> shell command, rather than date(1) just getting executed again right 
> away.
>
> I added some debug printing to `repeat' and found that after M-! date 
> RET, last-repeatable-command is set to shell-command, not 
> exit-minibuffer.  So perhaps the way that last-repeatable-command gets 
> set has changed since this code in repeat.el was written?
>

FWIW, the answer to that question seems to be positive.  In Emacs 21 M-! 
date RET C-x z repeats "date" without prompting again, in later Emacsen 
you get prompted again for a shell command.





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

* bug#46290: 28.0.50; repeat's ability to repeat complex commands is broken
  2021-02-04  8:30 ` Gregory Heytings
@ 2021-02-04 17:47   ` Sean Whitton
  2021-02-05  9:06     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Whitton @ 2021-02-04 17:47 UTC (permalink / raw)
  To: Gregory Heytings, 46290

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

On Thu 04 Feb 2021 at 08:30AM GMT, Gregory Heytings wrote:

>>
>> But secondly, it doesn't seem like the "Repeating %S" branch works at 
>> all.  For if you type M-! date RET C-x z then you get prompted for a 
>> shell command, rather than date(1) just getting executed again right 
>> away.
>>
>> I added some debug printing to `repeat' and found that after M-! date 
>> RET, last-repeatable-command is set to shell-command, not 
>> exit-minibuffer.  So perhaps the way that last-repeatable-command gets 
>> set has changed since this code in repeat.el was written?
>>
>
> FWIW, the answer to that question seems to be positive.  In Emacs 21 M-! 
> date RET C-x z repeats "date" without prompting again, in later Emacsen 
> you get prompted again for a shell command.

Ah, thanks for testing.

One possible fix is attached.  It has the advantage of removing the list
which needs to be kept updated, so it works immediately for repeating
M-z and M-:

-- 
Sean Whitton

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-repeat.el-repeat-Fix-repeating-complex-commands.patch --]
[-- Type: text/x-diff, Size: 1006 bytes --]

From 60bde7beb317601c00d075f356a1b89877ad6104 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Thu, 4 Feb 2021 10:42:21 -0700
Subject: [PATCH] * lisp/repeat.el (repeat): Fix repeating complex commands
 (bug#46290)

---
 lisp/repeat.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lisp/repeat.el b/lisp/repeat.el
index d488889348..795577c93f 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -239,9 +239,7 @@ recently executed command not bound to an input event\"."
            (car (memq last-command-event
                       (listify-key-sequence
                        repeat-on-final-keystroke))))))
-    (if (memq last-repeatable-command '(exit-minibuffer
-					minibuffer-complete-and-exit
-					self-insert-and-exit))
+    (if (eq last-repeatable-command (caar command-history))
         (let ((repeat-command (car command-history)))
           (repeat-message "Repeating %S" repeat-command)
           (eval repeat-command))
-- 
2.29.2


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

* bug#46290: 28.0.50; repeat's ability to repeat complex commands is broken
  2021-02-04 17:47   ` Sean Whitton
@ 2021-02-05  9:06     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-05  9:06 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 46290, Gregory Heytings

Sean Whitton <spwhitton@spwhitton.name> writes:

> One possible fix is attached.  It has the advantage of removing the list
> which needs to be kept updated, so it works immediately for repeating
> M-z and M-:

Seems to work fine here for the test cases, so I've pushed it to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-02-05  9:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04  7:56 bug#46290: 28.0.50; repeat's ability to repeat complex commands is broken Sean Whitton
2021-02-04  8:30 ` Gregory Heytings
2021-02-04 17:47   ` Sean Whitton
2021-02-05  9:06     ` Lars Ingebrigtsen

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