/* Buffer manipulation primitives for GNU Emacs.
-Copyright (C) 1985-1989, 1993-1995, 1997-2014 Free Software Foundation, Inc.
+Copyright (C) 1985-1989, 1993-1995, 1997-2015 Free Software Foundation,
+Inc.
This file is part of GNU Emacs.
}
\f
DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
- Sbarf_if_buffer_read_only, 0, 0, 0,
- doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */)
- (void)
+ Sbarf_if_buffer_read_only, 0, 1, 0,
+ doc: /* Signal a `buffer-read-only' error if the current buffer is read-only.
+If the text under POSITION (which defaults to point) has the
+`inhibit-read-only' text property set, the error will not be raised. */)
+ (Lisp_Object pos)
{
+ if (NILP (pos))
+ XSETFASTINT (pos, PT);
+ else
+ CHECK_NUMBER (pos);
+
if (!NILP (BVAR (current_buffer, read_only))
- && NILP (Vinhibit_read_only))
+ && NILP (Vinhibit_read_only)
+ && NILP (Fget_text_property (pos, Qinhibit_read_only, Qnil)))
xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
return Qnil;
}
QSFundamental = build_pure_c_string ("Fundamental");
- Qfundamental_mode = intern_c_string ("fundamental-mode");
+ DEFSYM (Qfundamental_mode, "fundamental-mode");
bset_major_mode (&buffer_defaults, Qfundamental_mode);
- Qmode_class = intern_c_string ("mode-class");
-
- Qprotected_field = intern_c_string ("protected-field");
-
- Qpermanent_local = intern_c_string ("permanent-local");
+ DEFSYM (Qmode_class, "mode-class");
+ DEFSYM (Qprotected_field, "protected-field");
- Qkill_buffer_hook = intern_c_string ("kill-buffer-hook");
+ DEFSYM (Qpermanent_local, "permanent-local");
+ DEFSYM (Qkill_buffer_hook, "kill-buffer-hook");
Fput (Qkill_buffer_hook, Qpermanent_local, Qt);
/* super-magic invisible buffer */
last_overlay_modification_hooks
= Fmake_vector (make_number (10), Qnil);
- staticpro (&Qfundamental_mode);
- staticpro (&Qmode_class);
staticpro (&QSFundamental);
staticpro (&Vbuffer_alist);
- staticpro (&Qprotected_field);
- staticpro (&Qpermanent_local);
- staticpro (&Qkill_buffer_hook);
DEFSYM (Qchoice, "choice");
DEFSYM (Qleft, "left");
doc: /* List of functions to call after each text change.
Three arguments are passed to each function: the positions of
the beginning and end of the range of changed text,
-and the length in bytes of the pre-change text replaced by that range.
+and the length in chars of the pre-change text replaced by that range.
\(For an insertion, the pre-change length is zero;
-for a deletion, that length is the number of bytes deleted,
+for a deletion, that length is the number of chars deleted,
and the post-change beginning and end are at the same place.)
Buffer changes made while executing the `after-change-functions'