Commit a96b68f1 authored by Richard M. Stallman's avatar Richard M. Stallman

(syms_of_buffer): Set up Lisp var inhibit-read-only.

(Vinhibit_read_only): Declared.
(Fbarf_if_buffer_read_only): Check Vinhibit_read_only.
parent 69f19f89
...@@ -112,6 +112,11 @@ Lisp_Object Vafter_change_function; ...@@ -112,6 +112,11 @@ Lisp_Object Vafter_change_function;
Lisp_Object Vtransient_mark_mode; Lisp_Object Vtransient_mark_mode;
/* t means ignore all read-only text properties.
A list means ignore such a property if its value is a member of the list.
Any non-nil value means ignore buffer-read-only. */
Lisp_Object Vinhibit_read_only;
/* List of functions to call before changing an unmodified buffer. */ /* List of functions to call before changing an unmodified buffer. */
Lisp_Object Vfirst_change_hook; Lisp_Object Vfirst_change_hook;
Lisp_Object Qfirst_change_hook; Lisp_Object Qfirst_change_hook;
...@@ -939,7 +944,8 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, ...@@ -939,7 +944,8 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
"Signal a `buffer-read-only' error if the current buffer is read-only.") "Signal a `buffer-read-only' error if the current buffer is read-only.")
() ()
{ {
while (!NILP (current_buffer->read_only)) if (!NILP (current_buffer->read_only)
&& NILP (Vinhibit_read_only))
Fsignal (Qbuffer_read_only, (Fcons (Fcurrent_buffer (), Qnil))); Fsignal (Qbuffer_read_only, (Fcons (Fcurrent_buffer (), Qnil)));
return Qnil; return Qnil;
} }
...@@ -2313,6 +2319,14 @@ Automatically local in all buffers."); ...@@ -2313,6 +2319,14 @@ Automatically local in all buffers.");
"*Non-nil means deactivate the mark when the buffer contents change."); "*Non-nil means deactivate the mark when the buffer contents change.");
Vtransient_mark_mode = Qnil; Vtransient_mark_mode = Qnil;
DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only
"*Non-nil means disregard read-only status of buffers or characters.\n\
If the value is t, disregard `buffer-read-only' and all `read-only'\n\
text properties. If the value is a list, disregard `buffer-read-only'\n\
and disregard a `read-only' text property if the property value\n\
is a member of the list.");
Vinhibit_read_only = Qnil;
defsubr (&Sbuffer_list); defsubr (&Sbuffer_list);
defsubr (&Sget_buffer); defsubr (&Sget_buffer);
defsubr (&Sget_file_buffer); defsubr (&Sget_file_buffer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment