What does "buffer's restrictions" mean in save-restriction?
elisp, emacs
Solution
save-restriction is used by narrow-* functions to save the current buffer , before to hide it, in order to be able to restore it.
'save-restriction' memorizes all 'buffer' data strucuture , in particular point-min, point-max, point-max-marker, etc . For example, before a narrow-function modifies the visibility of a buffer, it memorizes the old configuration, in order to be able to restore it using widen().
Problem
When I search for description of "save-restriction" in Emacs, it has a sentence about "The buffer's restrictions" - I have included the complete description below. What does this term mean? how does save-restriction work and when it should be used considering this? ``` (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. ```