Is there an Emacs function to delete (forward or backwards) until the first whitespace? For example, I have the following line, and the cursor is marked by t开发者_如何学JAVAhe caret:
someword ?(&)!* morewords
^
I want to delete the backwards the sequence of non-alphanumeric characters, but not the word someword
. Using backward-delete-word
will wipe out the word as well. The same is with the cursor before the weird characters and kill-word
.
emacs has the function zap-to-char
which will delete everything up to a specific character. So, this won't work for all whitespace but if your specific problem is everything up to a space you can use this function. Give the function a negative argument to zap backwards.
I don't know of any function, but it's easy enough to make one:
(defun my-delete-backward-to-ws ()
(interactive)
(delete-region (point) (save-excursion (skip-syntax-backward "^ ") (point))))
精彩评论