GNU bug report logs - #10477
zap-to-char should allow picking from history

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Wed, 11 Jan 2012 03:29:01 UTC

Severity: wishlist

Tags: fixed

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 10477 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#10477: zap-to-char should allow picking from history
Date: Tue, 29 Oct 2019 00:17:56 +0200
>> 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: ")




This bug report was last modified 5 years and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.