Email or username:

Password:

Forgot your password?
Top-level
Ténno Seremélʹ

@rayslava Yay :)

(defun zap-up-to-last-char (char)
"Zap up to the last occurrence of CHAR in the line."
(interactive "cZap up to the last occurence of char: ")
(let* ((case-fold-search (if (char-uppercase-p char) nil case-fold-search))
(start (point))
(end (save-excursion
(move-end-of-line 1)
(search-backward (char-to-string char) start t))))
(if end
(kill-region start end)
(error "Character not found"))))

2 comments
rayslava

@tennoseremel now you just need to promote it to upstream :blobcathappy:

Ténno Seremélʹ

@rayslava Looking at the source of zap-up-to-char it needs to be a bit longer, so it could be used non-interactively… :)

Go Up