Subject: bug#39154: 27.0.60; Use character history in zap-up-to-char

From: Tino Calancha <[email-masked]>
Date: Thu, 16 Jan 2020 19:49:12 +0100

X-Debbugs-Cc: Juri Linkov <[email-masked]>
Severity: wishlist

While zapping I saw in the news about recent `zap-to-char' changes...
( I mean Emacs news, I don't watch TV! :-| )

We might want to extend that to cover `zap-up-to-char' as well; as many others,
I weardly use the former, but I often use the latter.

--8<-----------------------------cut here---------------start------------->8---
commit 5436b891aadaf649ae6ab3e204b74c76bfa4e6f8
Author: Tino Calancha <[email-masked]>
Date:   Thu Jan 16 19:30:03 2020 +0100

    Use character history in zap-up-to-char
    
    Extend commit
    'Add CHARS arg to read-char-from-minibuffer compatible with read-char-choice.'
    (04ab67470706f1c66bdf08e4078ea3dffd79b41e)
    to `zap-up-to-char'.
    
    * lisp/misc.el (lisp/misc.el): Use same interactive specification
    as in `zap-to-char'.
    * etc/NEWS (): Mention zap-up-to-char as well.

diff --git a/etc/NEWS b/etc/NEWS
index d6eb5d9e66..08e8907a2c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -603,10 +603,10 @@ navigation and editing of large files.
 
 +++
 ** 'zap-to-char' now uses the history of characters you used to zap to.
-'zap-to-char' uses the new 'read-char-from-minibuffer' function to allow
-navigating through the history of characters that have been input.
-This is mostly useful for characters that have complex input methods
-where inputting the character again may involve many keystrokes.
+'zap-to-char' and 'zap-up-to-char' use the new 'read-char-from-minibuffer'
+function to allow navigating through the history of characters that
+have been input.  This is mostly useful for characters that have complex
+input methods where inputting the character again may involve many keystrokes.
 
 +++
 ** 'save-some-buffers' now has a new action in the prompt: 'C-f' will
diff --git a/lisp/misc.el b/lisp/misc.el
index 05244a6ea2..8b6b7a7e0d 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -69,7 +69,9 @@ zap-up-to-char
 Case is ignored if `case-fold-search' is non-nil in the current buffer.
 Goes backward if ARG is negative; error if CHAR not found.
 Ignores CHAR at point."
-  (interactive "p\ncZap up to char: ")
+  (interactive (list (prefix-numeric-value current-prefix-arg)
+		     (read-char-from-minibuffer "Zap to char: "
+						nil 'read-char-history)))
   (let ((direction (if (>= arg 0) 1 -1)))
     (kill-region (point)
 		 (progn
--8<-----------------------------cut here---------------end--------------->8---

In GNU Emacs 27.0.60 (build 52, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2020-01-16 built on calancha-pc.dy.bbexcite.jp
Repository revision: 52080b5778cbe535c331fa14539aecd88f2be0a0
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)