From: "T.V Raman" <raman@google.com>
To: Juri Linkov <juri@linkov.net>
Cc: Ergus <spacibba@aol.com>,
Zhiwei Chen <chenzhiwei03@kuaishou.com>,
emacs-devel <emacs-devel@gnu.org>
Subject: Re: Repeat lambda
Date: Tue, 13 Apr 2021 16:45:37 -0700 [thread overview]
Message-ID: <p91blahg34u.fsf@google.com> (raw)
In-Reply-To: <87fszuov1u.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 13 Apr 2021 22:35:25 +0300")
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1879 bytes --]
Juri Linkov <juri@linkov.net> writes:
You can do all this with a few lines of hydra,
a undo/redo hydra that gets launched with C-x u, and then -- u and U
trigger the two heads in the hydra.
>>> 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?
>
> Since there is no key to initiate an undo-redo sequence,
> re the comment in bindings.el:
>
> ;; Richard said that we should not use C-x <uppercase letter> and I have
> ;; no idea whereas to bind it. Any suggestion welcome. -stef
> ;; (define-key ctl-x-map "U" 'undo-only)
>
> Maybe 'C-x u u' could start such key sequence with the command 'undo',
> then 'r' could switch to a different keymap
> where 'r' is bound to 'undo-redo' and 'u' to 'undo-only'.
> Perhaps such heuristics makes sense that once the user typed 'r',
> the next 'u' should do 'undo-only'?
>
> #+begin_src emacs-lisp
> (defvar undo-repeat-map
> (let ((map (make-sparse-keymap)))
> (define-key map "u" 'undo)
> (define-key map "r" 'undo-redo)
> map)
> "Keymap to repeat undo key sequences `C-x u u'. Used in `repeat-mode'.")
> (put 'undo 'repeat-map 'undo-repeat-map)
>
> (defvar undo-redo-repeat-map
> (let ((map (make-sparse-keymap)))
> (define-key map "r" 'undo-redo)
> (define-key map "u" 'undo-only)
> map)
> "Keymap to repeat undo-redo key sequences. Used in `repeat-mode'.")
> (put 'undo-redo 'repeat-map 'undo-redo-repeat-map)
> (put 'undo-only 'repeat-map 'undo-redo-repeat-map)
> #+end_src
>
--
Thanks,
--Raman
7©4 Id: kg:/m/0285kf1 0Ü8
next prev parent reply other threads:[~2021-04-13 23:45 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-14 22:51 Some minor suggestions to Tab Bar Gabriel
2021-03-15 9:24 ` Juri Linkov
2021-03-15 17:25 ` Juri Linkov
2021-03-17 17:46 ` Juri Linkov
2021-03-17 22:31 ` Ergus
2021-03-18 9:20 ` Juri Linkov
2021-03-19 0:28 ` Gabriel
2021-03-22 11:07 ` Zhiwei Chen
2021-03-22 18:47 ` Juri Linkov
2021-03-23 12:17 ` Zhiwei Chen
2021-03-23 18:30 ` Repeat lambda (was: Some minor suggestions to Tab Bar) Juri Linkov
2021-03-26 6:00 ` Zhiwei Chen
2021-03-29 19:28 ` Repeat lambda Juri Linkov
2021-04-05 21:03 ` Juri Linkov
2021-04-11 23:40 ` Ergus
2021-04-12 2:25 ` Zhiwei Chen
2021-04-12 16:32 ` Juri Linkov
2021-04-13 19:35 ` Juri Linkov
2021-04-13 23:45 ` T.V Raman [this message]
2021-04-14 17:51 ` Juri Linkov
2021-04-14 5:37 ` Richard Stallman
2021-04-14 7:18 ` peat lambda Kévin Le Gouguec
2021-04-14 7:59 ` Repeat lambda Kévin Le Gouguec
2021-04-16 5:10 ` peat lambda Richard Stallman
2021-04-14 17:56 ` Repeat lambda Juri Linkov
2021-04-15 5:24 ` Richard Stallman
2021-04-05 21:19 ` Some minor suggestions to Tab Bar Juri Linkov
2021-04-06 3:16 ` Zhiwei Chen
2021-03-24 20:19 ` Juri Linkov
2021-03-25 0:47 ` Gabriel
2021-03-25 9:31 ` Juri Linkov
2021-03-26 5:52 ` Gabriel
2021-03-29 19:20 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=p91blahg34u.fsf@google.com \
--to=raman@google.com \
--cc=chenzhiwei03@kuaishou.com \
--cc=emacs-devel@gnu.org \
--cc=juri@linkov.net \
--cc=spacibba@aol.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).