diff options
| author | Richard M. Stallman | 1993-06-04 18:08:07 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-04 18:08:07 +0000 |
| commit | a96b68f119baff1e38b060e28cd516b9f8a9be24 (patch) | |
| tree | ef5386089f56f8429fa9c95a238fc22c85105815 | |
| parent | 69f19f89f7b6f110c333c233f598c5d59468b812 (diff) | |
| download | emacs-a96b68f119baff1e38b060e28cd516b9f8a9be24.tar.gz emacs-a96b68f119baff1e38b060e28cd516b9f8a9be24.zip | |
(syms_of_buffer): Set up Lisp var inhibit-read-only.
(Vinhibit_read_only): Declared.
(Fbarf_if_buffer_read_only): Check Vinhibit_read_only.
| -rw-r--r-- | src/buffer.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index be94972ee87..4c3d2496e52 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -112,6 +112,11 @@ Lisp_Object Vafter_change_function; | |||
| 112 | 112 | ||
| 113 | Lisp_Object Vtransient_mark_mode; | 113 | Lisp_Object Vtransient_mark_mode; |
| 114 | 114 | ||
| 115 | /* t means ignore all read-only text properties. | ||
| 116 | A list means ignore such a property if its value is a member of the list. | ||
| 117 | Any non-nil value means ignore buffer-read-only. */ | ||
| 118 | Lisp_Object Vinhibit_read_only; | ||
| 119 | |||
| 115 | /* List of functions to call before changing an unmodified buffer. */ | 120 | /* List of functions to call before changing an unmodified buffer. */ |
| 116 | Lisp_Object Vfirst_change_hook; | 121 | Lisp_Object Vfirst_change_hook; |
| 117 | Lisp_Object Qfirst_change_hook; | 122 | Lisp_Object Qfirst_change_hook; |
| @@ -939,7 +944,8 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, | |||
| 939 | "Signal a `buffer-read-only' error if the current buffer is read-only.") | 944 | "Signal a `buffer-read-only' error if the current buffer is read-only.") |
| 940 | () | 945 | () |
| 941 | { | 946 | { |
| 942 | while (!NILP (current_buffer->read_only)) | 947 | if (!NILP (current_buffer->read_only) |
| 948 | && NILP (Vinhibit_read_only)) | ||
| 943 | Fsignal (Qbuffer_read_only, (Fcons (Fcurrent_buffer (), Qnil))); | 949 | Fsignal (Qbuffer_read_only, (Fcons (Fcurrent_buffer (), Qnil))); |
| 944 | return Qnil; | 950 | return Qnil; |
| 945 | } | 951 | } |
| @@ -2313,6 +2319,14 @@ Automatically local in all buffers."); | |||
| 2313 | "*Non-nil means deactivate the mark when the buffer contents change."); | 2319 | "*Non-nil means deactivate the mark when the buffer contents change."); |
| 2314 | Vtransient_mark_mode = Qnil; | 2320 | Vtransient_mark_mode = Qnil; |
| 2315 | 2321 | ||
| 2322 | DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only | ||
| 2323 | "*Non-nil means disregard read-only status of buffers or characters.\n\ | ||
| 2324 | If the value is t, disregard `buffer-read-only' and all `read-only'\n\ | ||
| 2325 | text properties. If the value is a list, disregard `buffer-read-only'\n\ | ||
| 2326 | and disregard a `read-only' text property if the property value\n\ | ||
| 2327 | is a member of the list."); | ||
| 2328 | Vinhibit_read_only = Qnil; | ||
| 2329 | |||
| 2316 | defsubr (&Sbuffer_list); | 2330 | defsubr (&Sbuffer_list); |
| 2317 | defsubr (&Sget_buffer); | 2331 | defsubr (&Sget_buffer); |
| 2318 | defsubr (&Sget_file_buffer); | 2332 | defsubr (&Sget_file_buffer); |