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.
source share