all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Juri Linkov <juri@jurta.org>
Cc: "Gauthier Östervall" <gauthier@ostervall.se>, emacs-devel@gnu.org
Subject: RE: [PATCH] Make `C-x {' and `C-x }' repeatable
Date: Wed, 22 May 2013 14:39:14 -0700 (PDT)	[thread overview]
Message-ID: <f6fd5caa-ecff-406d-8a48-9fae808fdc66@default> (raw)
In-Reply-To: <87r4gyondh.fsf@mail.jurta.org>

> I don't know why a prefix arg exits temporary-overlay-map.  Trying to
> (define-key window-size-adjust-keymap [?\C-u] 'universal-argument)
> doesn't help to fix this.  `C-u' still terminates the key sequence
> `C-x } } } } C-u }'.

Dunno.  But anyway, as I said, the typical use case for repetition (at least for me) would reuse the same prefix-arg value given to the prefix key.  IOW, I would typically not want to use a different prefix value for one occurrence of repetition from another.

Or at least I would not want to be *obliged* to repeat the prefix arg each time I repeated the final key.  And I think that is what your approach amounts to (assuming you can fix it so a prefix arg does not exit the map).

It would be OK for a user to be *able* to employ a new prefix arg along the way, for a one-off final-key occurrence.  But you wouldn't want to be forced to keep providing a prefix arg for each final-key repetition. 

> > I want to have a repeatable command bound to a key on `isearch-mode-map'.
> 
> In bug#10654 I proposed a patch that implements repeatable keys for Isearch
> e.g. `M-s C-f C-f M-f C-f ...'

Yes, I saw that.  Good.  I would still prefer a simpler approach.  You are essentially requiring each repeatable command to set variables `isearch-repeat-command' and `isearch-repeat-key'.  (That might be similar to the older approach used in repeat.el - dunno.)

I would prefer something simpler, using either an approach like `set-temporary-overlay-map' (which you proposed for this thread) or an approach like `repeat-command' (which I mentioned).  Both of those allow for short, simple & clear command definitions.

The former has the advantage that you can define the map to include a set of keys, any of which can be the repeatable final key (mix & match within the set).

Of course it means creating a different map for each such set of keys.  E.g., if you want several such sets on the same key prefix, but you want them to be separate - so that, e.g., you could repeat with `C-x a b c a b b' or with `C-x m m o n o o', but not with `C-x a b m a n'.

And you would need to use a singleton map if you wanted a singleton final-key set.  E.g, if you want to get the effect that repeat.el provides of allowing `C-x a a a a' and `C-x b b b', but not C-x a b b a, then you would need two singleton keymaps.

IOW, it is good to be able to define sets of final keys that work together, repeating any of them without needing to repeat the prefix key.  Code that lets you do that simply, even for the singleton set case, and preferably without needing to define multiple global vars, would be preferable.

FWIW, I have all of these "yank" keys on prefix `C-y' in Isearch:

`C-y C-('    `isearchp-yank-sexp-symbol-or-char'
`C-y C-2'    `isearch-yank-secondary'
`C-y C-c'    `isearchp-yank-char'
`C-y C-e'    `isearchp-yank-line'
`C-y C-w'    `isearchp-yank-word-or-char'
`C-y C-y'    `isearch-yank-kill'
`C-y M-y'    `isearch-yank-pop'

5 of those commands are repeatable.  But because I use `repeat-command' to implement this, you cannot mix and match these within the same `C-y' occurrence: each is separately repeatable (e.g., `C-y C-e C-e... C-y C-w C-w' is OK, but not `C-y C-e C-e C-w C-w').

(And anyway, the repeatable Isearch commands have stopped working because of bug #14095.)

> Maybe a better implementation would be with the help of
> `set-temporary-overlay-map'.

Only, I think, if bug #14095 gets fixed.  I think it's the same problem.

The problem that bug #14095 points out is that `set-temporary-overlay-map' does not work with Isearch because its map does not override the map used by Isearch.  `overriding(-terminal)-local-map' (used by Isearch) overrules the temporary map used by `set-temporary-overlay-map'.

> I'll try to do this for Isearch.

See previous.  AFAICT, it won't work to use `set-temporary-overlay-map' there, unless bug #14095 is fixed.

> But it seems repeat.el can't be used if there are different commands
> in the key sequence.

No (i.e., correct), at least not the way I did it.

I thought for a moment that perhaps one could somehow leverage a sequence value of `repeat-on-final-keystroke', to allow such behavior, but I guess not.  Too bad.  I guess that's only for allowing multiple "alias" keys for the *same* repeatable command (not for multiple commands intended to be used together).

(And I'm not even sure how you would use that option for keys such as <right>.  Any idea?  I tried fiddling with option values but couldn't make it work.  And why the doc speaks of "characters" instead of keys, I don't know.)



  reply	other threads:[~2013-05-22 21:39 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 19:59 [PATCH] Make `C-x {' and `C-x }' repeatable Gauthier Östervall
2013-05-21  9:58 ` Vitalie Spinu
2013-05-21 13:53   ` Gauthier Östervall
2013-05-21 18:34 ` Juri Linkov
2013-05-22 17:44   ` Drew Adams
2013-05-22 18:55     ` Juri Linkov
2013-05-22 21:39       ` Drew Adams [this message]
2013-05-22 22:08         ` Stefan Monnier
2013-05-22 23:53           ` Drew Adams
2013-05-23  0:18             ` chad
2013-05-23 16:19               ` Drew Adams
2013-05-23 16:48                 ` Stefan Monnier
2013-05-23 19:52                   ` Drew Adams
2013-05-24  4:53                     ` Stephen J. Turnbull
2013-05-24 15:55                       ` Drew Adams
2013-05-24 17:00                         ` Stephen J. Turnbull
2013-05-22 21:47       ` Stefan Monnier
2013-05-22 22:24         ` Stefan Monnier
2013-05-22 23:53         ` Drew Adams
2013-05-23 22:30         ` Juri Linkov
2013-05-24  3:58           ` Stefan Monnier
2013-05-22 19:05 ` Stefan Monnier
2013-05-23 12:21   ` Gauthier Östervall
2013-05-23 13:41     ` Stefan Monnier
2013-05-23 22:04       ` Juri Linkov
2013-05-24  9:38         ` Alan Mackenzie
2013-05-24 20:31           ` Juri Linkov
2013-05-25 20:01             ` Alan Mackenzie
2013-05-25 20:40               ` Juri Linkov
2013-06-02 21:05                 ` isearch-allow-prefix [Was: [PATCH] Make `C-x {' and `C-x }' repeatable] Alan Mackenzie
2013-06-04 18:03                   ` Juri Linkov
2013-06-04 21:24                     ` Alan Mackenzie
2013-06-05  8:23                       ` Juri Linkov
2013-06-05 21:02                         ` Alan Mackenzie
2013-06-06  6:07                           ` isearch-allow-move [Was: isearch-allow-prefix] Juri Linkov
2013-06-06 12:45                             ` Stefan Monnier
2013-06-06 15:07                               ` Juri Linkov
2013-06-06 15:43                                 ` Drew Adams
2013-06-06 16:39                                 ` Stefan Monnier
2013-06-07  7:07                                   ` Juri Linkov
2013-06-06 20:07                             ` Alan Mackenzie
2013-06-07  6:59                               ` Juri Linkov
2013-06-07 10:30                                 ` Alan Mackenzie
2013-06-07 19:30                                   ` Juri Linkov
2013-06-09 20:09                                     ` Juri Linkov
2013-06-11 19:35                                       ` Juri Linkov
2013-06-07 20:04                               ` Juri Linkov
2013-06-09 12:07         ` [PATCH] set-temporary-overlay-map improvement and make windresize exit on other commands Vitalie Spinu
2013-06-09 16:03           ` Stefan Monnier
2013-06-09 17:12             ` Vitalie Spinu
2013-06-13 20:44               ` Stefan Monnier

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6fd5caa-ecff-406d-8a48-9fae808fdc66@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=gauthier@ostervall.se \
    --cc=juri@jurta.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.