Answers:
根据文档:
<C-delete>
运行命令kill-word(位于global-map中),该命令是中的交互式已编译Lisp函数‘simple.el’
。它必然
<C-delete>, M-d
。(杀手ARG)
向前杀死字符,直到遇到单词结尾。对于参数ARG,请执行多次。
现在,让我们浏览源代码:
(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))))
然后,在该kill-region
功能的文档中找到:
在点和标记之间杀死(“剪切”)文本。
This deletes the text from the buffer and saves it in the kill ring
。命令[yank]可以从那里检索它。(如果要保存区域而不杀死它,请使用[kill-ring-save]。)[...]
Lisp程序应使用此功能来杀死文本。(要删除文本,请使用
delete-region
。)
现在,如果您想走得更远,可以使用以下功能来删除而不复制到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)
从Emacs 24开始,没有任何配置,您可以选择任何文本,然后按Backspace或来删除任何文本而不将其添加到kill ring Delete。当标记处于活动状态时,这些键将删除区域,而不仅仅是删除光标之前/之后的字符。
也就是说,移至要删除的文本的一端,按Ctrl+ Space,移至另一端,然后按Backspace(或Delete)删除突出显示的区域。或移至一端,Shift在使用移动键移至另一端时按住,然后按Backspace。
undo
。不过,大胆猜测。