schwrtze@acf8.UUCP (E. Schwartz group) (12/11/85)
Heres an el hack I know you will like....
The doc. sez it all but basically it does what vi's delete to char does
except this works forward and backwards on reg expers. A count implies
a skip. If I have disobeyed el style and semantics, be charitable since
this is my first hack ( please tell me though).
I like to map it to ^Xt and then u get prompted for the string.
Enjoy,
Hedley Rainnie. (hedley@alaya)
cmcl2!alaya!hedley
------
(define-key ctl-x-map "t" 'del-to)
(defun del-to(arg)
"deletes characters from dot upto|downto the character before|after the
prompted Upto|Downto string. Provided of course the string exists. Undo
will work for those deletes which go bezerk. Upto is the default Downto
can be selected by a neg ARG. ARG specifies the number of matches that
will be passed over."
(interactive "P")
(let ((x (dot))(aval)(y (read-string
(if (< (prefix-numeric-value arg) 0)
"Downto: " "Upto: ")
)))
(setq aval (prefix-numeric-value arg))
(if (< (prefix-numeric-value arg) 0)
(progn
(re-search-backward y (dot-min) t (- aval))
(forward-char (length y)))
(progn
(re-search-forward y (dot-max) t aval)
(forward-char (- 0 (length y)))))
(delete-region x (dot))))