/* 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.
return notsogood;
else
{
- buf = Fget_buffer (build_local_string ("*scratch*"));
+ AUTO_STRING (scratch, "*scratch*");
+ buf = Fget_buffer (scratch);
if (NILP (buf))
{
- buf = Fget_buffer_create (build_local_string ("*scratch*"));
+ buf = Fget_buffer_create (scratch);
Fset_buffer_major_mode (buf);
}
return buf;
if (candidate_buffer (buf, buffer))
return buf;
- buf = Fget_buffer (build_local_string ("*scratch*"));
+ AUTO_STRING (scratch, "*scratch*");
+ buf = Fget_buffer (scratch);
if (NILP (buf))
{
- buf = Fget_buffer_create (build_local_string ("*scratch*"));
+ buf = Fget_buffer_create (scratch);
Fset_buffer_major_mode (buf);
}
}
\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");
+ DEFSYM (Qmode_class, "mode-class");
+ DEFSYM (Qprotected_field, "protected-field");
- Qprotected_field = intern_c_string ("protected-field");
-
- Qpermanent_local = intern_c_string ("permanent-local");
-
- 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 */
(void) initialized;
#endif /* USE_MMAP_FOR_BUFFERS */
- Fset_buffer (Fget_buffer_create (build_local_string ("*scratch*")));
+ AUTO_STRING (scratch, "*scratch*");
+ Fset_buffer (Fget_buffer_create (scratch));
if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
Fset_buffer_multibyte (Qnil);
However, it is not necessary to turn / into /:/.
So avoid doing that. */
&& strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
- bset_directory
- (current_buffer,
- concat2 (build_local_string ("/:"), BVAR (current_buffer, directory)));
+ {
+ AUTO_STRING (slash_colon, "/:");
+ bset_directory (current_buffer,
+ concat2 (slash_colon,
+ BVAR (current_buffer, directory)));
+ }
temp = get_minibuffer (0);
bset_directory (XBUFFER (temp), BVAR (current_buffer, directory));
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");
DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
Qintegerp,
- doc: /* Width of this buffer's scroll bars in pixels.
+ doc: /* Width of this buffer's vertical scroll bars in pixels.
A value of nil means to use the scroll bar width from the window's frame. */);
DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height),
Qintegerp,
- doc: /* Height of this buffer's scroll bars in pixels.
+ doc: /* Height of this buffer's horizontal scroll bars in pixels.
A value of nil means to use the scroll bar height from the window's frame. */);
DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),
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'