GNU bug report logs - #60980
FR: It would be useful to have a repeat-exit-function for a repeat-map

Previous Next

Package: emacs;

Reported by: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>

Date: Sat, 21 Jan 2023 08:43:01 UTC

Severity: wishlist

Full log


Message #14 received at 60980 <at> debbugs.gnu.org (full text, mbox):

From: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 60980 <at> debbugs.gnu.org
Subject: Re: 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 part 1 (text/plain, inline)]
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.

[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.