From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T.V Raman" Newsgroups: gmane.emacs.devel Subject: Re: Repeat lambda Date: Tue, 13 Apr 2021 16:45:37 -0700 Message-ID: References: <87o8fhekvx.fsf@mail.linkov.net> <385DDC1B-F508-4165-87FD-FFE2461348A6@kuaishou.com> <87ft0nyrfb.fsf@mail.linkov.net> <87blb969vc.fsf_-_@mail.linkov.net> <8FE23CF4-90D9-4633-9CCF-B1FDD24DABCE@kuaishou.com> <87mtul7tcs.fsf@mail.linkov.net> <87tuokjvf3.fsf@mail.linkov.net> <20210411234042.mls4zqid47zwlty3@Ergus> <87mtu3wjjf.fsf@mail.linkov.net> <87fszuov1u.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=gb18030 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24839"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Ergus , Zhiwei Chen , emacs-devel To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 14 01:46:31 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lWSjn-0006Mu-KD for ged-emacs-devel@m.gmane-mx.org; Wed, 14 Apr 2021 01:46:31 +0200 Original-Received: from localhost ([::1]:36818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWSjm-00017T-K6 for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Apr 2021 19:46:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWSj1-0000bY-De for emacs-devel@gnu.org; Tue, 13 Apr 2021 19:45:43 -0400 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:44758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lWSiz-0000hg-Ox for emacs-devel@gnu.org; Tue, 13 Apr 2021 19:45:43 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id d8so9087073plh.11 for ; Tue, 13 Apr 2021 16:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Y0+6I+T/UyPiKfYCkKyo1B+/11O095WSWYXtqJg31zo=; b=UP2MIjgKVI7E9QuUbyZZuRiV8hoIsaycRxn14XOTFRkOk5LoOPLsThJY0uLtJd4FiX ggz1DtdfFCjwRNt/GQ5wI8v4Lq0gI/T2HoxgoBhlnXIETnViYRhYArkmd3OiOoY1uBo6 oXY9IIMJDQIzBk6CsERYtNERHS+Q+cEJen1kZRgx405J2jfyUcYI40Lm6Vxzscpyverv KjHbCNm8eiJEAhA8SBVb6xdQ4Nz6uymNTBiYsfQDNZio6PxrnK//WAJ8H1E2i7IgUxtr EhumznrZeLE4WZ7cfEv6gJhqMAfhlajMEt1oxxlOwo2nNO2vlyC6fqjXupUxEu5BeuXK 5lQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Y0+6I+T/UyPiKfYCkKyo1B+/11O095WSWYXtqJg31zo=; b=YHSt1Jc04L/2Pzfk8xklJWCncbq8MXqxv0NckAPfVyjjNwTE0eHSFXmEepav9YrDHQ YJnBPaPFcmgiVMvt7Qz4EjTk6SNEAAKDAKrl6XkQw7jY7IbOPS80gpcq9glInpp+aAXt 5MFQ4XUQkcY7pzLS1HoYxoLDdSWuQvZaEncOWs12j2lIZ7QICli2kQHLTor/9A2MiC+h SQySPNch3isHoAq74oDV1dmQFjEeYPp7aNEnH9zv+aW6EThl70mZxSKBhpVMZaoy2jrU zDUUKFxHUR9FexIM434J3RZ9fPRMNbj5k3LPB+SbzI+EQUhSANBEzxTT3DcFV5wUlp4u 85gQ== X-Gm-Message-State: AOAM5302Yx+a6Vrg14oPLGAqbzcnQEjfroWBy6qvSKG4Wis1VSCmxM2S 89lqqdS9Nb0wtea9JjGajEKy5A== X-Google-Smtp-Source: ABdhPJyaSZwr4K/7/3x3Gf30JuZaBmWhaNfVqxIFl9/9mLL8mA0hMEhkdrVLlzFfsSc8HpKAEuoSEg== X-Received: by 2002:a17:90b:164d:: with SMTP id il13mr237547pjb.167.1618357538998; Tue, 13 Apr 2021 16:45:38 -0700 (PDT) Original-Received: from raman-glaptop.localdomain (c-24-4-174-65.hsd1.ca.comcast.net. [24.4.174.65]) by smtp.gmail.com with ESMTPSA id v8sm12853038pfm.128.2021.04.13.16.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 16:45:38 -0700 (PDT) Original-Received: by raman-glaptop.localdomain (Postfix, from userid 13930) id 1C993C2128B; Tue, 13 Apr 2021 16:45:37 -0700 (PDT) In-Reply-To: <87fszuov1u.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 13 Apr 2021 22:35:25 +0300") Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=raman@google.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:268016 Archived-At: Juri Linkov 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 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 > --=20 Thanks, --Raman =817=A94 Id: kg:/m/0285kf1 =950=DC8