Need Elisp function to go back

I wrote a new version of "zap-to-char". It simply highlights the region, not kills it. I think this will be more flexible because we can kill or copy or just go for that char.

Here is a snippet:

(defun new-zap-to-char (arg char) (interactive "p\ncZap to char: ") (push-mark) (setq mark-active t) (defun iter-zap () (if (< arg 0) (search-forward (char-to-string char) nil nil -1) (search-forward (char-to-string char) nil nil 1)) (if (char-equal char (setq c (read-char))) (iter-zap) (>>>>here is the "push-back-to-input" function"<<<<)) (iter-zap)) 

As you can see, I need a function to output the read-char result to the input when you enter input other than char. But I don't know if Emacs offered one. So I need your help.

Hope I made it clear.

+4
source share
1 answer

You can try unread-command-events .

For instance:

 (push ?a unread-command-events) 
+4
source

All Articles