diff options
| author | Karoly Lorentey | 2006-10-14 16:56:21 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-10-14 16:56:21 +0000 |
| commit | 3f87f67ee215ffeecbd2f53bd7f342cdf03f47df (patch) | |
| tree | 16f2af9111af08a94d608d96a957f5c3ec5effcc /src/buffer.c | |
| parent | 350e4fb815d7413ef6d339dd664014706f742927 (diff) | |
| parent | 7a210b69c7f92650c524766d1b9d3f3eefdd67c7 (diff) | |
| download | emacs-3f87f67ee215ffeecbd2f53bd7f342cdf03f47df.tar.gz emacs-3f87f67ee215ffeecbd2f53bd7f342cdf03f47df.zip | |
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
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/src/buffer.c b/src/buffer.c index dc6bcd8f6d3..6a11569c85a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -146,6 +146,9 @@ Lisp_Object Vinhibit_read_only; | |||
| 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 | 148 | ||
| 149 | /* Hook run before changing a major mode. */ | ||
| 150 | Lisp_Object Vchange_major_mode_hook, Qchange_major_mode_hook; | ||
| 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 | ||
| @@ -1711,9 +1714,18 @@ the window-buffer correspondences. */) | |||
| 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); |
| @@ -2142,10 +2154,11 @@ current buffer is cleared. */) | |||
| 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"); |
| @@ -2154,10 +2167,11 @@ current buffer is cleared. */) | |||
| 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); |
| @@ -2357,8 +2371,17 @@ current buffer is cleared. */) | |||
| 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. */ |
| @@ -2416,7 +2439,7 @@ the normal hook `change-major-mode-hook'. */) | |||
| 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 |
| @@ -6028,6 +6051,13 @@ t means to use hollow box cursor. See `cursor-type' for other values. */); | |||
| 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); |