#define MAXPATHLEN 1024
#endif /* not MAXPATHLEN */
-#include "config.h"
+#include <config.h>
#include "lisp.h"
#include "intervals.h"
#include "window.h"
Lisp_Object Qoverlayp;
+Lisp_Object Qmodification_hooks;
+Lisp_Object Qinsert_in_front_hooks;
+Lisp_Object Qinsert_behind_hooks;
+
/* For debugging; temporary. See set_buffer_internal. */
/* Lisp_Object Qlisp_mode, Vcheck_symbol; */
DEFUN ("buffer-local-variables", Fbuffer_local_variables,
Sbuffer_local_variables, 0, 1, 0,
"Return an alist of variables that are buffer-local in BUFFER.\n\
-Each element looks like (SYMBOL . VALUE) and describes one variable.\n\
+Most elements look like (SYMBOL . VALUE), describing one variable.\n\
+For a symbol that is locally unbound, just the symbol appears in the value.\n\
Note that storing new VALUEs in these elements doesn't change the variables.\n\
No argument or nil as argument means use current buffer as BUFFER.")
(buffer)
register Lisp_Object buffer;
{
register struct buffer *buf;
- register Lisp_Object val;
+ register Lisp_Object result;
if (NILP (buffer))
buf = current_buffer;
buf = XBUFFER (buffer);
}
+ result = Qnil;
+
{
/* Reference each variable in the alist in our current buffer.
If inquiring about the current buffer, this gets the current values,
so store them into the alist so the alist is up to date.
If inquiring about some other buffer, this swaps out any values
for that buffer, making the alist up to date automatically. */
- register Lisp_Object tem;
- for (tem = buf->local_var_alist; CONSP (tem); tem = XCONS (tem)->cdr)
+ register Lisp_Object tail;
+ for (tail = buf->local_var_alist; CONSP (tail); tail = XCONS (tail)->cdr)
{
- Lisp_Object v1 = Fsymbol_value (XCONS (XCONS (tem)->car)->car);
+ Lisp_Object val, elt;
+
+ elt = XCONS (tail)->car;
+
if (buf == current_buffer)
- XCONS (XCONS (tem)->car)->cdr = v1;
+ val = find_symbol_value (XCONS (elt)->car);
+ else
+ val = XCONS (elt)->cdr;
+
+ /* If symbol is unbound, put just the symbol in the list. */
+ if (EQ (val, Qunbound))
+ result = Fcons (XCONS (elt)->car, result);
+ /* Otherwise, put (symbol . value) in the list. */
+ else
+ result = Fcons (Fcons (XCONS (elt)->car, val), result);
}
}
- /* Make a copy of the alist, to return it. */
- val = Fcopy_alist (buf->local_var_alist);
-
/* Add on all the variables stored in special slots. */
{
register int offset, mask;
if (mask == -1 || (buf->local_var_flags & mask))
if (XTYPE (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols))
== Lisp_Symbol)
- val = Fcons (Fcons (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols),
- *(Lisp_Object *)(offset + (char *)buf)),
- val);
+ result = Fcons (Fcons (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols),
+ *(Lisp_Object *)(offset + (char *)buf)),
+ result);
}
}
- return (val);
+
+ return result;
}
\f
CHECK_STRING (name, 0);
tem = Fget_buffer (name);
- if (XBUFFER (tem) == current_buffer)
+ /* Don't short-circuit if UNIQUE is t. That is a useful way to rename
+ the buffer automatically so you can create another with the original name.
+ It makes UNIQUE equivalent to
+ (rename-buffer (generate-new-buffer-name NAME)). */
+ if (NILP (unique) && XBUFFER (tem) == current_buffer)
return current_buffer->name;
if (!NILP (tem))
{
\f
DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*",
"Delete the entire contents of the current buffer.\n\
-Any clipping restriction in effect (see `narrow-to-region') is removed,\n\
+Any narrowing restriction in effect (see `narrow-to-region') is removed,\n\
so the buffer is truly empty after this.")
()
{
{
Lisp_Object desired_point;
- desired_point =
- internal_with_output_to_temp_buffer ("*Buffer List*",
- list_buffers_1, files);
+ desired_point
+ = internal_with_output_to_temp_buffer ("*Buffer List*",
+ list_buffers_1, files);
if (NUMBERP (desired_point))
{
SET_PT (XINT (desired_point));
return unbind_to (count, Qnil);
}
+ return Qnil;
}
DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables,
else
/* Redisplay the area the overlay has just left, or just enclosed. */
{
- Lisp_Object o_beg = OVERLAY_START (overlay);
- Lisp_Object o_end = OVERLAY_END (overlay);
+ Lisp_Object o_beg;
+ Lisp_Object o_end;
int change_beg, change_end;
+ o_beg = OVERLAY_START (overlay);
+ o_end = OVERLAY_END (overlay);
o_beg = OVERLAY_POSITION (o_beg);
o_end = OVERLAY_POSITION (o_end);
b->overlays_after = Fdelq (overlay, b->overlays_after);
redisplay_region (b,
- OVERLAY_POSITION (OVERLAY_START (overlay)),
- OVERLAY_POSITION (OVERLAY_END (overlay)));
+ marker_position (OVERLAY_START (overlay)),
+ marker_position (OVERLAY_END (overlay)));
Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
Fset_marker (OVERLAY_END (overlay), Qnil, Qnil);
CHECK_OVERLAY (overlay, 0);
- redisplay_region (XMARKER (OVERLAY_START (overlay))->buffer,
- OVERLAY_POSITION (OVERLAY_START (overlay)),
- OVERLAY_POSITION (OVERLAY_END (overlay)));
+ tail = Fmarker_buffer (OVERLAY_START (overlay));
+ if (! NILP (tail))
+ redisplay_region (XMARKER (OVERLAY_START (overlay))->buffer,
+ marker_position (OVERLAY_START (overlay)),
+ marker_position (OVERLAY_END (overlay)));
plist = Fcdr_safe (XCONS (overlay)->cdr);
tail = XCONS (tail)->cdr)
{
int startpos, endpos;
- int ostart, oend;
+ Lisp_Object ostart, oend;
overlay = XCONS (tail)->car;
tail = XCONS (tail)->cdr)
{
int startpos, endpos;
- int ostart, oend;
+ Lisp_Object ostart, oend;
overlay = XCONS (tail)->car;
ostart = OVERLAY_START (overlay);
oend = OVERLAY_END (overlay);
startpos = OVERLAY_POSITION (ostart);
+ endpos = OVERLAY_POSITION (oend);
if (XFASTINT (end) < startpos)
break;
if (XFASTINT (end) == startpos && insertion)
staticpro (&Qpermanent_local);
staticpro (&Qkill_buffer_hook);
staticpro (&Qoverlayp);
+ staticpro (&Qmodification_hooks);
+ Qmodification_hooks = intern ("modification-hooks");
+ staticpro (&Qinsert_in_front_hooks);
+ Qinsert_in_front_hooks = intern ("insert-in-front-hooks");
+ staticpro (&Qinsert_behind_hooks);
+ Qinsert_behind_hooks = intern ("insert-behind-hooks");
Qoverlayp = intern ("overlayp");
If `overwrite-mode-binary', self-insertion replaces newlines and tabs too.\n\
Automatically becomes buffer-local when set in any fashion.");
+#if 0 /* The doc string is too long for some compilers,
+ but make-docfile can find it in this comment. */
DEFVAR_PER_BUFFER ("buffer-display-table", ¤t_buffer->display_table,
Qnil,
"Display table that controls display of the contents of current buffer.\n\
a vector of characters).\n\
If this variable is nil, the value of `standard-display-table' is used.\n\
Each window can have its own, overriding display table.");
+#endif
+ DEFVAR_PER_BUFFER ("buffer-display-table", ¤t_buffer->display_table,
+ Qnil, "");
/*DEFVAR_LISP ("debug-check-symbol", &Vcheck_symbol,
"Don't ask.");
Qfirst_change_hook = intern ("first-change-hook");
staticpro (&Qfirst_change_hook);
+#if 0 /* The doc string is too long for some compilers,
+ but make-docfile can find it in this comment. */
DEFVAR_PER_BUFFER ("buffer-undo-list", ¤t_buffer->undo_list, Qnil,
"List of undo entries in current buffer.\n\
Recent changes come first; older changes follow newer.\n\
between two undo boundaries as a single step to be undone.\n\
\n\
If the value of the variable is t, undo information is not recorded.");
+#endif
+ DEFVAR_PER_BUFFER ("buffer-undo-list", ¤t_buffer->undo_list, Qnil,
+ "");
DEFVAR_PER_BUFFER ("mark-active", ¤t_buffer->mark_active, Qnil,
"Non-nil means the mark and region are currently active in this buffer.\n\