【发布时间】:2013-05-14 09:06:50
【问题描述】:
手册上说,如果你顺序使用kill-region,你杀死的文本将在kill-ring中连接成一个。
我只是很困惑这是如何工作的。所以我尝试在 scratch 缓冲区中对此进行评估:
(progn
(kill-region 1 5) ; this kills ";; T"
(kill-region 1 5)); this kills "his "
我期望的是,由于我使用了 2 次 kill-region,因此被杀死的文本应该在 kill-ring 中连接为一个。
但是当我使用 C-y 时,我只得到“他的”。
所以我在这里有两个问题:
在 lisp 中,如何多次调用 kill-region 以连接被杀死的文本?
使用键盘 C-w,如何多次调用 kill-region 以连接被杀死的文本?因为典型的工作流程是 kill-region(C-w),然后移动光标,然后再次 kill-region。
这里是杀死区域的文档字符串。第二段和最后一段不是矛盾的吗?
"Kill (\"cut\") text between point and mark.
This deletes the text from the buffer and saves it in the kill ring.
The command \\[yank] can retrieve it from there.
\(If you want to save the region without killing it, use \\[kill-ring-save].)
If you want to append the killed region to the last killed text,
use \\[append-next-kill] before \\[kill-region].
If the buffer is read-only, Emacs will beep and refrain from deleting
the text, but put the text in the kill ring anyway. This means that
you can use the killing commands to copy text from a read-only buffer.
Lisp programs should use this function for killing text.
(To delete text, use `delete-region'.)
Supply two arguments, character positions indicating the stretch of text
to be killed.
Any command that calls this function is a \"kill command\".
If the previous command was also a kill command,
the text killed this time appends to the text killed last time
to make one entry in the kill ring."
【问题讨论】:
-
您能否链接您在文档中的何处找到信息?
-
对我来说,它只有在键盘上重复 C-k 后才能工作。
-
在kill-region函数的定义中。 (我正在阅读 lisp 介绍)