Delete To Space In Emacs

Is there an Emacs function to delete (forward or backward) to the first space? For example, I have the following line, and the cursor is marked with a carriage:

someword ?(&)!* morewords ^ 

I want to remove the reverse sequence of non-alphanumeric characters, but not someword . Using backward-delete-word also destroy the word. Same thing with cursor before weird characters and kill-word .

+4
source share
2 answers

I don't know any function, but easy enough to make it:

 (defun my-delete-backward-to-ws () (interactive) (delete-region (point) (save-excursion (skip-syntax-backward "^ ") (point)))) 
+3
source

emacs has a zap-to-char function that removes everything up to a specific character. Thus, this will not work for all spaces, but if your specific problem is everything in place, you can use this function. Give the function a negative argument to jump back.

+19
source

Source: https://habr.com/ru/post/1332108/


All Articles