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

To reply to this bug, email your comments to 60980 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60980; Package emacs. (Sat, 21 Jan 2023 08:43:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 21 Jan 2023 08:43:01 GMT) Full text and rfc822 format available.

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

From: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Juri Linkov <juri <at> linkov.net>
Subject: FR: It would be useful to have a repeat-exit-function for a repeat-map
Date: Sat, 21 Jan 2023 14:07:31 +0530
[Message part 1 (text/plain, inline)]
FR: It would be useful to have a repeat-exit-function for a repeat-map


Overview of `thing.el`

==============


The attached file `thing.el`

- allows navigation by "thing"

- highlights the thing that is being navigated

- you can switch to a "parent thing" while navigating a "thing"


Video Demo of `thing.el`

===============


See the video https://github.com/rnchzn/scratch/issues/1 as I test drive `thing.el`. 

The right window shows the `*lossage*` buffer, and it updates as I run commands.


What happens in the Video

=================


In the context of the above video, I start navigating the `symbol` thing, and switch to  the `sexp / list` thing (`sexp / list` is the parent of `symbol` thing)


Additional details on `thing.el`

===================


I am using s-i, s-j, s-k and s-l as <up>, <left>, <down> and <right> keys using `input-decode-map`.


There are four keymaps.

- s-l and s-j are prefix keys that invoke `forward-thing-map` and `backward-thing-map`.

- The `thing-symbol-map` has `symbol` commands.

- The `thing-sexp-map` has `sexp` commands.


When `thing-symbol-map` is active you can press <up> or s-i to move to `thing-sexp-map`.


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)


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













[thing.el (text/x-emacs-lisp, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60980; Package emacs. (Sat, 21 Jan 2023 08:48:02 GMT) Full text and rfc822 format available.

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

From: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>
To: 60980 <at> debbugs.gnu.org
Subject: Re: bug#60980: Acknowledgement (FR: It would be useful to have a
 repeat-exit-function for a repeat-map)
Date: Sat, 21 Jan 2023 14:16:52 +0530
[Message part 1 (text/plain, inline)]
I am attaching the `*lossage*` file generated by the video recording at https://github.com/rnchzn/scratch/issues/1



[lossage.txt (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60980; Package emacs. (Mon, 30 Jan 2023 09:09:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>
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: Mon, 30 Jan 2023 10:29:30 +0200
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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60980; Package emacs. (Sun, 12 Feb 2023 04:59:01 GMT) Full text and rfc822 format available.

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)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60980; Package emacs. (Sun, 12 Feb 2023 17:24:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Ramesh Nedunchezian <rameshnedunchezian <at> outlook.com>
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 19:23:30 +0200
> 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.

Thanks for the ideas.  I'll leave this feature request open for some time
to see if we could implement such a global and keymap-local hooks to run
on entering/leaving the repeating sequence.

> 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.

The video looks nice, so you may consider creating a new package that
will do something like `objed` does, but with using `repeat-mode`.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60980; Package emacs. (Mon, 13 Feb 2023 17:48:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: 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: Mon, 13 Feb 2023 19:47:09 +0200
> 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.

This internal variable is renamed now in emacs-29.
So in master we could use this name to implement new feature.




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.