Advertisement
mark-naylor-1701

emacs delete words

Sep 30th, 2023 (edited)
2,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.53 KB | None | 0 0
  1. ;; Functions that delete words without sending them to the kill ring.
  2.  
  3. (defun delete-word (arg)
  4.   "Equivalent to `kill-word'. Characters do not get sent to the kill-ring."
  5.   (interactive "p")
  6.   (delete-region (point) (progn (forward-word arg) (point))))
  7.  
  8. (defun backward-delete-word (arg)
  9.   "Equivalent to `backward-kill-word'. Characters do not get sent to the kill-ring."
  10.   (interactive "p")
  11.   (delete-word (- arg)))
  12.  
  13. (global-set-key (kbd "M-D") #'delete-word)
  14. (global-set-key (kbd "M-S-<backspace>") #'backward-delete-word)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement