* bug#10477: zap-to-char should allow picking from history
@ 2012-01-11 3:27 jidanni
2012-01-15 1:23 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: jidanni @ 2012-01-11 3:27 UTC (permalink / raw
To: 10477
zap-to-char should allow typing e.g., the up arrow to pick a recently used
character, and then RET.
Currently the only way is to type the actual character back in again!
Even if hard to type CKS!
Currently one gets 'Non-character input-event'.
It should work something like one can maneuver at M-x occur's 'List
lines matching regexp:' prompt.
So: if a-z etc. is pressed, then no RET should be required.
If any 'Non-character input-event' is pressed, then we should be able to
manipulate from a history list of recently zapped chars.
emacs-version "24.0.92.1"
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2012-01-11 3:27 bug#10477: zap-to-char should allow picking from history jidanni
@ 2012-01-15 1:23 ` Drew Adams
2012-01-15 1:38 ` jidanni
2019-10-14 3:11 ` Lars Ingebrigtsen
2 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2012-01-15 1:23 UTC (permalink / raw
To: jidanni, 10477
> zap-to-char should allow typing e.g., the up arrow to pick a
> recently used character, and then RET.
>
> Currently the only way is to type the actual character back in again!
> Even if hard to type CKS!
>
> Currently one gets 'Non-character input-event'.
>
> It should work something like one can maneuver at M-x occur's 'List
> lines matching regexp:' prompt.
> So: if a-z etc. is pressed, then no RET should be required.
>
> If any 'Non-character input-event' is pressed, then we should
> be able to manipulate from a history list of recently zapped chars.
This sounds similar to bug #1580 (which jidanni also filed), though the emphasis
seems a bit different.
---
FWIW, in Icicles, command `icicle-zap-to-char' uses function
`icicle-read-char-maybe-completing' interactively, which is like `read-char'
unless you hit a completing key (e.g. `TAB') or you hit `C-q'.
If you hit a completing key, you complete a character name against either the
names of your previously entered Unicode chars (default behavior) or all Unicode
char names (depends on an option setting).
It is function `icicle-read-char-by-name', a replacement for
`read-char-by-name', which does the completion. It also populates the
Unicode-char history list used by `icicle-read-char-maybe-completing'.
You can read (and zap to) a TAB char by hitting C-q first: `C-q TAB'. You can
read (and zap to) a `C-q' char by hitting `C-q C-q'.
The idea is to try to make it easier to zap to Unicode (e.g. Chinese) chars that
you have already inserted. The tradeoff is that zapping to a TAB or C-q char
requires you to hit `C-q' first.
(I don't really know whether completing against a char name is necessarily
easier than "to type the actual character back in again". Completing against a
history list instead of all Unicode chars as candidates, the thought was that it
might be. Dunno.)
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2012-01-11 3:27 bug#10477: zap-to-char should allow picking from history jidanni
2012-01-15 1:23 ` Drew Adams
@ 2012-01-15 1:38 ` jidanni
2012-01-15 3:47 ` Drew Adams
2019-10-14 3:11 ` Lars Ingebrigtsen
2 siblings, 1 reply; 13+ messages in thread
From: jidanni @ 2012-01-15 1:38 UTC (permalink / raw
To: drew.adams; +Cc: 10477
>>>>> "DA" == Drew Adams <drew.adams@oracle.com> writes:
DA> The idea is to try to make it easier to zap to Unicode (e.g. Chinese) chars that
DA> you have already inserted. The tradeoff is that zapping to a TAB or C-q char
DA> requires you to hit `C-q' first.
Well pros with embedded control characters probably have other means of zapping.
DA> (I don't really know whether completing against a char name is necessarily
DA> easier than "to type the actual character back in again". Completing against a
DA> history list instead of all Unicode chars as candidates, the thought was that it
DA> might be. Dunno.)
I don't know if "completion" is relevant in the case of just one character.
All I know is hitting one or two up arrows and then RET is what the user
would like to do.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2012-01-15 1:38 ` jidanni
@ 2012-01-15 3:47 ` Drew Adams
0 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2012-01-15 3:47 UTC (permalink / raw
To: jidanni; +Cc: 10477
> DA> The idea is to try to make it easier to zap to Unicode
> DA> (e.g. Chinese) chars that you have already inserted.
> DA> The tradeoff is that zapping to a TAB or C-q char
> DA> requires you to hit `C-q' first.
>
> Well pros with embedded control characters probably have
> other means of zapping.
>
> DA> (I don't really know whether completing against a char
> DA> name is necessarily easier than "to type the actual
> DA> character back in again". Completing against a
> DA> history list instead of all Unicode chars as candidates,
> DA> the thought was that it might be. Dunno.)
>
> I don't know if "completion" is relevant in the case of just
> one character. All I know is hitting one or two up arrows
> and then RET is what the user would like to do.
You can do that as well in Icicles during completion. You have the choice: type
chars to match candidates (in this case, Unicode char names) or cycle using,
e.g., arrow keys. E.g., you can do this:
M-z TAB <up> <up> <up>...
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2012-01-11 3:27 bug#10477: zap-to-char should allow picking from history jidanni
2012-01-15 1:23 ` Drew Adams
2012-01-15 1:38 ` jidanni
@ 2019-10-14 3:11 ` Lars Ingebrigtsen
2019-10-27 21:30 ` Juri Linkov
2 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-14 3:11 UTC (permalink / raw
To: jidanni; +Cc: 10477
jidanni@jidanni.org writes:
> zap-to-char should allow typing e.g., the up arrow to pick a recently used
> character, and then RET.
>
> Currently the only way is to type the actual character back in again!
> Even if hard to type CKS!
>
> Currently one gets 'Non-character input-event'.
I've now implemented this in Emacs 27 -- it was more code than expected,
so perhaps simple.el isn't the right place for it. On the other hand,
`zap-to-char' is there, so perhaps that's the right place for it?
Or it could go to subr-x.el with an autoload -- `zap-to-char' probably
isn't the most used command ever, anyway, and I'm not sure
`read-char-with-history' has much utility outside that command.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2019-10-14 3:11 ` Lars Ingebrigtsen
@ 2019-10-27 21:30 ` Juri Linkov
2019-10-27 22:14 ` Lars Ingebrigtsen
0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2019-10-27 21:30 UTC (permalink / raw
To: Lars Ingebrigtsen; +Cc: 10477, jidanni
>> zap-to-char should allow typing e.g., the up arrow to pick a recently used
>> character, and then RET.
>>
>> Currently the only way is to type the actual character back in again!
>> Even if hard to type CKS!
>>
>> Currently one gets 'Non-character input-event'.
>
> I've now implemented this in Emacs 27 -- it was more code than expected,
> so perhaps simple.el isn't the right place for it. On the other hand,
> `zap-to-char' is there, so perhaps that's the right place for it?
I tried typing the up arrow, but it fails with the error
"Non-character input-event". Is this intentional?
> Or it could go to subr-x.el with an autoload -- `zap-to-char' probably
> isn't the most used command ever, anyway, and I'm not sure
> `read-char-with-history' has much utility outside that command.
Indeed, subr-x.el looks like a more suitable place.
Another variant is create a new file for commands reading input
with a name like read-x.el (or maybe minibuffer-x.el or prompt-x.el).
Then put here `read-char-with-history', also all functions from
lisp/emacs-lisp/map-ynp.el and lisp/emacs-lisp/rmc.el,
maybe also read-char-choice from subr.el.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2019-10-27 21:30 ` Juri Linkov
@ 2019-10-27 22:14 ` Lars Ingebrigtsen
2019-10-27 22:34 ` Juri Linkov
0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-27 22:14 UTC (permalink / raw
To: Juri Linkov; +Cc: 10477, jidanni
Juri Linkov <juri@linkov.net> writes:
>> I've now implemented this in Emacs 27 -- it was more code than expected,
>> so perhaps simple.el isn't the right place for it. On the other hand,
>> `zap-to-char' is there, so perhaps that's the right place for it?
>
> I tried typing the up arrow, but it fails with the error
> "Non-character input-event". Is this intentional?
That's the way the command has always worked, so I didn't change that.
>> Or it could go to subr-x.el with an autoload -- `zap-to-char' probably
>> isn't the most used command ever, anyway, and I'm not sure
>> `read-char-with-history' has much utility outside that command.
>
> Indeed, subr-x.el looks like a more suitable place.
>
> Another variant is create a new file for commands reading input
> with a name like read-x.el (or maybe minibuffer-x.el or prompt-x.el).
> Then put here `read-char-with-history', also all functions from
> lisp/emacs-lisp/map-ynp.el and lisp/emacs-lisp/rmc.el,
> maybe also read-char-choice from subr.el.
Makes sense to me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2019-10-27 22:14 ` Lars Ingebrigtsen
@ 2019-10-27 22:34 ` Juri Linkov
2019-10-28 10:48 ` Lars Ingebrigtsen
0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2019-10-27 22:34 UTC (permalink / raw
To: Lars Ingebrigtsen; +Cc: 10477, jidanni
>>> I've now implemented this in Emacs 27 -- it was more code than expected,
>>> so perhaps simple.el isn't the right place for it. On the other hand,
>>> `zap-to-char' is there, so perhaps that's the right place for it?
>>
>> I tried typing the up arrow, but it fails with the error
>> "Non-character input-event". Is this intentional?
>
> That's the way the command has always worked, so I didn't change that.
I tried the up arrow because this is what OP asked to implement:
"zap-to-char should allow typing e.g., the up arrow to pick a recently used
character, and then RET."
Using read-from-minibuffer would allow this for free.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2019-10-27 22:34 ` Juri Linkov
@ 2019-10-28 10:48 ` Lars Ingebrigtsen
2019-10-28 22:17 ` Juri Linkov
0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-28 10:48 UTC (permalink / raw
To: Juri Linkov; +Cc: 10477, jidanni
Juri Linkov <juri@linkov.net> writes:
> I tried the up arrow because this is what OP asked to implement:
>
> "zap-to-char should allow typing e.g., the up arrow to pick a recently used
> character, and then RET."
I wasn't aware that <up> traversed the history -- I've always used
`M-p'. But, yes, <up> should work in zap-to-char, too, then.
> Using read-from-minibuffer would allow this for free.
How would you implement read-char-with-history using
read-from-minibuffer? Rebind self-insert-command?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2019-10-28 10:48 ` Lars Ingebrigtsen
@ 2019-10-28 22:17 ` Juri Linkov
2019-10-29 11:32 ` Lars Ingebrigtsen
2019-10-29 23:01 ` Lars Ingebrigtsen
0 siblings, 2 replies; 13+ messages in thread
From: Juri Linkov @ 2019-10-28 22:17 UTC (permalink / raw
To: Lars Ingebrigtsen; +Cc: 10477, jidanni
>> Using read-from-minibuffer would allow this for free.
>
> How would you implement read-char-with-history using
> read-from-minibuffer? Rebind self-insert-command?
Exactly, by rebinding self-insert-command:
(defvar read-char-from-minibuffer-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map minibuffer-local-map)
(define-key map [remap self-insert-command]
(lambda ()
(interactive)
(delete-minibuffer-contents)
(insert (event-basic-type last-command-event))
(exit-minibuffer)))
map))
(defun read-char-from-minibuffer (prompt)
(read-from-minibuffer prompt nil
read-char-from-minibuffer-map nil
'read-char-from-minibuffer-history))
(read-char-from-minibuffer "Please type a character: ")
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2019-10-28 22:17 ` Juri Linkov
@ 2019-10-29 11:32 ` Lars Ingebrigtsen
2019-10-29 23:01 ` Lars Ingebrigtsen
1 sibling, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-29 11:32 UTC (permalink / raw
To: Juri Linkov; +Cc: 10477, jidanni
Juri Linkov <juri@linkov.net> writes:
>>> Using read-from-minibuffer would allow this for free.
>>
>> How would you implement read-char-with-history using
>> read-from-minibuffer? Rebind self-insert-command?
>
> Exactly, by rebinding self-insert-command:
>
> (defvar read-char-from-minibuffer-map
> (let ((map (make-sparse-keymap)))
> (set-keymap-parent map minibuffer-local-map)
> (define-key map [remap self-insert-command]
> (lambda ()
> (interactive)
> (delete-minibuffer-contents)
> (insert (event-basic-type last-command-event))
> (exit-minibuffer)))
> map))
>
> (defun read-char-from-minibuffer (prompt)
> (read-from-minibuffer prompt nil
> read-char-from-minibuffer-map nil
> 'read-char-from-minibuffer-history))
>
> (read-char-from-minibuffer "Please type a character: ")
Hm, interesting.
That indeed seems a lot better than the current read-char-with-history.
(Minor tweak -- this returns a string, but should return a char.)
And this presumably works with "complicated" input methods, too? Xim
etc.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2019-10-28 22:17 ` Juri Linkov
2019-10-29 11:32 ` Lars Ingebrigtsen
@ 2019-10-29 23:01 ` Lars Ingebrigtsen
2019-10-30 0:00 ` Juri Linkov
1 sibling, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-29 23:01 UTC (permalink / raw
To: Juri Linkov; +Cc: 10477, jidanni
Juri Linkov <juri@linkov.net> writes:
> Exactly, by rebinding self-insert-command:
OK; I've taken your code and tweaked it a bit and used it to replace
read-char-with-history.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#10477: zap-to-char should allow picking from history
2019-10-29 23:01 ` Lars Ingebrigtsen
@ 2019-10-30 0:00 ` Juri Linkov
0 siblings, 0 replies; 13+ messages in thread
From: Juri Linkov @ 2019-10-30 0:00 UTC (permalink / raw
To: Lars Ingebrigtsen; +Cc: 10477, jidanni
>> Exactly, by rebinding self-insert-command:
>
> OK; I've taken your code and tweaked it a bit and used it to replace
> read-char-with-history.
I also renamed it to a better name: by analogy with read-from-minibuffer,
and to hint that it relies on, the new name is read-char-from-minibuffer.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-10-30 0:00 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 3:27 bug#10477: zap-to-char should allow picking from history jidanni
2012-01-15 1:23 ` Drew Adams
2012-01-15 1:38 ` jidanni
2012-01-15 3:47 ` Drew Adams
2019-10-14 3:11 ` Lars Ingebrigtsen
2019-10-27 21:30 ` Juri Linkov
2019-10-27 22:14 ` Lars Ingebrigtsen
2019-10-27 22:34 ` Juri Linkov
2019-10-28 10:48 ` Lars Ingebrigtsen
2019-10-28 22:17 ` Juri Linkov
2019-10-29 11:32 ` Lars Ingebrigtsen
2019-10-29 23:01 ` Lars Ingebrigtsen
2019-10-30 0:00 ` Juri Linkov
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.