GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
doc: /* Return a string that is the name of no existing buffer based on NAME.
If there is no live buffer named NAME, then return NAME.
Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
-(starting at 2) until an unused name is found, and then return that name.
+\(starting at 2) until an unused name is found, and then return that name.
Optional second argument IGNORE specifies a name that is okay to use (if
it is in the sequence to be tried) even if a buffer with that name exists.
If NAME begins with a space (i.e., a buffer that is not normally
visible to users), then if buffer NAME already exists a random number
is first appended to NAME, to speed up finding a non-existent buffer. */)
- (register Lisp_Object name, Lisp_Object ignore)
+ (Lisp_Object name, Lisp_Object ignore)
{
- register Lisp_Object gentemp, tem, tem2;
- ptrdiff_t count;
- char number[INT_BUFSIZE_BOUND (ptrdiff_t) + sizeof "<>"];
+ Lisp_Object genbase;
CHECK_STRING (name);
- tem = Fstring_equal (name, ignore);
- if (!NILP (tem))
- return name;
- tem = Fget_buffer (name);
- if (NILP (tem))
+ if (!NILP (Fstring_equal (name, ignore)) || NILP (Fget_buffer (name)))
return name;
- if (!strncmp (SSDATA (name), " ", 1)) /* see bug#1229 */
+ if (SREF (name, 0) != ' ') /* See bug#1229. */
+ genbase = name;
+ else
{
/* Note fileio.c:make_temp_name does random differently. */
- tem2 = concat2 (name, make_formatted_string
- (number, "-%"pI"d",
- XFASTINT (Frandom (make_number (999999)))));
- tem = Fget_buffer (tem2);
- if (NILP (tem))
- return tem2;
+ char number[sizeof "-999999"];
+ int i = XFASTINT (Frandom (make_number (999999)));
+ AUTO_STRING_WITH_LEN (lnumber, number, sprintf (number, "-%d", i));
+ genbase = concat2 (name, lnumber);
+ if (NILP (Fget_buffer (genbase)))
+ return genbase;
}
- else
- tem2 = name;
- count = 1;
- while (1)
+ for (ptrdiff_t count = 2; ; count++)
{
- gentemp = concat2 (tem2, make_formatted_string
- (number, "<%"pD"d>", ++count));
- tem = Fstring_equal (gentemp, ignore);
- if (!NILP (tem))
- return gentemp;
- tem = Fget_buffer (gentemp);
- if (NILP (tem))
+ char number[INT_BUFSIZE_BOUND (ptrdiff_t) + sizeof "<>"];
+ AUTO_STRING_WITH_LEN (lnumber, number,
+ sprintf (number, "<%"pD"d>", count));
+ Lisp_Object gentemp = concat2 (genbase, lnumber);
+ if (!NILP (Fstring_equal (gentemp, ignore))
+ || NILP (Fget_buffer (gentemp)))
return gentemp;
}
}
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)
+ (Lisp_Object position)
{
- if (NILP (pos))
- XSETFASTINT (pos, PT);
+ if (NILP (position))
+ XSETFASTINT (position, PT);
else
- CHECK_NUMBER (pos);
+ CHECK_NUMBER (position);
if (!NILP (BVAR (current_buffer, read_only))
&& NILP (Vinhibit_read_only)
- && NILP (Fget_text_property (pos, Qinhibit_read_only, Qnil)))
+ && NILP (Fget_text_property (position, Qinhibit_read_only, Qnil)))
xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
return Qnil;
}
BEG and END may be integers or markers.
The fourth arg FRONT-ADVANCE, if non-nil, makes the marker
for the front of the overlay advance when text is inserted there
-(which means the text *is not* included in the overlay).
+\(which means the text *is not* included in the overlay).
The fifth arg REAR-ADVANCE, if non-nil, makes the marker
for the rear of the overlay advance when text is inserted there
-(which means the text *is* included in the overlay). */)
+\(which means the text *is* included in the overlay). */)
(Lisp_Object beg, Lisp_Object end, Lisp_Object buffer,
Lisp_Object front_advance, Lisp_Object rear_advance)
{
if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
Fset_buffer_multibyte (Qnil);
- pwd = get_current_dir_name ();
+ pwd = emacs_get_current_dir_name ();
if (!pwd)
{
doc: /* List of functions to call before each text change.
Two arguments are passed to each function: the positions of
the beginning and end of the range of old text to be changed.
-(For an insertion, the beginning and end are at the same place.)
+\(For an insertion, the beginning and end are at the same place.)
No information is given about the length of the text after the change.
Buffer changes made while executing the `before-change-functions'
Three arguments are passed to each function: the positions of
the beginning and end of the range of changed text,
and the length in chars of the pre-change text replaced by that range.
-(For an insertion, the pre-change length is zero;
+\(For an insertion, the pre-change length is zero;
for a deletion, that length is the number of chars deleted,
and the post-change beginning and end are at the same place.)
and VALUE is the old value.
An entry (apply FUN-NAME . ARGS) means undo the change with
-(apply FUN-NAME ARGS).
+\(apply FUN-NAME ARGS).
An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo
in the active region. BEG and END is the range affected by this entry
(hbar . HEIGHT) display a horizontal bar cursor with height HEIGHT
ANYTHING ELSE display a hollow box cursor
+WIDTH and HEIGHT can't exceed the frame's canonical character size.
+
When the buffer is displayed in a non-selected window, the
cursor's appearance is instead controlled by the variable
`cursor-in-non-selected-windows'. */);
doc: /* Non-nil means show a cursor in non-selected windows.
If nil, only shows a cursor in the selected window.
If t, displays a cursor related to the usual cursor type
-(a solid box becomes hollow, a bar becomes a narrower bar).
+\(a solid box becomes hollow, a bar becomes a narrower bar).
You can also specify the cursor type as in the `cursor-type' variable.
Use Custom to set this variable and update the display. */);