[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10477: zap-to-char should allow picking from history
From: |
Lars Ingebrigtsen |
Subject: |
bug#10477: zap-to-char should allow picking from history |
Date: |
Tue, 29 Oct 2019 12:32:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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
- bug#10477: zap-to-char should allow picking from history, Lars Ingebrigtsen, 2019/10/13
- bug#10477: zap-to-char should allow picking from history, Juri Linkov, 2019/10/27
- bug#10477: zap-to-char should allow picking from history, Lars Ingebrigtsen, 2019/10/27
- bug#10477: zap-to-char should allow picking from history, Juri Linkov, 2019/10/27
- bug#10477: zap-to-char should allow picking from history, Lars Ingebrigtsen, 2019/10/28
- bug#10477: zap-to-char should allow picking from history, Juri Linkov, 2019/10/28
- bug#10477: zap-to-char should allow picking from history,
Lars Ingebrigtsen <=
- bug#10477: zap-to-char should allow picking from history, Lars Ingebrigtsen, 2019/10/29
- bug#10477: zap-to-char should allow picking from history, Juri Linkov, 2019/10/29