comparison src/buffer.c @ 90596:6823a91487f2

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 399-413) - Update from CVS - Rcirc update from Ryan Yeske - Merge from gnus--rel--5.10 - Miscellaneous tq-related fixes. * gnus--rel--5.10 (patch 126-127) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-105
author Miles Bader <miles@gnu.org>
date Mon, 28 Aug 2006 04:33:45 +0000
parents 7f3f771c85fa 71e0aa245bce
children c358d0861b16
comparison
equal deleted inserted replaced
90595:fd59c4164a14 90596:6823a91487f2
1683 Lisp_Object buffer, norecord; 1683 Lisp_Object buffer, norecord;
1684 { 1684 {
1685 char *err; 1685 char *err;
1686 1686
1687 if (EQ (buffer, Fwindow_buffer (selected_window))) 1687 if (EQ (buffer, Fwindow_buffer (selected_window)))
1688 /* Basically a NOP. Avoid signalling an error if the selected window 1688 {
1689 is dedicated, or a minibuffer, ... */ 1689 /* Basically a NOP. Avoid signalling an error in the case where
1690 return Fset_buffer (buffer); 1690 the selected window is dedicated, or a minibuffer. */
1691
1692 /* But do put this buffer at the front of the buffer list,
1693 unless that has been inhibited. Note that even if
1694 BUFFER is at the front of the main buffer-list already,
1695 we still want to move it to the front of the frame's buffer list. */
1696 if (NILP (norecord))
1697 record_buffer (buffer);
1698 return Fset_buffer (buffer);
1699 }
1691 1700
1692 err = no_switch_window (selected_window); 1701 err = no_switch_window (selected_window);
1693 if (err) error (err); 1702 if (err) error (err);
1694 1703
1695 return switch_to_buffer_1 (buffer, norecord); 1704 return switch_to_buffer_1 (buffer, norecord);
2116 (flag) 2125 (flag)
2117 Lisp_Object flag; 2126 Lisp_Object flag;
2118 { 2127 {
2119 struct Lisp_Marker *tail, *markers; 2128 struct Lisp_Marker *tail, *markers;
2120 struct buffer *other; 2129 struct buffer *other;
2121 int undo_enabled_p = !EQ (current_buffer->undo_list, Qt);
2122 int begv, zv; 2130 int begv, zv;
2123 int narrowed = (BEG != BEGV || Z != ZV); 2131 int narrowed = (BEG != BEGV || Z != ZV);
2124 int modified_p = !NILP (Fbuffer_modified_p (Qnil)); 2132 int modified_p = !NILP (Fbuffer_modified_p (Qnil));
2133 Lisp_Object old_undo = current_buffer->undo_list;
2134 struct gcpro gcpro1;
2125 2135
2126 if (current_buffer->base_buffer) 2136 if (current_buffer->base_buffer)
2127 error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); 2137 error ("Cannot do `set-buffer-multibyte' on an indirect buffer");
2128 2138
2129 /* Do nothing if nothing actually changes. */ 2139 /* Do nothing if nothing actually changes. */
2130 if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) 2140 if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters))
2131 return flag; 2141 return flag;
2132 2142
2133 /* It would be better to update the list, 2143 GCPRO1 (old_undo);
2134 but this is good enough for now. */ 2144
2135 if (undo_enabled_p) 2145 /* Don't record these buffer changes. We will put a special undo entry
2136 current_buffer->undo_list = Qt; 2146 instead. */
2147 current_buffer->undo_list = Qt;
2137 2148
2138 /* If the cached position is for this buffer, clear it out. */ 2149 /* If the cached position is for this buffer, clear it out. */
2139 clear_charpos_cache (current_buffer); 2150 clear_charpos_cache (current_buffer);
2140 2151
2141 if (NILP (flag)) 2152 if (NILP (flag))
2344 /* Do this last, so it can calculate the new correspondences 2355 /* Do this last, so it can calculate the new correspondences
2345 between chars and bytes. */ 2356 between chars and bytes. */
2346 set_intervals_multibyte (1); 2357 set_intervals_multibyte (1);
2347 } 2358 }
2348 2359
2349 if (undo_enabled_p) 2360 if (!EQ (old_undo, Qt))
2350 current_buffer->undo_list = Qnil; 2361 {
2362 /* Represent all the above changes by a special undo entry. */
2363 extern Lisp_Object Qapply;
2364 current_buffer->undo_list = Fcons (list3 (Qapply,
2365 intern ("set-buffer-multibyte"),
2366 NILP (flag) ? Qt : Qnil),
2367 old_undo);
2368 }
2369
2370 UNGCPRO;
2351 2371
2352 /* Changing the multibyteness of a buffer means that all windows 2372 /* Changing the multibyteness of a buffer means that all windows
2353 showing that buffer must be updated thoroughly. */ 2373 showing that buffer must be updated thoroughly. */
2354 current_buffer->prevent_redisplay_optimizations_p = 1; 2374 current_buffer->prevent_redisplay_optimizations_p = 1;
2355 ++windows_or_buffers_changed; 2375 ++windows_or_buffers_changed;