emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repeat lambda


From: Zhiwei Chen
Subject: Re: Repeat lambda
Date: Mon, 12 Apr 2021 02:25:55 +0000

According to other-window-repeat-map:

(defvar other-window-repeat-map
  (let ((map (make-sparse-keymap)))
    (define-key map "o" 'other-window)
    (define-key map "O" (lambda ()
                          (interactive)
                          (setq repeat-map 'other-window-repeat-map)
                          (other-window -1)))
    map)
  "Keymap to repeat other-window key sequences.  Used in `repeat-mode'.")
(put 'other-window 'repeat-map 'other-window-repeat-map)

It can be done in a lambda that set `repeat-map’.

> On Apr 12, 2021, at 7:40 AM, Ergus <spacibba@aol.com> wrote:
> 
> Hi Juri:
> 
> Now playing with the repeat mode I have a small issue.
> 
> I see that You bind `C-x u` as a repeat command, but in my case I have
> undo-only. The repeat transient map still uses the normal undo BUT maybe
> there is a "simple" method (in the user config of course) to make u u u
> use the undo-only and (as a plus) make r r r to do undo-redo?
> 
> I suppose that this only needs some define-key like below?
> 
> Best, and thanks in advance,
> Ergus
> 
> On Tue, Apr 06, 2021 at 12:03:44AM +0300, Juri Linkov wrote:
>>> But maybe we could allow the command to set its next repeat-map explicitly:
>>> 
>>>  (define-key map "O" (lambda ()
>>>                        (interactive)
>>>                        (setq repeat-map 'other-window-repeat-map)
>>>                        (other-window -1)))
>>> 
>>> with such patch:
>> 
>> This is pushed now in 15de559d98.
>> 
>> Additionally, there is a new option 'repeat-keep-prefix' to keep the
>> prefix arg of the previous command.  For example, this can help to
>> reverse direction with e.g. 'C-x o M-- o o'.  Also it can help to set
>> a new step e.g. 'C-x { C-5 { { {' or 'C-5 C-x { { {' will set the
>> window resizing step to 5.
>> 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]