clone_per_buffer_values (from, to)
struct buffer *from, *to;
{
- Lisp_Object to_buffer;
+ Lisp_Object to_buffer, tem;
int offset;
XSETBUFFER (to_buffer, to);
to->overlays_before = copy_overlays (to, from->overlays_before);
to->overlays_after = copy_overlays (to, from->overlays_after);
+
+ /* Copy the alist of local variables,
+ and all the alist elements too. */
+ to->local_var_alist
+ = Fcopy_sequence (from->local_var_alist);
+ for (tem = to->local_var_alist; CONSP (tem);
+ tem = XCDR (tem))
+ XSETCAR (tem, Fcons (XCAR (XCAR (tem)), XCDR (XCAR (tem))));
}
2, 3,
"bMake indirect buffer (to buffer): \nBName of indirect buffer: ",
doc: /* Create and return an indirect buffer for buffer BASE-BUFFER, named NAME.
-BASE-BUFFER should be an existing buffer (or buffer name).
+BASE-BUFFER should be a live buffer, or the name of an existing buffer.
NAME should be a string which is not the name of an existing buffer.
Optional argument CLONE non-nil means preserve BASE-BUFFER's state,
such as major and minor modes, in the indirect buffer.
(base_buffer, name, clone)
Lisp_Object base_buffer, name, clone;
{
- Lisp_Object buf;
+ Lisp_Object buf, tem;
struct buffer *b;
+ CHECK_STRING (name);
buf = Fget_buffer (name);
if (!NILP (buf))
error ("Buffer name `%s' is in use", SDATA (name));
+ tem = base_buffer;
base_buffer = Fget_buffer (base_buffer);
if (NILP (base_buffer))
- error ("No such buffer: `%s'", SDATA (name));
+ error ("No such buffer: `%s'", SDATA (tem));
+ if (NILP (XBUFFER (base_buffer)->name))
+ error ("Base buffer has been killed");
if (SCHARS (name) == 0)
error ("Empty string for buffer name is not allowed");
}
/* Reinitialize everything about a buffer except its name and contents
- and local variables.
+ and local variables.
If called on an already-initialized buffer, the list of overlays
should be deleted before calling this function, otherwise we end up
with overlays that claim to belong to the buffer but the buffer
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
-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. */)
CHECK_STRING (name);
+ tem = Fstring_equal (name, ignore);
+ if (!NILP (tem))
+ return name;
tem = Fget_buffer (name);
if (NILP (tem))
return name;
DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
0, 1, 0,
doc: /* Return the base buffer of indirect buffer BUFFER.
-If BUFFER is not indirect, return nil. */)
+If BUFFER is not indirect, return nil.
+BUFFER defaults to the current buffer. */)
(buffer)
register Lisp_Object buffer;
{
DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p,
Srestore_buffer_modified_p, 1, 1, 0,
- doc: /* Like `set-buffer-modified-p', with a differences concerning redisplay.
+ doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay.
It is not ensured that mode lines will be updated to show the modified
state of the current buffer. Use with care. */)
(flag)
DEFUN ("switch-to-buffer", Fswitch_to_buffer, Sswitch_to_buffer, 1, 2, "BSwitch to buffer: ",
doc: /* Select buffer BUFFER in the current window.
-BUFFER may be a buffer or a buffer name.
+If BUFFER does not identify an existing buffer,
+then this function creates a buffer with that name.
+
+When called from Lisp, BUFFER may be a buffer, a string \(a buffer name),
+or nil. If BUFFER is nil, then this function chooses a buffer
+using `other-buffer'.
Optional second arg NORECORD non-nil means
do not put this buffer at the front of the list of recently selected ones.
+This function returns the buffer it switched to.
WARNING: This is NOT the way to work on another buffer temporarily
within a Lisp program! Use `set-buffer' instead. That avoids messing with
DEFUN ("pop-to-buffer", Fpop_to_buffer, Spop_to_buffer, 1, 3, 0,
doc: /* Select buffer BUFFER in some window, preferably a different one.
-If BUFFER is nil, then some other buffer is chosen.
+BUFFER may be a buffer, a string \(a buffer name), or nil.
+If BUFFER is a string which is not the name of an existing buffer,
+then this function creates a buffer with that name.
+If BUFFER is nil, then it chooses some other buffer.
If `pop-up-windows' is non-nil, windows can be split to do this.
If optional second arg OTHER-WINDOW is non-nil, insist on finding another
-window even if BUFFER is already visible in the selected window.
+window even if BUFFER is already visible in the selected window,
+and ignore `same-window-regexps' and `same-window-buffer-names'.
+This function returns the buffer it switched to.
This uses the function `display-buffer' as a subroutine; see the documentation
of `display-buffer' for additional customization information.
GPT = GPT_BYTE;
TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE);
-
+
for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
tail->charpos = tail->bytepos;
endpoint in this range will need to be unlinked from the overlay
list and reinserted in its proper place.
Such an overlay might even have negative size at this point.
- If so, we'll reverse the endpoints. Can you think of anything
- better to do in this situation? */
+ If so, we'll make the overlay empty. */
void
-fix_overlays_in_range (start, end)
+fix_start_end_in_overlays (start, end)
register int start, end;
{
Lisp_Object overlay;
for (parent = NULL, tail = current_buffer->overlays_before; tail;)
{
XSETMISC (overlay, tail);
+
endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+ startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+
+ /* If the overlay is backwards, make it empty. */
+ if (endpos < startpos)
+ {
+ startpos = endpos;
+ Fset_marker (OVERLAY_START (overlay), make_number (startpos),
+ Qnil);
+ }
+
if (endpos < start)
break;
- startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+
if (endpos < end
|| (startpos >= start && startpos < end))
{
- /* If the overlay is backwards, fix that now. */
- if (startpos > endpos)
- {
- int tem;
- Fset_marker (OVERLAY_START (overlay), make_number (endpos),
- Qnil);
- Fset_marker (OVERLAY_END (overlay), make_number (startpos),
- Qnil);
- tem = startpos; startpos = endpos; endpos = tem;
- }
/* Add it to the end of the wrong list. Later on,
recenter_overlay_lists will move it to the right place. */
if (endpos < current_buffer->overlay_center)
for (parent = NULL, tail = current_buffer->overlays_after; tail;)
{
XSETMISC (overlay, tail);
+
startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+ endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+
+ /* If the overlay is backwards, make it empty. */
+ if (endpos < startpos)
+ {
+ startpos = endpos;
+ Fset_marker (OVERLAY_START (overlay), make_number (startpos),
+ Qnil);
+ }
+
if (startpos >= end)
break;
- endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+
if (startpos >= start
|| (endpos >= start && endpos < end))
{
- if (startpos > endpos)
- {
- int tem;
- Fset_marker (OVERLAY_START (overlay), make_number (endpos),
- Qnil);
- Fset_marker (OVERLAY_END (overlay), make_number (startpos),
- Qnil);
- tem = startpos; startpos = endpos; endpos = tem;
- }
if (endpos < current_buffer->overlay_center)
{
if (!afterp)
add_overlay_mod_hooklist (prop, overlay);
}
}
-
+
for (tail = current_buffer->overlays_after; tail; tail = tail->next)
{
int startpos, endpos;
DEFVAR_PER_BUFFER ("fill-column", ¤t_buffer->fill_column,
make_number (Lisp_Int),
doc: /* *Column beyond which automatic line-wrapping should happen.
-Interactively, you can set this using \\[set-fill-column]. */);
+Interactively, you can set the buffer local value using \\[set-fill-column]. */);
DEFVAR_PER_BUFFER ("left-margin", ¤t_buffer->left_margin,
make_number (Lisp_Int),
DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
¤t_buffer->indicate_buffer_boundaries, Qnil,
doc: /* *Visually indicate buffer boundaries and scrolling.
-If non-nil, the first and last line of the buffer are marked in the left and
-right fringe of a window on window-systems.
-In addition, if value is t, the top and bottom line of the window are marked
-with up and down arrow bitmaps in the right fringe if window can be scrolled. */);
+If non-nil, the first and last line of the buffer are marked in the fringe
+of a window on window-systems with angle bitmaps, or if the window can be
+scrolled, the top and bottom line of the window are marked with up and down
+arrow bitmaps.
+If value is `left' or `right', both angle and arrow bitmaps are displayed in
+the left or right fringe, resp. Any other non-nil value causes the
+bitmap on the top line to be displayed in the left fringe, and the
+bitmap on the bottom line in the right fringe.
+If value is a cons (ANGLES . ARROWS), the car specifies the position
+of the angle bitmaps, and the cdr specifies the position of the arrow
+bitmaps. For example, (t . right) places the top angle bitmap in left
+fringe, the bottom angle bitmap in right fringe, and both arrow
+bitmaps in right fringe. To show just the angle bitmaps in the left
+fringe, but no arrow bitmaps, use (left . nil). */);
DEFVAR_PER_BUFFER ("scroll-up-aggressively",
¤t_buffer->scroll_up_aggressively, Qnil,
doc: /* *Non-nil means deactivate the mark when the buffer contents change.
Non-nil also enables highlighting of the region whenever the mark is active.
The variable `highlight-nonselected-windows' controls whether to highlight
-all windows or just the selected window. */);
+all windows or just the selected window.
+
+If the value is `lambda', that enables Transient Mark mode temporarily
+until the next buffer modification. If a command sets the value to `only',
+that enables Transient Mark mode for the following command only.
+During that following command, the value of `transient-mark-mode'
+is `identity'. If it is still `identity' at the end of that command,
+it changes to nil. */);
Vtransient_mark_mode = Qnil;
DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only,
t use the cursor specified for the frame
nil don't display a cursor
- bar display a bar cursor with default width
- (bar . WIDTH) display a bar cursor with width WIDTH
- ANYTHING ELSE display a box cursor.
+ box display a filled box cursor
+ hollow display a hollow box cursor
+ bar display a vertical bar cursor with default width
+ (bar . WIDTH) display a vertical bar cursor with width WIDTH
+ hbar display a horisontal bar cursor with default width
+ (hbar . WIDTH) display a horisontal bar cursor with width WIDTH
+ ANYTHING ELSE display a hollow box cursor.
When the buffer is displayed in a nonselected window,
this variable has no effect; the cursor appears as a hollow box. */);
DEFVAR_PER_BUFFER ("line-spacing",
¤t_buffer->extra_line_spacing, Qnil,
doc: /* Additional space to put between lines when displaying a buffer.
-The space is measured in pixels, and put below lines on window systems. */);
+The space is measured in pixels, and put below lines on window systems.
+If value is a floating point number, it specifies the spacing relative
+to the default frame line height. */);
DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions,
doc: /* List of functions called with no args to query before killing a buffer. */);