all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Juri Linkov <juri@linkov.net>
Cc: 10477@debbugs.gnu.org, jidanni@jidanni.org
Subject: bug#10477: zap-to-char should allow picking from history
Date: Tue, 29 Oct 2019 12:32:52 +0100	[thread overview]
Message-ID: <87o8xz23dn.fsf@gnus.org> (raw)
In-Reply-To: <87h83stsyz.fsf@mail.linkov.net> (Juri Linkov's message of "Tue,  29 Oct 2019 00:17:56 +0200")

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





  reply	other threads:[~2019-10-29 11:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-10-29 23:01             ` Lars Ingebrigtsen
2019-10-30  0:00               ` Juri Linkov

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=87o8xz23dn.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=10477@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    --cc=juri@linkov.net \
    /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.