aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2014-11-16 23:36:58 +0100
committerLars Magne Ingebrigtsen2014-11-16 23:41:55 +0100
commitd1b04a9e7ada7070dbd84bb450411c1f169b3739 (patch)
tree8f0e26d1e2154f91364fd1b919df8bd8855604fd /src/buffer.c
parentc94988f4b740738cbc4660ee9c64637e55ad5d76 (diff)
downloademacs-d1b04a9e7ada7070dbd84bb450411c1f169b3739.tar.gz
emacs-d1b04a9e7ada7070dbd84bb450411c1f169b3739.zip
Implement an `inhibit-read-only' text property
* doc/lispref/text.texi (Special Properties): Mention `inhibit-read-only'. * src/buffer.c (Fbarf_if_buffer_read_only): Don't raise an error if the text at POSITION (new optional argument) has the `inhibit-read-only' text property set. * src/callint.c (Fcall_interactively): Pass in nil as argument to Fbarf_if_buffer_read_only. * src/fileio.c (Finsert_file_contents): Ditto. * src/insdel.c (prepare_to_modify_buffer_1): Pass start region in. * src/intervals.h (INTERVAL_WRITABLE_P): Check the `inhibit-read-only' text property. * src/textprop.c (verify_interval_modification): Check buffer readedness after the last interval.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c16
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
2186DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, 2186DEFUN ("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) 2189If 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}