diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/subr.el | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 58a8e85b61d..c26cbb9a56c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3941,7 +3941,7 @@ See also `locate-user-emacs-file'.") "Return non-nil if the current buffer is narrowed." (/= (- (point-max) (point-min)) (buffer-size))) -(defmacro with-narrowing (start end &rest rest) +(defmacro with-restriction (start end &rest rest) "Execute BODY with restrictions set to START and END. The current restrictions, if any, are restored upon return. @@ -3949,39 +3949,39 @@ The current restrictions, if any, are restored upon return. When the optional :label LABEL argument is present, in which LABEL is a symbol, inside BODY, `narrow-to-region' and `widen' can be used only within the START and END limits. To gain access -to other portions of the buffer, use `without-narrowing' with the +to other portions of the buffer, use `without-restriction' with the same LABEL argument. \(fn START END [:label LABEL] BODY)" (if (eq (car rest) :label) - `(internal--with-narrowing ,start ,end (lambda () ,@(cddr rest)) + `(internal--with-restriction ,start ,end (lambda () ,@(cddr rest)) ,(cadr rest)) - `(internal--with-narrowing ,start ,end (lambda () ,@rest)))) + `(internal--with-restriction ,start ,end (lambda () ,@rest)))) -(defun internal--with-narrowing (start end body &optional label) - "Helper function for `with-narrowing', which see." +(defun internal--with-restriction (start end body &optional label) + "Helper function for `with-restriction', which see." (save-restriction (narrow-to-region start end) (if label (internal--lock-narrowing label)) (funcall body))) -(defmacro without-narrowing (&rest rest) +(defmacro without-restriction (&rest rest) "Execute BODY without restrictions. The current restrictions, if any, are restored upon return. When the optional :label LABEL argument is present, the -restrictions set by `with-narrowing' with the same LABEL argument +restrictions set by `with-restriction' with the same LABEL argument are lifted. \(fn [:label LABEL] BODY)" (if (eq (car rest) :label) - `(internal--without-narrowing (lambda () ,@(cddr rest)) + `(internal--without-restriction (lambda () ,@(cddr rest)) ,(cadr rest)) - `(internal--without-narrowing (lambda () ,@rest)))) + `(internal--without-restriction (lambda () ,@rest)))) -(defun internal--without-narrowing (body &optional label) - "Helper function for `without-narrowing', which see." +(defun internal--without-restriction (body &optional label) + "Helper function for `without-restriction', which see." (save-restriction (if label (internal--unlock-narrowing label)) (widen) |