emacs删除区域只读 [英] emacs remove region read-only
本文介绍了emacs删除区域只读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
与 Emacs特定区域只读密切相关您如何删除缓冲区中文本区域的只读属性.
Closely related to Emacs specific region read only how do you remove the read only property on a region of text in a buffer.
例如,如果您在emacs中使用python shell并意外打印出一个巨大的列表,并希望从缓冲区中删除输出.
For example, if you are using a python shell in emacs and accidentally print out a huge list and would like to remove the output from your buffer.
推荐答案
我使用以下内容.它与tcaswell的答案类似,但是处理缓冲区修改问题.
I use the following. It's similar to tcaswell's answer, but deals with the buffer modification issue.
(defun set-region-read-only (begin end)
"Sets the read-only text property on the marked region.
Use `set-region-writeable' to remove this property."
;; See https://stackoverflow.com/questions/7410125
(interactive "r")
(with-silent-modifications
(put-text-property begin end 'read-only t)))
(defun set-region-writeable (begin end)
"Removes the read-only text property from the marked region.
Use `set-region-read-only' to set this property."
;; See https://stackoverflow.com/questions/7410125
(interactive "r")
(with-silent-modifications
(remove-text-properties begin end '(read-only t))))
这篇关于emacs删除区域只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文