Lisp_Object Fset_buffer ();
void set_buffer_internal ();
+static void call_overlay_mod_hooks ();
/* Alist of all buffer names vs the buffers. */
/* This used to be a variable, but is no longer,
{
sprintf (number, "<%d>", ++count);
gentemp = concat2 (name, build_string (number));
- tem = Fstring_equal (name, ignore);
+ tem = Fstring_equal (gentemp, ignore);
if (!NILP (tem))
return gentemp;
tem = Fget_buffer (gentemp);
if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ')
continue;
if (NILP (visible_ok))
- tem = Fget_buffer_window (buf, Qnil);
+ tem = Fget_buffer_window (buf, Qt);
else
tem = Qnil;
if (NILP (tem))
register Lisp_Object tail, tem, buf;
Lisp_Object col1, col2, col3, minspace;
register struct buffer *old = current_buffer, *b;
- int desired_point = 0;
+ Lisp_Object desired_point;
Lisp_Object other_file_symbol;
+ desired_point = Qnil;
other_file_symbol = intern ("list-buffers-directory");
XFASTINT (col1) = 19;
continue;
/* Identify the current buffer. */
if (b == old)
- desired_point = point;
+ XFASTINT (desired_point) = point;
write_string (b == old ? "." : " ", -1);
/* Identify modified buffers */
write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1);
current_buffer->read_only = Qt;
set_buffer_internal (old);
-/* Foo. This doesn't work since temp_output_buffer_show sets point to 1
- if (desired_point)
- XBUFFER (Vstandard_output)->text.pointloc = desired_point;
- */
- return Qnil;
+ return desired_point;
}
DEFUN ("list-buffers", Flist_buffers, Slist_buffers, 0, 1, "P",
(files)
Lisp_Object files;
{
- internal_with_output_to_temp_buffer ("*Buffer List*",
- list_buffers_1, files);
- return Qnil;
+ Lisp_Object desired_point;
+
+ desired_point =
+ internal_with_output_to_temp_buffer ("*Buffer List*",
+ list_buffers_1, files);
+
+ if (NUMBERP (desired_point))
+ {
+ int count = specpdl_ptr - specpdl;
+ record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ Fset_buffer (build_string ("*Buffer List*"));
+ SET_PT (XINT (desired_point));
+ return unbind_to (count, Qnil);
+ }
}
DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables,
return value;
}
\f
+/* Run the modification-hooks of overlays that include
+ any part of the text in START to END.
+ Run the insert-before-hooks of overlay starting at END,
+ and the insert-after-hooks of overlay ending at START. */
+
+void
+verify_overlay_modification (start, end)
+ Lisp_Object start, end;
+{
+ Lisp_Object prop, overlay, tail;
+ int insertion = EQ (start, end);
+
+ for (tail = current_buffer->overlays_before;
+ CONSP (tail);
+ tail = XCONS (tail)->cdr)
+ {
+ int startpos, endpos;
+ int ostart, oend;
+
+ overlay = XCONS (tail)->car;
+
+ ostart = OVERLAY_START (overlay);
+ oend = OVERLAY_END (overlay);
+ endpos = OVERLAY_POSITION (oend);
+ if (XFASTINT (start) > endpos)
+ break;
+ startpos = OVERLAY_POSITION (ostart);
+ if (XFASTINT (end) == startpos && insertion)
+ {
+ prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
+ call_overlay_mod_hooks (prop, overlay, start, end);
+ }
+ if (XFASTINT (start) == endpos && insertion)
+ {
+ prop = Foverlay_get (overlay, Qinsert_behind_hooks);
+ call_overlay_mod_hooks (prop, overlay, start, end);
+ }
+ if (insertion
+ ? (XFASTINT (start) > startpos && XFASTINT (end) < endpos)
+ : (XFASTINT (start) >= startpos && XFASTINT (end) <= endpos))
+ {
+ prop = Foverlay_get (overlay, Qmodification_hooks);
+ call_overlay_mod_hooks (prop, overlay, start, end);
+ }
+ }
+
+ for (tail = current_buffer->overlays_after;
+ CONSP (tail);
+ tail = XCONS (tail)->cdr)
+ {
+ int startpos, endpos;
+ int ostart, oend;
+
+ overlay = XCONS (tail)->car;
+
+ ostart = OVERLAY_START (overlay);
+ oend = OVERLAY_END (overlay);
+ startpos = OVERLAY_POSITION (ostart);
+ if (XFASTINT (end) < startpos)
+ break;
+ if (XFASTINT (end) == startpos && insertion)
+ {
+ prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
+ call_overlay_mod_hooks (prop, overlay, start, end);
+ }
+ if (XFASTINT (start) == endpos && insertion)
+ {
+ prop = Foverlay_get (overlay, Qinsert_behind_hooks);
+ call_overlay_mod_hooks (prop, overlay, start, end);
+ }
+ if (insertion
+ ? (XFASTINT (start) > startpos && XFASTINT (end) < endpos)
+ : (XFASTINT (start) >= startpos && XFASTINT (end) <= endpos))
+ {
+ prop = Foverlay_get (overlay, Qmodification_hooks);
+ call_overlay_mod_hooks (prop, overlay, start, end);
+ }
+ }
+}
+
+static void
+call_overlay_mod_hooks (list, overlay, start, end)
+ Lisp_Object list, overlay, start, end;
+{
+ struct gcpro gcpro1;
+ GCPRO1 (list);
+ while (!NILP (list))
+ {
+ call3 (Fcar (list), overlay, start, end);
+ list = Fcdr (list);
+ }
+ UNGCPRO;
+}
+\f
/* Somebody has tried to store NEWVAL into the buffer-local slot with
offset XUINT (valcontents), and NEWVAL has an unacceptable type. */
void