comparison src/buffer.c @ 51939:d38453fdf2a0

(copy_overlays): Use EMACS_INT for positions. (Fswitch_to_buffer): Don't signal an error when switching to the same buffer in a dedicated window.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 15 Jul 2003 19:32:05 +0000
parents 6713947da36f
children d116f572d76b
comparison
equal deleted inserted replaced
51938:20d4eb1de9b0 51939:d38453fdf2a0
445 XSETBUFFER (buffer, b); 445 XSETBUFFER (buffer, b);
446 446
447 for (; list; list = list->next) 447 for (; list; list = list->next)
448 { 448 {
449 Lisp_Object overlay, start, end, old_overlay; 449 Lisp_Object overlay, start, end, old_overlay;
450 int charpos; 450 EMACS_INT charpos;
451 451
452 XSETMISC (old_overlay, list); 452 XSETMISC (old_overlay, list);
453 charpos = marker_position (OVERLAY_START (old_overlay)); 453 charpos = marker_position (OVERLAY_START (old_overlay));
454 start = Fmake_marker (); 454 start = Fmake_marker ();
455 Fset_marker (start, make_number (charpos), buffer); 455 Fset_marker (start, make_number (charpos), buffer);
1627 the window-buffer correspondences. */) 1627 the window-buffer correspondences. */)
1628 (buffer, norecord) 1628 (buffer, norecord)
1629 Lisp_Object buffer, norecord; 1629 Lisp_Object buffer, norecord;
1630 { 1630 {
1631 char *err; 1631 char *err;
1632
1633 if (EQ (buffer, Fwindow_buffer (selected_window)))
1634 /* Basically a NOP. Avoid signalling an error if the selected window
1635 is dedicated, or a minibuffer, ... */
1636 return Fset_buffer (buffer);
1632 1637
1633 err = no_switch_window (selected_window); 1638 err = no_switch_window (selected_window);
1634 if (err) error (err); 1639 if (err) error (err);
1635 1640
1636 return switch_to_buffer_1 (buffer, norecord); 1641 return switch_to_buffer_1 (buffer, norecord);
4095 int insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end)); 4100 int insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end));
4096 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 4101 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
4097 4102
4098 overlay = Qnil; 4103 overlay = Qnil;
4099 tail = NULL; 4104 tail = NULL;
4105
4106 /* We used to run the functions as soon as we found them and only register
4107 them in last_overlay_modification_hooks for the purpose of the `after'
4108 case. But running elisp code as we traverse the list of overlays is
4109 painful because the list can be modified by the elisp code so we had to
4110 copy at several places. We now simply do a read-only traversal that
4111 only collects the functions to run and we run them afterwards. It's
4112 simpler, especially since all the code was already there. -stef */
4100 4113
4101 if (!after) 4114 if (!after)
4102 { 4115 {
4103 /* We are being called before a change. 4116 /* We are being called before a change.
4104 Scan the overlays to find the functions to call. */ 4117 Scan the overlays to find the functions to call. */