diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c index 80791a1fdb1..9bdbfb830fd 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2184,12 +2184,20 @@ set_buffer_if_live (Lisp_Object buffer) | |||
| 2184 | } | 2184 | } |
| 2185 | 2185 | ||
| 2186 | DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, | 2186 | DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, |
| 2187 | Sbarf_if_buffer_read_only, 0, 0, 0, | 2187 | Sbarf_if_buffer_read_only, 0, 1, 0, |
| 2188 | doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) | 2188 | doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. |
| 2189 | (void) | 2189 | If the text under POSITION (which defaults to point) has the |
| 2190 | `inhibit-read-only' text property set, the error will not be raised. */) | ||
| 2191 | (Lisp_Object pos) | ||
| 2190 | { | 2192 | { |
| 2193 | if (NILP (pos)) | ||
| 2194 | XSETFASTINT (pos, PT); | ||
| 2195 | else | ||
| 2196 | CHECK_NUMBER (pos); | ||
| 2197 | |||
| 2191 | if (!NILP (BVAR (current_buffer, read_only)) | 2198 | if (!NILP (BVAR (current_buffer, read_only)) |
| 2192 | && NILP (Vinhibit_read_only)) | 2199 | && NILP (Vinhibit_read_only) |
| 2200 | && NILP (Fget_text_property (pos, Qinhibit_read_only, Qnil))) | ||
| 2193 | xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); | 2201 | xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); |
| 2194 | return Qnil; | 2202 | return Qnil; |
| 2195 | } | 2203 | } |