Mercurial > emacs
comparison src/buffer.c @ 83541:694bbb62a75d
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-371
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-372
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-373
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-374
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-375
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-376
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-377
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-378
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-379
Merge from erc--emacs--21
* emacs@sv.gnu.org/emacs--devo--0--patch-380
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-381
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-382
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-383
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-384
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-385
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-386
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-387
Fix ERC bug introduced in last patch
* emacs@sv.gnu.org/emacs--devo--0--patch-388
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-389
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-390
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-391
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-392
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-393
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-394
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-395
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-396
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-397
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-398
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-399
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-400
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-401
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-402
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-403
Rcirc update from Ryan Yeske
* emacs@sv.gnu.org/emacs--devo--0--patch-404
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-405
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-406
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-407
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-408
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-409
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-410
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-411
Miscellaneous tq-related fixes.
* emacs@sv.gnu.org/emacs--devo--0--patch-412
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-121
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-122
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-123
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-124
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-125
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-126
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-127
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-581
| author | Karoly Lorentey <lorentey@elte.hu> |
|---|---|
| date | Sat, 14 Oct 2006 16:56:21 +0000 |
| parents | 02e39decdc84 71e0aa245bce |
| children | 2d56e13fd23d |
comparison
equal
deleted
inserted
replaced
| 83540:0c89a85addc3 | 83541:694bbb62a75d |
|---|---|
| 143 | 143 |
| 144 /* List of functions to call that can query about killing a buffer. | 144 /* List of functions to call that can query about killing a buffer. |
| 145 If any of these functions returns nil, we don't kill it. */ | 145 If any of these functions returns nil, we don't kill it. */ |
| 146 Lisp_Object Vkill_buffer_query_functions; | 146 Lisp_Object Vkill_buffer_query_functions; |
| 147 Lisp_Object Qkill_buffer_query_functions; | 147 Lisp_Object Qkill_buffer_query_functions; |
| 148 | |
| 149 /* Hook run before changing a major mode. */ | |
| 150 Lisp_Object Vchange_major_mode_hook, Qchange_major_mode_hook; | |
| 148 | 151 |
| 149 /* List of functions to call before changing an unmodified buffer. */ | 152 /* List of functions to call before changing an unmodified buffer. */ |
| 150 Lisp_Object Vfirst_change_hook; | 153 Lisp_Object Vfirst_change_hook; |
| 151 | 154 |
| 152 Lisp_Object Qfirst_change_hook; | 155 Lisp_Object Qfirst_change_hook; |
| 1709 Lisp_Object buffer, norecord; | 1712 Lisp_Object buffer, norecord; |
| 1710 { | 1713 { |
| 1711 char *err; | 1714 char *err; |
| 1712 | 1715 |
| 1713 if (EQ (buffer, Fwindow_buffer (selected_window))) | 1716 if (EQ (buffer, Fwindow_buffer (selected_window))) |
| 1714 /* Basically a NOP. Avoid signalling an error if the selected window | 1717 { |
| 1715 is dedicated, or a minibuffer, ... */ | 1718 /* Basically a NOP. Avoid signalling an error in the case where |
| 1716 return Fset_buffer (buffer); | 1719 the selected window is dedicated, or a minibuffer. */ |
| 1720 | |
| 1721 /* But do put this buffer at the front of the buffer list, | |
| 1722 unless that has been inhibited. Note that even if | |
| 1723 BUFFER is at the front of the main buffer-list already, | |
| 1724 we still want to move it to the front of the frame's buffer list. */ | |
| 1725 if (NILP (norecord)) | |
| 1726 record_buffer (buffer); | |
| 1727 return Fset_buffer (buffer); | |
| 1728 } | |
| 1717 | 1729 |
| 1718 err = no_switch_window (selected_window); | 1730 err = no_switch_window (selected_window); |
| 1719 if (err) error (err); | 1731 if (err) error (err); |
| 1720 | 1732 |
| 1721 return switch_to_buffer_1 (buffer, norecord); | 1733 return switch_to_buffer_1 (buffer, norecord); |
| 2140 (flag) | 2152 (flag) |
| 2141 Lisp_Object flag; | 2153 Lisp_Object flag; |
| 2142 { | 2154 { |
| 2143 struct Lisp_Marker *tail, *markers; | 2155 struct Lisp_Marker *tail, *markers; |
| 2144 struct buffer *other; | 2156 struct buffer *other; |
| 2145 int undo_enabled_p = !EQ (current_buffer->undo_list, Qt); | |
| 2146 int begv, zv; | 2157 int begv, zv; |
| 2147 int narrowed = (BEG != BEGV || Z != ZV); | 2158 int narrowed = (BEG != BEGV || Z != ZV); |
| 2148 int modified_p = !NILP (Fbuffer_modified_p (Qnil)); | 2159 int modified_p = !NILP (Fbuffer_modified_p (Qnil)); |
| 2160 Lisp_Object old_undo = current_buffer->undo_list; | |
| 2161 struct gcpro gcpro1; | |
| 2149 | 2162 |
| 2150 if (current_buffer->base_buffer) | 2163 if (current_buffer->base_buffer) |
| 2151 error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); | 2164 error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); |
| 2152 | 2165 |
| 2153 /* Do nothing if nothing actually changes. */ | 2166 /* Do nothing if nothing actually changes. */ |
| 2154 if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) | 2167 if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) |
| 2155 return flag; | 2168 return flag; |
| 2156 | 2169 |
| 2157 /* It would be better to update the list, | 2170 GCPRO1 (old_undo); |
| 2158 but this is good enough for now. */ | 2171 |
| 2159 if (undo_enabled_p) | 2172 /* Don't record these buffer changes. We will put a special undo entry |
| 2160 current_buffer->undo_list = Qt; | 2173 instead. */ |
| 2174 current_buffer->undo_list = Qt; | |
| 2161 | 2175 |
| 2162 /* If the cached position is for this buffer, clear it out. */ | 2176 /* If the cached position is for this buffer, clear it out. */ |
| 2163 clear_charpos_cache (current_buffer); | 2177 clear_charpos_cache (current_buffer); |
| 2164 | 2178 |
| 2165 if (NILP (flag)) | 2179 if (NILP (flag)) |
| 2355 /* Do this last, so it can calculate the new correspondences | 2369 /* Do this last, so it can calculate the new correspondences |
| 2356 between chars and bytes. */ | 2370 between chars and bytes. */ |
| 2357 set_intervals_multibyte (1); | 2371 set_intervals_multibyte (1); |
| 2358 } | 2372 } |
| 2359 | 2373 |
| 2360 if (undo_enabled_p) | 2374 if (!EQ (old_undo, Qt)) |
| 2361 current_buffer->undo_list = Qnil; | 2375 { |
| 2376 /* Represent all the above changes by a special undo entry. */ | |
| 2377 extern Lisp_Object Qapply; | |
| 2378 current_buffer->undo_list = Fcons (list3 (Qapply, | |
| 2379 intern ("set-buffer-multibyte"), | |
| 2380 NILP (flag) ? Qt : Qnil), | |
| 2381 old_undo); | |
| 2382 } | |
| 2383 | |
| 2384 UNGCPRO; | |
| 2362 | 2385 |
| 2363 /* Changing the multibyteness of a buffer means that all windows | 2386 /* Changing the multibyteness of a buffer means that all windows |
| 2364 showing that buffer must be updated thoroughly. */ | 2387 showing that buffer must be updated thoroughly. */ |
| 2365 current_buffer->prevent_redisplay_optimizations_p = 1; | 2388 current_buffer->prevent_redisplay_optimizations_p = 1; |
| 2366 ++windows_or_buffers_changed; | 2389 ++windows_or_buffers_changed; |
| 2414 { | 2437 { |
| 2415 register Lisp_Object alist, sym, tem; | 2438 register Lisp_Object alist, sym, tem; |
| 2416 Lisp_Object oalist; | 2439 Lisp_Object oalist; |
| 2417 | 2440 |
| 2418 if (!NILP (Vrun_hooks)) | 2441 if (!NILP (Vrun_hooks)) |
| 2419 call1 (Vrun_hooks, intern ("change-major-mode-hook")); | 2442 call1 (Vrun_hooks, Qchange_major_mode_hook); |
| 2420 oalist = current_buffer->local_var_alist; | 2443 oalist = current_buffer->local_var_alist; |
| 2421 | 2444 |
| 2422 /* Make sure none of the bindings in oalist | 2445 /* Make sure none of the bindings in oalist |
| 2423 remain swapped in, in their symbols. */ | 2446 remain swapped in, in their symbols. */ |
| 2424 | 2447 |
| 6026 | 6049 |
| 6027 DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions, | 6050 DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions, |
| 6028 doc: /* List of functions called with no args to query before killing a buffer. */); | 6051 doc: /* List of functions called with no args to query before killing a buffer. */); |
| 6029 Vkill_buffer_query_functions = Qnil; | 6052 Vkill_buffer_query_functions = Qnil; |
| 6030 | 6053 |
| 6054 DEFVAR_LISP ("change-major-mode-hook", &Vchange_major_mode_hook, | |
| 6055 doc: /* Normal hook run before changing the major mode of a buffer. | |
| 6056 The function `kill-all-local-variables' runs this before doing anything else. */); | |
| 6057 Vchange_major_mode_hook = Qnil; | |
| 6058 Qchange_major_mode_hook = intern ("change-major-mode-hook"); | |
| 6059 staticpro (&Qchange_major_mode_hook); | |
| 6060 | |
| 6031 defsubr (&Sbuffer_live_p); | 6061 defsubr (&Sbuffer_live_p); |
| 6032 defsubr (&Sbuffer_list); | 6062 defsubr (&Sbuffer_list); |
| 6033 defsubr (&Sget_buffer); | 6063 defsubr (&Sget_buffer); |
| 6034 defsubr (&Sget_file_buffer); | 6064 defsubr (&Sget_file_buffer); |
| 6035 defsubr (&Sget_buffer_create); | 6065 defsubr (&Sget_buffer_create); |
