De acuerdo con la documentación:
<C-delete>
ejecuta el comando kill-word (que se encuentra en global-map), que es una función interactiva de Lisp compilada en ‘simple.el’
.
Está obligado a <C-delete>, M-d
.
(kill-word ARG)
Mata a los personajes hacia adelante hasta encontrar el final de una palabra. Con el argumento ARG, haz esto muchas veces.
Ahora, examinemos el código fuente:
(defun kill-word (arg)
"Kill characters forward until encountering the end of a word.
With argument ARG, do this that many times."
(interactive "p")
(kill-region (point) (progn (forward-word arg) (point))))
Luego, dentro de la documentación para la kill-region
función encontramos:
Eliminar texto ("cortar") entre el punto y la marca.
This deletes the text from the buffer and saves it in the kill ring
. El comando [tirar] puede recuperarlo desde allí. (Si desea salvar la región sin matarla, use [kill-ring-save]).
[...]
Los programas Lisp deberían usar esta función para eliminar texto. (Para eliminar texto, use delete-region
).
Ahora, si quieres ir más allá, esta es una función que puedes usar para eliminar sin copiar en kill-ring:
(defun my-delete-word (arg)
"Delete characters forward until encountering the end of a word.
With argument, do this that many times.
This command does not push text to `kill-ring'."
(interactive "p")
(delete-region
(point)
(progn
(forward-word arg)
(point))))
(defun my-backward-delete-word (arg)
"Delete characters backward until encountering the beginning of a word.
With argument, do this that many times.
This command does not push text to `kill-ring'."
(interactive "p")
(my-delete-word (- arg)))
(defun my-delete-line ()
"Delete text from current position to end of line char.
This command does not push text to `kill-ring'."
(interactive)
(delete-region
(point)
(progn (end-of-line 1) (point)))
(delete-char 1))
(defun my-delete-line-backward ()
"Delete text between the beginning of the line to the cursor position.
This command does not push text to `kill-ring'."
(interactive)
(let (p1 p2)
(setq p1 (point))
(beginning-of-line 1)
(setq p2 (point))
(delete-region p1 p2)))
; bind them to emacs's default shortcut keys:
(global-set-key (kbd "C-S-k") 'my-delete-line-backward) ; Ctrl+Shift+k
(global-set-key (kbd "C-k") 'my-delete-line)
(global-set-key (kbd "M-d") 'my-delete-word)
(global-set-key (kbd "<M-backspace>") 'my-backward-delete-word)
Cortesía de ErgoEmacs.
undo
. Sin embargo, una suposición salvaje.