當我在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