当我在Emacs中搜索“save-restriction”的描述时,它有一个关于“缓冲区限制”的句子 - 我已经包含了下面的完整描述。这个词是什么意思?保存限制如何工作以及何时应该考虑使用它?“缓冲区限制”在保存限制中意味着什么?
(save-restriction &rest BODY)
Execute BODY, saving and restoring current buffer's restrictions.
The buffer's restrictions make parts of the beginning and end invisible.
(They are set up with `narrow-to-region' and eliminated with `widen'.)
This special form, `save-restriction', saves the current buffer's restrictions
when it is entered, and restores them when it is exited.
So any `narrow-to-region' within BODY lasts only until the end of the form.
The old restrictions settings are restored
even in case of abnormal exit (throw or error).
The value returned is the value of the last form in BODY.
THX队友,所以他们应该总是走到一起呢?我的意思是narrow- *和save-restriction? – Daniel 2012-07-21 21:40:52
我通过编辑prev回答。回答。 – alinsoar 2012-07-21 22:05:00
一般来说,我想在我的代码中保存缓冲区时使用save-excursion。 – alinsoar 2012-07-21 22:27:48