From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ramesh Nedunchezian Newsgroups: gmane.emacs.bugs Subject: bug#60980: FR: It would be useful to have a repeat-exit-function for a repeat-map Date: Sun, 12 Feb 2023 10:28:29 +0530 Message-ID: References: <864js8jsx2.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------OROXq1od3OZcw4GvOUgmKOES" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21956"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Cc: 60980@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 12 05:59:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pR4SN-0005bZ-Gb for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Feb 2023 05:59:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pR4S8-0007Bz-5L; Sat, 11 Feb 2023 23:59:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pR4S6-0007BW-EE for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2023 23:59:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pR4S5-0005EZ-Uy for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2023 23:59:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pR4S5-0001eH-Rq for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2023 23:59:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ramesh Nedunchezian Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Feb 2023 04:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60980 X-GNU-PR-Package: emacs Original-Received: via spool by 60980-submit@debbugs.gnu.org id=B60980.16761779346321 (code B ref 60980); Sun, 12 Feb 2023 04:59:01 +0000 Original-Received: (at 60980) by debbugs.gnu.org; 12 Feb 2023 04:58:54 +0000 Original-Received: from localhost ([127.0.0.1]:43755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pR4Rx-0001ds-VW for submit@debbugs.gnu.org; Sat, 11 Feb 2023 23:58:54 -0500 Original-Received: from mail-tyzapc01olkn2014.outbound.protection.outlook.com ([40.92.107.14]:56920 helo=APC01-TYZ-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pR4Rv-0001dd-Nd for 60980@debbugs.gnu.org; Sat, 11 Feb 2023 23:58:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TWUtXFhfp/WeKrcYQe/SI0tGbxY3xn4Lz09kTo9yjECwcsc0ylHcZ9SxRy08J7AUAdvTVBdyLk67rjDq65pEWg/qwRK1NTUcx501huyHf/jVny93YGgvt+mX6h/RQ19r4NopqAVjlEVQmdquHhBiRIdVRQYdGu9n91shrv/4huoyFeFAn0/5BK22MqNApdpvrNsn42flikOSPNYCrL/unMlkWbyu3ReXY+3A0ZVHkUtTxb2pdcBTvFPRzXM+RH20ooADKD4qom6rNsZO/KZo3OdeQn6xouRQbJbMxFsOOTavqoEFljmZkDvgb+redSPLcMu2pdI/8fL+H8oMxx3NaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5koA/tBm9jFPv4RVX5DfDlIJWT3ZPB4j8VAebVGu9qI=; b=GPCWOy2okF0emQBSK5XIA0n8d3EZs+GytyzCR7D9mcFWXVlj4hLCVMGGcb2oln36KwlvabqRbo/kX32NiD4QoiP4Rxs3MlVWQuyUQpPwcHhXPlvU1JuEiiDNxSun87H7BG6YDyZ6soB3YvatVAReNxwuqYg+eASSOzXoS2A97g1cq79auFxAaFxN4FZDfQV4lWvtEybMJkwsy0vdAyuuG/t9YQHgob8y+x13ebN+6NsIG2QDCGhjNaaCgQUEJrQhBtLJCMdAexmRdln0lBlLXufXv2MljrGN1UDw0zAmWGwH87SBH/3pNWUgQexU3UbGkUzY4ctu6y3DuDDU7N8sqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5koA/tBm9jFPv4RVX5DfDlIJWT3ZPB4j8VAebVGu9qI=; b=snQdg1wIFmcud4eG73e794Pg3MPyn1e0MhOfP4VPACgSifjecTqpLtqew+Ws4c2Foo1suM/cdLZS4oXyovPfapB896eC2MN1Ezho6x45kEpls6t/bvVfPM4XLM+s3H7hybAmEUasDU8o9ScwidpK5Qs+RWvy4kICwIWl8+v3UVOuQXrDUSV/EEZDGyMyiscn4uxrBRm185Sfr4Lm+5CcekDFepfSu6nQhu7kiEUilJdCut6Xe1X0nKd6GIU/NeXo5ioTN5SNf2cMBRlEY6v76dylLy0MBDxeVr5prD5kMGmmAxwKO4AP0GIWTpwUQofxD7JQJTCM/pQJxpWKnzle1g== Original-Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) by KL1PR01MB5090.apcprd01.prod.exchangelabs.com (2603:1096:820:c8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.22; Sun, 12 Feb 2023 04:58:43 +0000 Original-Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::7d05:20af:9fed:2935]) by TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::7d05:20af:9fed:2935%5]) with mapi id 15.20.6086.022; Sun, 12 Feb 2023 04:58:41 +0000 Content-Language: en-US In-Reply-To: <864js8jsx2.fsf@mail.linkov.net> X-TMN: [eqJEFNhVgJwJp/Bj0Sa5RrB9hvd3qW68] X-ClientProxiedBy: MA0PR01CA0075.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:ad::16) To TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) X-Microsoft-Original-Message-ID: <9b1b2ccf-246f-b96a-981e-cd09493744b0@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY2PR0101MB3693:EE_|KL1PR01MB5090:EE_ X-MS-Office365-Filtering-Correlation-Id: fe970e47-f3fa-4b7a-f38d-08db0cb5cf8c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bqiYi1kgt59csYC/e8o+RaUvhWDMtFXlXAtgvxRk01VFzCTs9b2YVDxt+QUBFsicg1WkRa1UlmO5PKHgrES0w2J9JG6g7Nm+X7Dbmw36NyqNduqI3QEdQofk7HRCjbF03ox3/zR9avEL6uv2g63OBxnpP7+skBh4dxT7dBIHWmzw/xKE8Zzz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R1CsJLYsrEpvWqCSUvZgUBKnMSP+rVygIjgwat/5GlubNF6L6gvVFfGzHVZ96bL/4O0zfV0hEpZ11rQZSuqcySJbHZPFS8HS3PuU/cKtpQ07U4CCSrmtBsQmleK8umU6AFGwUJx6tiHLaV5tYmyeUCsQFH4H0VWoZeDr/oFLi0m8ese9UNDe/deCU0K7Ou3BDUt+eCRl/mBUmz95hejnJEcXJCAHs5XB0lOdUDciQtNPynl4UTvlwNWYrgySXGaORfxCSGrw1U2NsOXV0SEX9254f7jFDBW4xACnXgqss9ThNKMNU0 l50MJ2DgGf7nmxau/sOIP92uwwiQw/mc1Kn6/EgYeN7PcO8Bc+LSFBzXRW/emM3e2LjFch0f8q/GIKB/tSkQIbjCjfoImiLgN1 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe970e47-f3fa-4b7a-f38d-08db0cb5cf8c X-MS-Exchange-CrossTenant-AuthSource: TY2PR0101MB3693.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2023 04:58:41.6908 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR01MB5090 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255369 Archived-At: --------------OROXq1od3OZcw4GvOUgmKOES Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 30/01/23 13:59, Juri Linkov wrote: > Thanks for the feature request. > >> What I need from repeat.el >> ================ >> When I exit the repeat map---for example when I press in the video, >> and leave the "navigation mode" to "edit mode"---I want to unhighight the thing. >> That is I propose that there be a provision in `repeat.el` to associate >> an `exit-function` with a repeatable map >> (put 'thing-sexp-map 'repeat-exit-function 'thing-unhighlight) > The problem with the symbol property name `repeat-exit-function` is that > the existing variable `repeat-exit-function` has another purpose. > > For example, for `repeat-exit-timeout` there is the global variable > and the symbol property with the same names because they are doing > the same thing. > > But the variable `repeat-exit-function` is different. It's not > customizable by the user. So another name would be preferable. > >> Additional Note >> ========== >> If you squint a bit, `repeat-echo-function` is an `exit-function` >> ... but the problem is it doesn't provide what map is being exited. >> See bug#60353: 30.0.50; Make `repeat-echo-function` as a LIST of functions > Indeed, before adding a new symbol property could you please try to use > the existing `repeat-echo-function`. It's called with the nil argument > on exit. Do you need a symbol property `repeat-echo-function`, or can use > the global variable, e.g. by checking some buffer-local variable in it? I don't need exit function per-map. I can use the "global" `repeat-echo-function' to clean up after the `repeat-map`'s exit, like this: (add-function :after repeat-echo-function (defun thing-exit-function (keymap) (cond (keymap (ignore)) (t (thing-unhighlight))))) You have addressed my main concern. You may close the bug. Some remarks. 1. You may consider introducing a `repeat-enter/leave-function`---globally, AND per-map--- and plugin the existing `repeat-echo-function` in to that. IOW, the "existing" `repeat-echo-function` is a generic enter/leave dispatcher for all `repeat-maps`. 2. (I believe) introducing an "enter"/"leave" function per-repeat map is a much cleaner approach, and could be put to good use by users. FWIW, the video I linked https://github.com/rnchzn/scratch/issues/1 is my own take on what `objed` (https://github.com/clemera/objed) does. --------------OROXq1od3OZcw4GvOUgmKOES Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit


