删除一个单词,而不将其添加到Emacs中的kill-ring中 [英] Delete a word without adding it to the kill-ring in Emacs

查看:199
本文介绍了删除一个单词,而不将其添加到Emacs中的kill-ring中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用minibuffer(C-x C-f)切换文件时,我经常使用M-Backspace删除路径中的单词。 Emacs会自动将我删除的内容放入杀戒中。这可能会令人讨厌,因为我正在移动到另一个文件来粘贴某些东西,我最终粘贴文件路径的一部分。我知道有解决方法,其他代码仍然在杀死戒指等等,但我只是想禁用这个功能。

解决方案

Emacs没有向后删除字词功能,但是很容易定义一个:



$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b many many many many many many many many many many。。。。。。。。。
(interactivep)
(delete-region(point)(progn(backward-word arg)(point))))
/ pre>

然后,您可以将中的M-Backspace绑定到 back-delete-word minibuffer-local-map :

 (define-key minibuffer-local-map [M-backspace ]'backward-delete-word)


When switching files using the minibuffer (C-x C-f), I often use M-Backspace to delete words in the path. Emacs automatically places what I delete into the kill ring. This can be annoying, as sometime I am moving to another file to paste something, and I end up pasting part of the file path. I know there are workarounds, and the other code is still in the kill ring, etc, but I would just like to disable this functionality.

解决方案

Emacs doesn't have a backward-delete-word function, but it's easy enough to define one:

(defun backward-delete-word (arg)
  "Delete characters backward until encountering the beginning of a word.
With argument ARG, do this that many times."
  (interactive "p")
  (delete-region (point) (progn (backward-word arg) (point))))

Then you can bind M-Backspace to backward-delete-word in minibuffer-local-map:

(define-key minibuffer-local-map [M-backspace] 'backward-delete-word)

这篇关于删除一个单词,而不将其添加到Emacs中的kill-ring中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