I wrote a new version of "zap-to-char".It just highlights the region instead of kill it.I think this would be more flexible,because开发者_C百科 we can choose to kill,or copy,or just go to this char.
Here is the 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 see, I need a function to push the result of 'read-char' back to input,when you type input except for the "char". But I don't know if Emacs offered one. So I need your help.
I hope I've made this clear.
You can try unread-command-events
.
For example:
(push ?a unread-command-events)
精彩评论