On 30/01/23 13:59, Juri Linkov wrote:
Thanks for the feature request.

What I need from repeat.el
================
When I exit the repeat map---for example when I press <return> in the video,
and leave the "navigation mode" to "edit mode"---I want to unhighight the thing.
That is I propose that there be a provision in `repeat.el` to associate
an `exit-function` with a repeatable map
(put 'thing-sexp-map 'repeat-exit-function 'thing-unhighlight)
The problem with the symbol property name `repeat-exit-function` is that
the existing variable `repeat-exit-function` has another purpose.

For example, for `repeat-exit-timeout` there is the global variable
and the symbol property with the same names because they are doing
the same thing.

But the variable `repeat-exit-function` is different.  It's not
customizable by the user.  So another name would be preferable.

Additional Note
==========
If you squint a bit, `repeat-echo-function` is an `exit-function`
... but the problem is it doesn't provide what map is being exited.
See bug#60353: 30.0.50; Make `repeat-echo-function` as a LIST of functions
Indeed, before adding a new symbol property could you please try to use
the existing `repeat-echo-function`.  It's called with the nil argument
on exit.  Do you need a symbol property `repeat-echo-function`, or can use
the global variable, e.g. by checking some buffer-local variable in it?
I don't need exit function per-map.

I can use the "global" `repeat-echo-function' to clean up after the
`repeat-map`'s exit, like this:

    (add-function
     :after repeat-echo-function
     (defun thing-exit-function (keymap)
       (cond
        (keymap (ignore))
        (t (thing-unhighlight)))))


You have addressed my main concern.  You may close the bug.
    

Some remarks.

1. You may consider introducing a
   `repeat-enter/leave-function`---globally, AND per-map--- and plugin
   the existing `repeat-echo-function` in to that.

   IOW, the "existing" `repeat-echo-function` is a generic enter/leave
   dispatcher for all `repeat-maps`.
   
2. (I believe) introducing an "enter"/"leave" function per-repeat map
   is a much cleaner approach, and could be put to good use by users.

FWIW, the video I linked https://github.com/rnchzn/scratch/issues/1 is
my own take on what `objed` (https://github.com/clemera/objed) does.


--------------OROXq1od3OZcw4GvOUgmKOES--