diff options
| author | Joakim Verona | 2011-06-16 00:22:07 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-06-16 00:22:07 +0200 |
| commit | a7513ade3bc0fe79430d5541d88c9dcda0932bec (patch) | |
| tree | 4383951ba698a11e9f8933a9d8c72e00aa872a10 /src/buffer.c | |
| parent | 4bd51ad5c3445b644dfb017d5b57b10a90aa325f (diff) | |
| parent | 4bba86e6210a74326e843a8fdc8409127105e1fe (diff) | |
| download | emacs-a7513ade3bc0fe79430d5541d88c9dcda0932bec.tar.gz emacs-a7513ade3bc0fe79430d5541d88c9dcda0932bec.zip | |
merge from upstream
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 1406 |
1 files changed, 649 insertions, 757 deletions
diff --git a/src/buffer.c b/src/buffer.c index 2c6eb7b84e3..d7adf63c98b 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -43,7 +43,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 43 | struct buffer *current_buffer; /* the current buffer */ | 43 | struct buffer *current_buffer; /* the current buffer */ |
| 44 | 44 | ||
| 45 | /* First buffer in chain of all buffers (in reverse order of creation). | 45 | /* First buffer in chain of all buffers (in reverse order of creation). |
| 46 | Threaded through ->next. */ | 46 | Threaded through ->header.next.buffer. */ |
| 47 | 47 | ||
| 48 | struct buffer *all_buffers; | 48 | struct buffer *all_buffers; |
| 49 | 49 | ||
| @@ -100,6 +100,8 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; | |||
| 100 | 100 | ||
| 101 | int last_per_buffer_idx; | 101 | int last_per_buffer_idx; |
| 102 | 102 | ||
| 103 | static Lisp_Object Fset_buffer_major_mode (Lisp_Object); | ||
| 104 | static Lisp_Object Fdelete_overlay (Lisp_Object); | ||
| 103 | static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, | 105 | static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, |
| 104 | int after, Lisp_Object arg1, | 106 | int after, Lisp_Object arg1, |
| 105 | Lisp_Object arg2, Lisp_Object arg3); | 107 | Lisp_Object arg2, Lisp_Object arg3); |
| @@ -111,30 +113,33 @@ static void reset_buffer_local_variables (struct buffer *b, int permanent_too); | |||
| 111 | to prevent lossage due to user rplac'ing this alist or its elements. */ | 113 | to prevent lossage due to user rplac'ing this alist or its elements. */ |
| 112 | Lisp_Object Vbuffer_alist; | 114 | Lisp_Object Vbuffer_alist; |
| 113 | 115 | ||
| 114 | Lisp_Object Qkill_buffer_query_functions; | 116 | static Lisp_Object Qkill_buffer_query_functions; |
| 115 | 117 | ||
| 116 | /* Hook run before changing a major mode. */ | 118 | /* Hook run before changing a major mode. */ |
| 117 | Lisp_Object Qchange_major_mode_hook; | 119 | static Lisp_Object Qchange_major_mode_hook; |
| 118 | 120 | ||
| 119 | Lisp_Object Qfirst_change_hook; | 121 | Lisp_Object Qfirst_change_hook; |
| 120 | Lisp_Object Qbefore_change_functions; | 122 | Lisp_Object Qbefore_change_functions; |
| 121 | Lisp_Object Qafter_change_functions; | 123 | Lisp_Object Qafter_change_functions; |
| 122 | Lisp_Object Qucs_set_table_for_input; | 124 | static Lisp_Object Qucs_set_table_for_input; |
| 123 | 125 | ||
| 124 | Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; | 126 | static Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; |
| 125 | Lisp_Object Qpermanent_local_hook; | 127 | static Lisp_Object Qpermanent_local_hook; |
| 126 | 128 | ||
| 127 | Lisp_Object Qprotected_field; | 129 | static Lisp_Object Qprotected_field; |
| 128 | 130 | ||
| 129 | Lisp_Object QSFundamental; /* A string "Fundamental" */ | 131 | static Lisp_Object QSFundamental; /* A string "Fundamental" */ |
| 130 | 132 | ||
| 131 | Lisp_Object Qkill_buffer_hook; | 133 | static Lisp_Object Qkill_buffer_hook; |
| 134 | static Lisp_Object Qbuffer_list_update_hook; | ||
| 132 | 135 | ||
| 133 | Lisp_Object Qget_file_buffer; | 136 | static Lisp_Object Qget_file_buffer; |
| 134 | 137 | ||
| 135 | Lisp_Object Qoverlayp; | 138 | static Lisp_Object Qoverlayp; |
| 136 | 139 | ||
| 137 | Lisp_Object Qpriority, Qevaporate, Qbefore_string, Qafter_string; | 140 | Lisp_Object Qpriority, Qbefore_string, Qafter_string; |
| 141 | |||
| 142 | static Lisp_Object Qevaporate; | ||
| 138 | 143 | ||
| 139 | Lisp_Object Qmodification_hooks; | 144 | Lisp_Object Qmodification_hooks; |
| 140 | Lisp_Object Qinsert_in_front_hooks; | 145 | Lisp_Object Qinsert_in_front_hooks; |
| @@ -162,15 +167,15 @@ DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, | |||
| 162 | Value is nil if OBJECT is not a buffer or if it has been killed. */) | 167 | Value is nil if OBJECT is not a buffer or if it has been killed. */) |
| 163 | (Lisp_Object object) | 168 | (Lisp_Object object) |
| 164 | { | 169 | { |
| 165 | return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) | 170 | return ((BUFFERP (object) && ! NILP (BVAR (XBUFFER (object), name))) |
| 166 | ? Qt : Qnil); | 171 | ? Qt : Qnil); |
| 167 | } | 172 | } |
| 168 | 173 | ||
| 169 | DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0, | 174 | DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0, |
| 170 | doc: /* Return a list of all existing live buffers. | 175 | doc: /* Return a list of all existing live buffers. |
| 171 | If the optional arg FRAME is a frame, we return the buffer list | 176 | If the optional arg FRAME is a frame, we return the buffer list in the |
| 172 | in the proper order for that frame: the buffers in FRAME's `buffer-list' | 177 | proper order for that frame: the buffers show in FRAME come first, |
| 173 | frame parameter come first, followed by the rest of the buffers. */) | 178 | followed by the rest of the buffers. */) |
| 174 | (Lisp_Object frame) | 179 | (Lisp_Object frame) |
| 175 | { | 180 | { |
| 176 | Lisp_Object general; | 181 | Lisp_Object general; |
| @@ -182,9 +187,9 @@ frame parameter come first, followed by the rest of the buffers. */) | |||
| 182 | Lisp_Object args[3]; | 187 | Lisp_Object args[3]; |
| 183 | 188 | ||
| 184 | CHECK_FRAME (frame); | 189 | CHECK_FRAME (frame); |
| 185 | |||
| 186 | framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); | 190 | framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); |
| 187 | prevlist = Fnreverse (Fcopy_sequence (XFRAME (frame)->buried_buffer_list)); | 191 | prevlist = Fnreverse (Fcopy_sequence |
| 192 | (XFRAME (frame)->buried_buffer_list)); | ||
| 188 | 193 | ||
| 189 | /* Remove from GENERAL any buffer that duplicates one in | 194 | /* Remove from GENERAL any buffer that duplicates one in |
| 190 | FRAMELIST or PREVLIST. */ | 195 | FRAMELIST or PREVLIST. */ |
| @@ -206,8 +211,8 @@ frame parameter come first, followed by the rest of the buffers. */) | |||
| 206 | args[2] = prevlist; | 211 | args[2] = prevlist; |
| 207 | return Fnconc (3, args); | 212 | return Fnconc (3, args); |
| 208 | } | 213 | } |
| 209 | 214 | else | |
| 210 | return general; | 215 | return general; |
| 211 | } | 216 | } |
| 212 | 217 | ||
| 213 | /* Like Fassoc, but use Fstring_equal to compare | 218 | /* Like Fassoc, but use Fstring_equal to compare |
| @@ -266,8 +271,8 @@ See also `find-buffer-visiting'. */) | |||
| 266 | { | 271 | { |
| 267 | buf = Fcdr (XCAR (tail)); | 272 | buf = Fcdr (XCAR (tail)); |
| 268 | if (!BUFFERP (buf)) continue; | 273 | if (!BUFFERP (buf)) continue; |
| 269 | if (!STRINGP (XBUFFER (buf)->filename)) continue; | 274 | if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue; |
| 270 | tem = Fstring_equal (XBUFFER (buf)->filename, filename); | 275 | tem = Fstring_equal (BVAR (XBUFFER (buf), filename), filename); |
| 271 | if (!NILP (tem)) | 276 | if (!NILP (tem)) |
| 272 | return buf; | 277 | return buf; |
| 273 | } | 278 | } |
| @@ -283,17 +288,14 @@ get_truename_buffer (register Lisp_Object filename) | |||
| 283 | { | 288 | { |
| 284 | buf = Fcdr (XCAR (tail)); | 289 | buf = Fcdr (XCAR (tail)); |
| 285 | if (!BUFFERP (buf)) continue; | 290 | if (!BUFFERP (buf)) continue; |
| 286 | if (!STRINGP (XBUFFER (buf)->file_truename)) continue; | 291 | if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue; |
| 287 | tem = Fstring_equal (XBUFFER (buf)->file_truename, filename); | 292 | tem = Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename); |
| 288 | if (!NILP (tem)) | 293 | if (!NILP (tem)) |
| 289 | return buf; | 294 | return buf; |
| 290 | } | 295 | } |
| 291 | return Qnil; | 296 | return Qnil; |
| 292 | } | 297 | } |
| 293 | 298 | ||
| 294 | /* Incremented for each buffer created, to assign the buffer number. */ | ||
| 295 | int buffer_count; | ||
| 296 | |||
| 297 | DEFUN ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0, | 299 | DEFUN ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0, |
| 298 | doc: /* Return the buffer specified by BUFFER-OR-NAME, creating a new one if needed. | 300 | doc: /* Return the buffer specified by BUFFER-OR-NAME, creating a new one if needed. |
| 299 | If BUFFER-OR-NAME is a string and a live buffer with that name exists, | 301 | If BUFFER-OR-NAME is a string and a live buffer with that name exists, |
| @@ -328,17 +330,19 @@ even if it is dead. The return value is never nil. */) | |||
| 328 | alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); | 330 | alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); |
| 329 | UNBLOCK_INPUT; | 331 | UNBLOCK_INPUT; |
| 330 | if (! BUF_BEG_ADDR (b)) | 332 | if (! BUF_BEG_ADDR (b)) |
| 331 | buffer_memory_full (); | 333 | buffer_memory_full (BUF_GAP_SIZE (b) + 1); |
| 334 | |||
| 335 | b->pt = BEG; | ||
| 336 | b->begv = BEG; | ||
| 337 | b->zv = BEG; | ||
| 338 | b->pt_byte = BEG_BYTE; | ||
| 339 | b->begv_byte = BEG_BYTE; | ||
| 340 | b->zv_byte = BEG_BYTE; | ||
| 332 | 341 | ||
| 333 | BUF_PT (b) = BEG; | ||
| 334 | BUF_GPT (b) = BEG; | 342 | BUF_GPT (b) = BEG; |
| 335 | BUF_BEGV (b) = BEG; | ||
| 336 | BUF_ZV (b) = BEG; | ||
| 337 | BUF_Z (b) = BEG; | ||
| 338 | BUF_PT_BYTE (b) = BEG_BYTE; | ||
| 339 | BUF_GPT_BYTE (b) = BEG_BYTE; | 343 | BUF_GPT_BYTE (b) = BEG_BYTE; |
| 340 | BUF_BEGV_BYTE (b) = BEG_BYTE; | 344 | |
| 341 | BUF_ZV_BYTE (b) = BEG_BYTE; | 345 | BUF_Z (b) = BEG; |
| 342 | BUF_Z_BYTE (b) = BEG_BYTE; | 346 | BUF_Z_BYTE (b) = BEG_BYTE; |
| 343 | BUF_MODIFF (b) = 1; | 347 | BUF_MODIFF (b) = 1; |
| 344 | BUF_CHARS_MODIFF (b) = 1; | 348 | BUF_CHARS_MODIFF (b) = 1; |
| @@ -353,35 +357,38 @@ even if it is dead. The return value is never nil. */) | |||
| 353 | 357 | ||
| 354 | b->newline_cache = 0; | 358 | b->newline_cache = 0; |
| 355 | b->width_run_cache = 0; | 359 | b->width_run_cache = 0; |
| 356 | b->width_table = Qnil; | 360 | BVAR (b, width_table) = Qnil; |
| 357 | b->prevent_redisplay_optimizations_p = 1; | 361 | b->prevent_redisplay_optimizations_p = 1; |
| 358 | 362 | ||
| 359 | /* Put this on the chain of all buffers including killed ones. */ | 363 | /* Put this on the chain of all buffers including killed ones. */ |
| 360 | b->next = all_buffers; | 364 | b->header.next.buffer = all_buffers; |
| 361 | all_buffers = b; | 365 | all_buffers = b; |
| 362 | 366 | ||
| 363 | /* An ordinary buffer normally doesn't need markers | 367 | /* An ordinary buffer normally doesn't need markers |
| 364 | to handle BEGV and ZV. */ | 368 | to handle BEGV and ZV. */ |
| 365 | b->pt_marker = Qnil; | 369 | BVAR (b, pt_marker) = Qnil; |
| 366 | b->begv_marker = Qnil; | 370 | BVAR (b, begv_marker) = Qnil; |
| 367 | b->zv_marker = Qnil; | 371 | BVAR (b, zv_marker) = Qnil; |
| 368 | 372 | ||
| 369 | name = Fcopy_sequence (buffer_or_name); | 373 | name = Fcopy_sequence (buffer_or_name); |
| 370 | STRING_SET_INTERVALS (name, NULL_INTERVAL); | 374 | STRING_SET_INTERVALS (name, NULL_INTERVAL); |
| 371 | b->name = name; | 375 | BVAR (b, name) = name; |
| 372 | 376 | ||
| 373 | b->undo_list = (SREF (name, 0) != ' ') ? Qnil : Qt; | 377 | BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; |
| 374 | 378 | ||
| 375 | reset_buffer (b); | 379 | reset_buffer (b); |
| 376 | reset_buffer_local_variables (b, 1); | 380 | reset_buffer_local_variables (b, 1); |
| 377 | 381 | ||
| 378 | b->mark = Fmake_marker (); | 382 | BVAR (b, mark) = Fmake_marker (); |
| 379 | BUF_MARKERS (b) = NULL; | 383 | BUF_MARKERS (b) = NULL; |
| 380 | b->name = name; | 384 | BVAR (b, name) = name; |
| 381 | 385 | ||
| 382 | /* Put this in the alist of all live buffers. */ | 386 | /* Put this in the alist of all live buffers. */ |
| 383 | XSETBUFFER (buffer, b); | 387 | XSETBUFFER (buffer, b); |
| 384 | Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buffer), Qnil)); | 388 | Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buffer), Qnil)); |
| 389 | /* And run buffer-list-update-hook. */ | ||
| 390 | if (!NILP (Vrun_hooks)) | ||
| 391 | call1 (Vrun_hooks, Qbuffer_list_update_hook); | ||
| 385 | 392 | ||
| 386 | /* An error in calling the function here (should someone redefine it) | 393 | /* An error in calling the function here (should someone redefine it) |
| 387 | can lead to infinite regress until you run out of stack. rms | 394 | can lead to infinite regress until you run out of stack. rms |
| @@ -486,9 +493,56 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) | |||
| 486 | 493 | ||
| 487 | /* Get (a copy of) the alist of Lisp-level local variables of FROM | 494 | /* Get (a copy of) the alist of Lisp-level local variables of FROM |
| 488 | and install that in TO. */ | 495 | and install that in TO. */ |
| 489 | to->local_var_alist = buffer_lisp_local_variables (from); | 496 | BVAR (to, local_var_alist) = buffer_lisp_local_variables (from); |
| 497 | } | ||
| 498 | |||
| 499 | |||
| 500 | /* If buffer B has markers to record PT, BEGV and ZV when it is not | ||
| 501 | current, update these markers. */ | ||
| 502 | |||
| 503 | static void | ||
| 504 | record_buffer_markers (struct buffer *b) | ||
| 505 | { | ||
| 506 | if (! NILP (BVAR (b, pt_marker))) | ||
| 507 | { | ||
| 508 | Lisp_Object buffer; | ||
| 509 | |||
| 510 | eassert (!NILP (BVAR (b, begv_marker))); | ||
| 511 | eassert (!NILP (BVAR (b, zv_marker))); | ||
| 512 | |||
| 513 | XSETBUFFER (buffer, b); | ||
| 514 | set_marker_both (BVAR (b, pt_marker), buffer, b->pt, b->pt_byte); | ||
| 515 | set_marker_both (BVAR (b, begv_marker), buffer, b->begv, b->begv_byte); | ||
| 516 | set_marker_both (BVAR (b, zv_marker), buffer, b->zv, b->zv_byte); | ||
| 517 | } | ||
| 518 | } | ||
| 519 | |||
| 520 | |||
| 521 | /* If buffer B has markers to record PT, BEGV and ZV when it is not | ||
| 522 | current, fetch these values into B->begv etc. */ | ||
| 523 | |||
| 524 | static void | ||
| 525 | fetch_buffer_markers (struct buffer *b) | ||
| 526 | { | ||
| 527 | if (! NILP (BVAR (b, pt_marker))) | ||
| 528 | { | ||
| 529 | Lisp_Object m; | ||
| 530 | |||
| 531 | eassert (!NILP (BVAR (b, begv_marker))); | ||
| 532 | eassert (!NILP (BVAR (b, zv_marker))); | ||
| 533 | |||
| 534 | m = BVAR (b, pt_marker); | ||
| 535 | SET_BUF_PT_BOTH (b, marker_position (m), marker_byte_position (m)); | ||
| 536 | |||
| 537 | m = BVAR (b, begv_marker); | ||
| 538 | SET_BUF_BEGV_BOTH (b, marker_position (m), marker_byte_position (m)); | ||
| 539 | |||
| 540 | m = BVAR (b, zv_marker); | ||
| 541 | SET_BUF_ZV_BOTH (b, marker_position (m), marker_byte_position (m)); | ||
| 542 | } | ||
| 490 | } | 543 | } |
| 491 | 544 | ||
| 545 | |||
| 492 | DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, | 546 | DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, |
| 493 | 2, 3, | 547 | 2, 3, |
| 494 | "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", | 548 | "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", |
| @@ -512,7 +566,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 512 | base_buffer = Fget_buffer (base_buffer); | 566 | base_buffer = Fget_buffer (base_buffer); |
| 513 | if (NILP (base_buffer)) | 567 | if (NILP (base_buffer)) |
| 514 | error ("No such buffer: `%s'", SDATA (tem)); | 568 | error ("No such buffer: `%s'", SDATA (tem)); |
| 515 | if (NILP (XBUFFER (base_buffer)->name)) | 569 | if (NILP (BVAR (XBUFFER (base_buffer), name))) |
| 516 | error ("Base buffer has been killed"); | 570 | error ("Base buffer has been killed"); |
| 517 | 571 | ||
| 518 | if (SCHARS (name) == 0) | 572 | if (SCHARS (name) == 0) |
| @@ -527,24 +581,24 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 527 | /* Use the base buffer's text object. */ | 581 | /* Use the base buffer's text object. */ |
| 528 | b->text = b->base_buffer->text; | 582 | b->text = b->base_buffer->text; |
| 529 | 583 | ||
| 530 | BUF_BEGV (b) = BUF_BEGV (b->base_buffer); | 584 | b->pt = b->base_buffer->pt; |
| 531 | BUF_ZV (b) = BUF_ZV (b->base_buffer); | 585 | b->begv = b->base_buffer->begv; |
| 532 | BUF_PT (b) = BUF_PT (b->base_buffer); | 586 | b->zv = b->base_buffer->zv; |
| 533 | BUF_BEGV_BYTE (b) = BUF_BEGV_BYTE (b->base_buffer); | 587 | b->pt_byte = b->base_buffer->pt_byte; |
| 534 | BUF_ZV_BYTE (b) = BUF_ZV_BYTE (b->base_buffer); | 588 | b->begv_byte = b->base_buffer->begv_byte; |
| 535 | BUF_PT_BYTE (b) = BUF_PT_BYTE (b->base_buffer); | 589 | b->zv_byte = b->base_buffer->zv_byte; |
| 536 | 590 | ||
| 537 | b->newline_cache = 0; | 591 | b->newline_cache = 0; |
| 538 | b->width_run_cache = 0; | 592 | b->width_run_cache = 0; |
| 539 | b->width_table = Qnil; | 593 | BVAR (b, width_table) = Qnil; |
| 540 | 594 | ||
| 541 | /* Put this on the chain of all buffers including killed ones. */ | 595 | /* Put this on the chain of all buffers including killed ones. */ |
| 542 | b->next = all_buffers; | 596 | b->header.next.buffer = all_buffers; |
| 543 | all_buffers = b; | 597 | all_buffers = b; |
| 544 | 598 | ||
| 545 | name = Fcopy_sequence (name); | 599 | name = Fcopy_sequence (name); |
| 546 | STRING_SET_INTERVALS (name, NULL_INTERVAL); | 600 | STRING_SET_INTERVALS (name, NULL_INTERVAL); |
| 547 | b->name = name; | 601 | BVAR (b, name) = name; |
| 548 | 602 | ||
| 549 | reset_buffer (b); | 603 | reset_buffer (b); |
| 550 | reset_buffer_local_variables (b, 1); | 604 | reset_buffer_local_variables (b, 1); |
| @@ -553,57 +607,56 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 553 | XSETBUFFER (buf, b); | 607 | XSETBUFFER (buf, b); |
| 554 | Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); | 608 | Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); |
| 555 | 609 | ||
| 556 | b->mark = Fmake_marker (); | 610 | BVAR (b, mark) = Fmake_marker (); |
| 557 | b->name = name; | 611 | BVAR (b, name) = name; |
| 558 | 612 | ||
| 559 | /* The multibyte status belongs to the base buffer. */ | 613 | /* The multibyte status belongs to the base buffer. */ |
| 560 | b->enable_multibyte_characters = b->base_buffer->enable_multibyte_characters; | 614 | BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters); |
| 561 | 615 | ||
| 562 | /* Make sure the base buffer has markers for its narrowing. */ | 616 | /* Make sure the base buffer has markers for its narrowing. */ |
| 563 | if (NILP (b->base_buffer->pt_marker)) | 617 | if (NILP (BVAR (b->base_buffer, pt_marker))) |
| 564 | { | ||
| 565 | b->base_buffer->pt_marker = Fmake_marker (); | ||
| 566 | set_marker_both (b->base_buffer->pt_marker, base_buffer, | ||
| 567 | BUF_PT (b->base_buffer), | ||
| 568 | BUF_PT_BYTE (b->base_buffer)); | ||
| 569 | } | ||
| 570 | if (NILP (b->base_buffer->begv_marker)) | ||
| 571 | { | ||
| 572 | b->base_buffer->begv_marker = Fmake_marker (); | ||
| 573 | set_marker_both (b->base_buffer->begv_marker, base_buffer, | ||
| 574 | BUF_BEGV (b->base_buffer), | ||
| 575 | BUF_BEGV_BYTE (b->base_buffer)); | ||
| 576 | } | ||
| 577 | if (NILP (b->base_buffer->zv_marker)) | ||
| 578 | { | 618 | { |
| 579 | b->base_buffer->zv_marker = Fmake_marker (); | 619 | eassert (NILP (BVAR (b->base_buffer, begv_marker))); |
| 580 | set_marker_both (b->base_buffer->zv_marker, base_buffer, | 620 | eassert (NILP (BVAR (b->base_buffer, zv_marker))); |
| 581 | BUF_ZV (b->base_buffer), | 621 | |
| 582 | BUF_ZV_BYTE (b->base_buffer)); | 622 | BVAR (b->base_buffer, pt_marker) = Fmake_marker (); |
| 583 | XMARKER (b->base_buffer->zv_marker)->insertion_type = 1; | 623 | set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, |
| 624 | b->base_buffer->pt, | ||
| 625 | b->base_buffer->pt_byte); | ||
| 626 | |||
| 627 | BVAR (b->base_buffer, begv_marker) = Fmake_marker (); | ||
| 628 | set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer, | ||
| 629 | b->base_buffer->begv, | ||
| 630 | b->base_buffer->begv_byte); | ||
| 631 | |||
| 632 | BVAR (b->base_buffer, zv_marker) = Fmake_marker (); | ||
| 633 | set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer, | ||
| 634 | b->base_buffer->zv, | ||
| 635 | b->base_buffer->zv_byte); | ||
| 636 | XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; | ||
| 584 | } | 637 | } |
| 585 | 638 | ||
| 586 | if (NILP (clone)) | 639 | if (NILP (clone)) |
| 587 | { | 640 | { |
| 588 | /* Give the indirect buffer markers for its narrowing. */ | 641 | /* Give the indirect buffer markers for its narrowing. */ |
| 589 | b->pt_marker = Fmake_marker (); | 642 | BVAR (b, pt_marker) = Fmake_marker (); |
| 590 | set_marker_both (b->pt_marker, buf, BUF_PT (b), BUF_PT_BYTE (b)); | 643 | set_marker_both (BVAR (b, pt_marker), buf, b->pt, b->pt_byte); |
| 591 | b->begv_marker = Fmake_marker (); | 644 | BVAR (b, begv_marker) = Fmake_marker (); |
| 592 | set_marker_both (b->begv_marker, buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); | 645 | set_marker_both (BVAR (b, begv_marker), buf, b->begv, b->begv_byte); |
| 593 | b->zv_marker = Fmake_marker (); | 646 | BVAR (b, zv_marker) = Fmake_marker (); |
| 594 | set_marker_both (b->zv_marker, buf, BUF_ZV (b), BUF_ZV_BYTE (b)); | 647 | set_marker_both (BVAR (b, zv_marker), buf, b->zv, b->zv_byte); |
| 595 | XMARKER (b->zv_marker)->insertion_type = 1; | 648 | XMARKER (BVAR (b, zv_marker))->insertion_type = 1; |
| 596 | } | 649 | } |
| 597 | else | 650 | else |
| 598 | { | 651 | { |
| 599 | struct buffer *old_b = current_buffer; | 652 | struct buffer *old_b = current_buffer; |
| 600 | 653 | ||
| 601 | clone_per_buffer_values (b->base_buffer, b); | 654 | clone_per_buffer_values (b->base_buffer, b); |
| 602 | b->filename = Qnil; | 655 | BVAR (b, filename) = Qnil; |
| 603 | b->file_truename = Qnil; | 656 | BVAR (b, file_truename) = Qnil; |
| 604 | b->display_count = make_number (0); | 657 | BVAR (b, display_count) = make_number (0); |
| 605 | b->backed_up = Qnil; | 658 | BVAR (b, backed_up) = Qnil; |
| 606 | b->auto_save_file_name = Qnil; | 659 | BVAR (b, auto_save_file_name) = Qnil; |
| 607 | set_buffer_internal_1 (b); | 660 | set_buffer_internal_1 (b); |
| 608 | Fset (intern ("buffer-save-without-query"), Qnil); | 661 | Fset (intern ("buffer-save-without-query"), Qnil); |
| 609 | Fset (intern ("buffer-file-number"), Qnil); | 662 | Fset (intern ("buffer-file-number"), Qnil); |
| @@ -611,6 +664,10 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 611 | set_buffer_internal_1 (old_b); | 664 | set_buffer_internal_1 (old_b); |
| 612 | } | 665 | } |
| 613 | 666 | ||
| 667 | /* Run buffer-list-update-hook. */ | ||
| 668 | if (!NILP (Vrun_hooks)) | ||
| 669 | call1 (Vrun_hooks, Qbuffer_list_update_hook); | ||
| 670 | |||
| 614 | return buf; | 671 | return buf; |
| 615 | } | 672 | } |
| 616 | 673 | ||
| @@ -647,34 +704,34 @@ delete_all_overlays (struct buffer *b) | |||
| 647 | void | 704 | void |
| 648 | reset_buffer (register struct buffer *b) | 705 | reset_buffer (register struct buffer *b) |
| 649 | { | 706 | { |
| 650 | b->filename = Qnil; | 707 | BVAR (b, filename) = Qnil; |
| 651 | b->file_truename = Qnil; | 708 | BVAR (b, file_truename) = Qnil; |
| 652 | b->directory = (current_buffer) ? current_buffer->directory : Qnil; | 709 | BVAR (b, directory) = (current_buffer) ? BVAR (current_buffer, directory) : Qnil; |
| 653 | b->modtime = 0; | 710 | b->modtime = 0; |
| 654 | b->modtime_size = -1; | 711 | b->modtime_size = -1; |
| 655 | XSETFASTINT (b->save_length, 0); | 712 | XSETFASTINT (BVAR (b, save_length), 0); |
| 656 | b->last_window_start = 1; | 713 | b->last_window_start = 1; |
| 657 | /* It is more conservative to start out "changed" than "unchanged". */ | 714 | /* It is more conservative to start out "changed" than "unchanged". */ |
| 658 | b->clip_changed = 0; | 715 | b->clip_changed = 0; |
| 659 | b->prevent_redisplay_optimizations_p = 1; | 716 | b->prevent_redisplay_optimizations_p = 1; |
| 660 | b->backed_up = Qnil; | 717 | BVAR (b, backed_up) = Qnil; |
| 661 | BUF_AUTOSAVE_MODIFF (b) = 0; | 718 | BUF_AUTOSAVE_MODIFF (b) = 0; |
| 662 | b->auto_save_failure_time = -1; | 719 | b->auto_save_failure_time = -1; |
| 663 | b->auto_save_file_name = Qnil; | 720 | BVAR (b, auto_save_file_name) = Qnil; |
| 664 | b->read_only = Qnil; | 721 | BVAR (b, read_only) = Qnil; |
| 665 | b->overlays_before = NULL; | 722 | b->overlays_before = NULL; |
| 666 | b->overlays_after = NULL; | 723 | b->overlays_after = NULL; |
| 667 | b->overlay_center = BEG; | 724 | b->overlay_center = BEG; |
| 668 | b->mark_active = Qnil; | 725 | BVAR (b, mark_active) = Qnil; |
| 669 | b->point_before_scroll = Qnil; | 726 | BVAR (b, point_before_scroll) = Qnil; |
| 670 | b->file_format = Qnil; | 727 | BVAR (b, file_format) = Qnil; |
| 671 | b->auto_save_file_format = Qt; | 728 | BVAR (b, auto_save_file_format) = Qt; |
| 672 | b->last_selected_window = Qnil; | 729 | BVAR (b, last_selected_window) = Qnil; |
| 673 | XSETINT (b->display_count, 0); | 730 | XSETINT (BVAR (b, display_count), 0); |
| 674 | b->display_time = Qnil; | 731 | BVAR (b, display_time) = Qnil; |
| 675 | b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters; | 732 | BVAR (b, enable_multibyte_characters) = BVAR (&buffer_defaults, enable_multibyte_characters); |
| 676 | b->cursor_type = buffer_defaults.cursor_type; | 733 | BVAR (b, cursor_type) = BVAR (&buffer_defaults, cursor_type); |
| 677 | b->extra_line_spacing = buffer_defaults.extra_line_spacing; | 734 | BVAR (b, extra_line_spacing) = BVAR (&buffer_defaults, extra_line_spacing); |
| 678 | 735 | ||
| 679 | b->display_error_modiff = 0; | 736 | b->display_error_modiff = 0; |
| 680 | } | 737 | } |
| @@ -698,10 +755,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) | |||
| 698 | things that depend on the major mode. | 755 | things that depend on the major mode. |
| 699 | default-major-mode is handled at a higher level. | 756 | default-major-mode is handled at a higher level. |
| 700 | We ignore it here. */ | 757 | We ignore it here. */ |
| 701 | b->major_mode = Qfundamental_mode; | 758 | BVAR (b, major_mode) = Qfundamental_mode; |
| 702 | b->keymap = Qnil; | 759 | BVAR (b, keymap) = Qnil; |
| 703 | b->mode_name = QSFundamental; | 760 | BVAR (b, mode_name) = QSFundamental; |
| 704 | b->minor_modes = Qnil; | 761 | BVAR (b, minor_modes) = Qnil; |
| 705 | 762 | ||
| 706 | /* If the standard case table has been altered and invalidated, | 763 | /* If the standard case table has been altered and invalidated, |
| 707 | fix up its insides first. */ | 764 | fix up its insides first. */ |
| @@ -710,22 +767,19 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) | |||
| 710 | && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) | 767 | && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) |
| 711 | Fset_standard_case_table (Vascii_downcase_table); | 768 | Fset_standard_case_table (Vascii_downcase_table); |
| 712 | 769 | ||
| 713 | b->downcase_table = Vascii_downcase_table; | 770 | BVAR (b, downcase_table) = Vascii_downcase_table; |
| 714 | b->upcase_table = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; | 771 | BVAR (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; |
| 715 | b->case_canon_table = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; | 772 | BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; |
| 716 | b->case_eqv_table = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; | 773 | BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; |
| 717 | b->invisibility_spec = Qt; | 774 | BVAR (b, invisibility_spec) = Qt; |
| 718 | #ifndef DOS_NT | ||
| 719 | b->buffer_file_type = Qnil; | ||
| 720 | #endif | ||
| 721 | 775 | ||
| 722 | /* Reset all (or most) per-buffer variables to their defaults. */ | 776 | /* Reset all (or most) per-buffer variables to their defaults. */ |
| 723 | if (permanent_too) | 777 | if (permanent_too) |
| 724 | b->local_var_alist = Qnil; | 778 | BVAR (b, local_var_alist) = Qnil; |
| 725 | else | 779 | else |
| 726 | { | 780 | { |
| 727 | Lisp_Object tmp, prop, last = Qnil; | 781 | Lisp_Object tmp, prop, last = Qnil; |
| 728 | for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) | 782 | for (tmp = BVAR (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp)) |
| 729 | if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) | 783 | if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) |
| 730 | { | 784 | { |
| 731 | /* If permanent-local, keep it. */ | 785 | /* If permanent-local, keep it. */ |
| @@ -755,7 +809,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) | |||
| 755 | } | 809 | } |
| 756 | /* Delete this local variable. */ | 810 | /* Delete this local variable. */ |
| 757 | else if (NILP (last)) | 811 | else if (NILP (last)) |
| 758 | b->local_var_alist = XCDR (tmp); | 812 | BVAR (b, local_var_alist) = XCDR (tmp); |
| 759 | else | 813 | else |
| 760 | XSETCDR (last, XCDR (tmp)); | 814 | XSETCDR (last, XCDR (tmp)); |
| 761 | } | 815 | } |
| @@ -785,8 +839,8 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) | |||
| 785 | and set-visited-file-name ought to be able to use this to really | 839 | and set-visited-file-name ought to be able to use this to really |
| 786 | rename the buffer properly. */ | 840 | rename the buffer properly. */ |
| 787 | 841 | ||
| 788 | DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name, | 842 | DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, |
| 789 | 1, 2, 0, | 843 | Sgenerate_new_buffer_name, 1, 2, 0, |
| 790 | doc: /* Return a string that is the name of no existing buffer based on NAME. | 844 | doc: /* Return a string that is the name of no existing buffer based on NAME. |
| 791 | If there is no live buffer named NAME, then return NAME. | 845 | If there is no live buffer named NAME, then return NAME. |
| 792 | Otherwise modify name by appending `<NUMBER>', incrementing NUMBER | 846 | Otherwise modify name by appending `<NUMBER>', incrementing NUMBER |
| @@ -796,8 +850,8 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) | |||
| 796 | (register Lisp_Object name, Lisp_Object ignore) | 850 | (register Lisp_Object name, Lisp_Object ignore) |
| 797 | { | 851 | { |
| 798 | register Lisp_Object gentemp, tem; | 852 | register Lisp_Object gentemp, tem; |
| 799 | int count; | 853 | EMACS_INT count; |
| 800 | char number[10]; | 854 | char number[INT_BUFSIZE_BOUND (EMACS_INT) + sizeof "<>"]; |
| 801 | 855 | ||
| 802 | CHECK_STRING (name); | 856 | CHECK_STRING (name); |
| 803 | 857 | ||
| @@ -811,7 +865,7 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) | |||
| 811 | count = 1; | 865 | count = 1; |
| 812 | while (1) | 866 | while (1) |
| 813 | { | 867 | { |
| 814 | sprintf (number, "<%d>", ++count); | 868 | sprintf (number, "<%"pI"d>", ++count); |
| 815 | gentemp = concat2 (name, build_string (number)); | 869 | gentemp = concat2 (name, build_string (number)); |
| 816 | tem = Fstring_equal (gentemp, ignore); | 870 | tem = Fstring_equal (gentemp, ignore); |
| 817 | if (!NILP (tem)) | 871 | if (!NILP (tem)) |
| @@ -830,9 +884,9 @@ Return nil if BUFFER has been killed. */) | |||
| 830 | (register Lisp_Object buffer) | 884 | (register Lisp_Object buffer) |
| 831 | { | 885 | { |
| 832 | if (NILP (buffer)) | 886 | if (NILP (buffer)) |
| 833 | return current_buffer->name; | 887 | return BVAR (current_buffer, name); |
| 834 | CHECK_BUFFER (buffer); | 888 | CHECK_BUFFER (buffer); |
| 835 | return XBUFFER (buffer)->name; | 889 | return BVAR (XBUFFER (buffer), name); |
| 836 | } | 890 | } |
| 837 | 891 | ||
| 838 | DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, | 892 | DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, |
| @@ -841,9 +895,9 @@ No argument or nil as argument means use the current buffer. */) | |||
| 841 | (register Lisp_Object buffer) | 895 | (register Lisp_Object buffer) |
| 842 | { | 896 | { |
| 843 | if (NILP (buffer)) | 897 | if (NILP (buffer)) |
| 844 | return current_buffer->filename; | 898 | return BVAR (current_buffer, filename); |
| 845 | CHECK_BUFFER (buffer); | 899 | CHECK_BUFFER (buffer); |
| 846 | return XBUFFER (buffer)->filename; | 900 | return BVAR (XBUFFER (buffer), filename); |
| 847 | } | 901 | } |
| 848 | 902 | ||
| 849 | DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, | 903 | DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, |
| @@ -895,7 +949,7 @@ is the default binding of the variable. */) | |||
| 895 | { /* Look in local_var_alist. */ | 949 | { /* Look in local_var_alist. */ |
| 896 | struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); | 950 | struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); |
| 897 | XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ | 951 | XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ |
| 898 | result = Fassoc (variable, buf->local_var_alist); | 952 | result = Fassoc (variable, BVAR (buf, local_var_alist)); |
| 899 | if (!NILP (result)) | 953 | if (!NILP (result)) |
| 900 | { | 954 | { |
| 901 | if (blv->fwd) | 955 | if (blv->fwd) |
| @@ -944,7 +998,7 @@ buffer_lisp_local_variables (struct buffer *buf) | |||
| 944 | { | 998 | { |
| 945 | Lisp_Object result = Qnil; | 999 | Lisp_Object result = Qnil; |
| 946 | register Lisp_Object tail; | 1000 | register Lisp_Object tail; |
| 947 | for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) | 1001 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) |
| 948 | { | 1002 | { |
| 949 | Lisp_Object val, elt; | 1003 | Lisp_Object val, elt; |
| 950 | 1004 | ||
| @@ -1043,9 +1097,9 @@ A non-nil FLAG means mark the buffer modified. */) | |||
| 1043 | /* If buffer becoming modified, lock the file. | 1097 | /* If buffer becoming modified, lock the file. |
| 1044 | If buffer becoming unmodified, unlock the file. */ | 1098 | If buffer becoming unmodified, unlock the file. */ |
| 1045 | 1099 | ||
| 1046 | fn = current_buffer->file_truename; | 1100 | fn = BVAR (current_buffer, file_truename); |
| 1047 | /* Test buffer-file-name so that binding it to nil is effective. */ | 1101 | /* Test buffer-file-name so that binding it to nil is effective. */ |
| 1048 | if (!NILP (fn) && ! NILP (current_buffer->filename)) | 1102 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) |
| 1049 | { | 1103 | { |
| 1050 | already = SAVE_MODIFF < MODIFF; | 1104 | already = SAVE_MODIFF < MODIFF; |
| 1051 | if (!already && !NILP (flag)) | 1105 | if (!already && !NILP (flag)) |
| @@ -1110,9 +1164,9 @@ state of the current buffer. Use with care. */) | |||
| 1110 | /* If buffer becoming modified, lock the file. | 1164 | /* If buffer becoming modified, lock the file. |
| 1111 | If buffer becoming unmodified, unlock the file. */ | 1165 | If buffer becoming unmodified, unlock the file. */ |
| 1112 | 1166 | ||
| 1113 | fn = current_buffer->file_truename; | 1167 | fn = BVAR (current_buffer, file_truename); |
| 1114 | /* Test buffer-file-name so that binding it to nil is effective. */ | 1168 | /* Test buffer-file-name so that binding it to nil is effective. */ |
| 1115 | if (!NILP (fn) && ! NILP (current_buffer->filename)) | 1169 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) |
| 1116 | { | 1170 | { |
| 1117 | int already = SAVE_MODIFF < MODIFF; | 1171 | int already = SAVE_MODIFF < MODIFF; |
| 1118 | if (!already && !NILP (flag)) | 1172 | if (!already && !NILP (flag)) |
| @@ -1199,14 +1253,14 @@ This does not change the name of the visited file (if any). */) | |||
| 1199 | with the original name. It makes UNIQUE equivalent to | 1253 | with the original name. It makes UNIQUE equivalent to |
| 1200 | (rename-buffer (generate-new-buffer-name NEWNAME)). */ | 1254 | (rename-buffer (generate-new-buffer-name NEWNAME)). */ |
| 1201 | if (NILP (unique) && XBUFFER (tem) == current_buffer) | 1255 | if (NILP (unique) && XBUFFER (tem) == current_buffer) |
| 1202 | return current_buffer->name; | 1256 | return BVAR (current_buffer, name); |
| 1203 | if (!NILP (unique)) | 1257 | if (!NILP (unique)) |
| 1204 | newname = Fgenerate_new_buffer_name (newname, current_buffer->name); | 1258 | newname = Fgenerate_new_buffer_name (newname, BVAR (current_buffer, name)); |
| 1205 | else | 1259 | else |
| 1206 | error ("Buffer name `%s' is in use", SDATA (newname)); | 1260 | error ("Buffer name `%s' is in use", SDATA (newname)); |
| 1207 | } | 1261 | } |
| 1208 | 1262 | ||
| 1209 | current_buffer->name = newname; | 1263 | BVAR (current_buffer, name) = newname; |
| 1210 | 1264 | ||
| 1211 | /* Catch redisplay's attention. Unless we do this, the mode lines for | 1265 | /* Catch redisplay's attention. Unless we do this, the mode lines for |
| 1212 | any windows displaying current_buffer will stay unchanged. */ | 1266 | any windows displaying current_buffer will stay unchanged. */ |
| @@ -1214,85 +1268,122 @@ This does not change the name of the visited file (if any). */) | |||
| 1214 | 1268 | ||
| 1215 | XSETBUFFER (buf, current_buffer); | 1269 | XSETBUFFER (buf, current_buffer); |
| 1216 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); | 1270 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); |
| 1217 | if (NILP (current_buffer->filename) | 1271 | if (NILP (BVAR (current_buffer, filename)) |
| 1218 | && !NILP (current_buffer->auto_save_file_name)) | 1272 | && !NILP (BVAR (current_buffer, auto_save_file_name))) |
| 1219 | call0 (intern ("rename-auto-save-file")); | 1273 | call0 (intern ("rename-auto-save-file")); |
| 1274 | |||
| 1275 | /* Run buffer-list-update-hook. */ | ||
| 1276 | if (!NILP (Vrun_hooks)) | ||
| 1277 | call1 (Vrun_hooks, Qbuffer_list_update_hook); | ||
| 1278 | |||
| 1220 | /* Refetch since that last call may have done GC. */ | 1279 | /* Refetch since that last call may have done GC. */ |
| 1221 | return current_buffer->name; | 1280 | return BVAR (current_buffer, name); |
| 1222 | } | 1281 | } |
| 1223 | 1282 | ||
| 1224 | DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, | 1283 | DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, |
| 1225 | doc: /* Return most recently selected buffer other than BUFFER. | 1284 | doc: /* Return most recently selected buffer other than BUFFER. |
| 1226 | Buffers not visible in windows are preferred to visible buffers, | 1285 | Buffers not visible in windows are preferred to visible buffers, unless |
| 1227 | unless optional second argument VISIBLE-OK is non-nil. | 1286 | optional second argument VISIBLE-OK is non-nil. Ignore the argument |
| 1228 | If the optional third argument FRAME is non-nil, use that frame's | 1287 | BUFFER unless it denotes a live buffer. If the optional third argument |
| 1229 | buffer list instead of the selected frame's buffer list. | 1288 | FRAME is non-nil, use that frame's buffer list instead of the selected |
| 1230 | If no other buffer exists, the buffer `*scratch*' is returned. | 1289 | frame's buffer list. |
| 1231 | If BUFFER is omitted or nil, some interesting buffer is returned. */) | 1290 | |
| 1291 | The buffer is found by scanning the selected or specified frame's buffer | ||
| 1292 | list first, followed by the list of all buffers. If no other buffer | ||
| 1293 | exists, return the buffer `*scratch*' (creating it if necessary). */) | ||
| 1232 | (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) | 1294 | (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) |
| 1233 | { | 1295 | { |
| 1234 | Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer); | 1296 | Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer); |
| 1235 | register Lisp_Object tail, buf, notsogood, tem, pred, add_ons; | 1297 | Lisp_Object tail, buf, pred; |
| 1236 | notsogood = Qnil; | 1298 | Lisp_Object notsogood = Qnil; |
| 1237 | 1299 | ||
| 1238 | if (NILP (frame)) | 1300 | if (NILP (frame)) |
| 1239 | frame = selected_frame; | 1301 | frame = selected_frame; |
| 1240 | 1302 | ||
| 1241 | CHECK_FRAME (frame); | 1303 | CHECK_FRAME (frame); |
| 1242 | 1304 | ||
| 1243 | tail = Vbuffer_alist; | ||
| 1244 | pred = frame_buffer_predicate (frame); | 1305 | pred = frame_buffer_predicate (frame); |
| 1245 | 1306 | /* Consider buffers that have been seen in the frame first. */ | |
| 1246 | /* Consider buffers that have been seen in the selected frame | 1307 | tail = XFRAME (frame)->buffer_list; |
| 1247 | before other buffers. */ | 1308 | for (; CONSP (tail); tail = XCDR (tail)) |
| 1248 | |||
| 1249 | tem = frame_buffer_list (frame); | ||
| 1250 | add_ons = Qnil; | ||
| 1251 | while (CONSP (tem)) | ||
| 1252 | { | 1309 | { |
| 1253 | if (BUFFERP (XCAR (tem))) | 1310 | buf = XCAR (tail); |
| 1254 | add_ons = Fcons (Fcons (Qnil, XCAR (tem)), add_ons); | 1311 | if (BUFFERP (buf) && !EQ (buf, buffer) |
| 1255 | tem = XCDR (tem); | 1312 | && !NILP (BVAR (XBUFFER (buf), name)) |
| 1313 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') | ||
| 1314 | /* If the frame has a buffer_predicate, disregard buffers that | ||
| 1315 | don't fit the predicate. */ | ||
| 1316 | && (NILP (pred) || !NILP (call1 (pred, buf)))) | ||
| 1317 | { | ||
| 1318 | if (!NILP (visible_ok) | ||
| 1319 | || NILP (Fget_buffer_window (buf, Qvisible))) | ||
| 1320 | return buf; | ||
| 1321 | else if (NILP (notsogood)) | ||
| 1322 | notsogood = buf; | ||
| 1323 | } | ||
| 1256 | } | 1324 | } |
| 1257 | tail = nconc2 (Fnreverse (add_ons), tail); | ||
| 1258 | 1325 | ||
| 1326 | /* Consider alist of all buffers next. */ | ||
| 1327 | tail = Vbuffer_alist; | ||
| 1259 | for (; CONSP (tail); tail = XCDR (tail)) | 1328 | for (; CONSP (tail); tail = XCDR (tail)) |
| 1260 | { | 1329 | { |
| 1261 | buf = Fcdr (XCAR (tail)); | 1330 | buf = Fcdr (XCAR (tail)); |
| 1262 | if (EQ (buf, buffer)) | 1331 | if (BUFFERP (buf) && !EQ (buf, buffer) |
| 1263 | continue; | 1332 | && !NILP (BVAR (XBUFFER (buf), name)) |
| 1333 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') | ||
| 1334 | /* If the frame has a buffer_predicate, disregard buffers that | ||
| 1335 | don't fit the predicate. */ | ||
| 1336 | && (NILP (pred) || !NILP (call1 (pred, buf)))) | ||
| 1337 | { | ||
| 1338 | if (!NILP (visible_ok) | ||
| 1339 | || NILP (Fget_buffer_window (buf, Qvisible))) | ||
| 1340 | return buf; | ||
| 1341 | else if (NILP (notsogood)) | ||
| 1342 | notsogood = buf; | ||
| 1343 | } | ||
| 1344 | } | ||
| 1345 | |||
| 1346 | if (!NILP (notsogood)) | ||
| 1347 | return notsogood; | ||
| 1348 | else | ||
| 1349 | { | ||
| 1350 | buf = Fget_buffer (build_string ("*scratch*")); | ||
| 1264 | if (NILP (buf)) | 1351 | if (NILP (buf)) |
| 1265 | continue; | ||
| 1266 | if (NILP (XBUFFER (buf)->name)) | ||
| 1267 | continue; | ||
| 1268 | if (SREF (XBUFFER (buf)->name, 0) == ' ') | ||
| 1269 | continue; | ||
| 1270 | /* If the selected frame has a buffer_predicate, | ||
| 1271 | disregard buffers that don't fit the predicate. */ | ||
| 1272 | if (!NILP (pred)) | ||
| 1273 | { | 1352 | { |
| 1274 | tem = call1 (pred, buf); | 1353 | buf = Fget_buffer_create (build_string ("*scratch*")); |
| 1275 | if (NILP (tem)) | 1354 | Fset_buffer_major_mode (buf); |
| 1276 | continue; | ||
| 1277 | } | 1355 | } |
| 1356 | return buf; | ||
| 1357 | } | ||
| 1358 | } | ||
| 1278 | 1359 | ||
| 1279 | if (NILP (visible_ok)) | 1360 | /* The following function is a safe variant of Fother_buffer: It doesn't |
| 1280 | tem = Fget_buffer_window (buf, Qvisible); | 1361 | pay attention to any frame-local buffer lists, doesn't care about |
| 1281 | else | 1362 | visibility of buffers, and doesn't evaluate any frame predicates. */ |
| 1282 | tem = Qnil; | 1363 | |
| 1283 | if (NILP (tem)) | 1364 | Lisp_Object |
| 1365 | other_buffer_safely (Lisp_Object buffer) | ||
| 1366 | { | ||
| 1367 | Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer); | ||
| 1368 | Lisp_Object tail, buf; | ||
| 1369 | |||
| 1370 | tail = Vbuffer_alist; | ||
| 1371 | for (; CONSP (tail); tail = XCDR (tail)) | ||
| 1372 | { | ||
| 1373 | buf = Fcdr (XCAR (tail)); | ||
| 1374 | if (BUFFERP (buf) && !EQ (buf, buffer) | ||
| 1375 | && !NILP (BVAR (XBUFFER (buf), name)) | ||
| 1376 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')) | ||
| 1284 | return buf; | 1377 | return buf; |
| 1285 | if (NILP (notsogood)) | ||
| 1286 | notsogood = buf; | ||
| 1287 | } | 1378 | } |
| 1288 | if (!NILP (notsogood)) | 1379 | |
| 1289 | return notsogood; | ||
| 1290 | buf = Fget_buffer (build_string ("*scratch*")); | 1380 | buf = Fget_buffer (build_string ("*scratch*")); |
| 1291 | if (NILP (buf)) | 1381 | if (NILP (buf)) |
| 1292 | { | 1382 | { |
| 1293 | buf = Fget_buffer_create (build_string ("*scratch*")); | 1383 | buf = Fget_buffer_create (build_string ("*scratch*")); |
| 1294 | Fset_buffer_major_mode (buf); | 1384 | Fset_buffer_major_mode (buf); |
| 1295 | } | 1385 | } |
| 1386 | |||
| 1296 | return buf; | 1387 | return buf; |
| 1297 | } | 1388 | } |
| 1298 | 1389 | ||
| @@ -1313,14 +1404,14 @@ No argument or nil as argument means do this for the current buffer. */) | |||
| 1313 | nsberror (buffer); | 1404 | nsberror (buffer); |
| 1314 | } | 1405 | } |
| 1315 | 1406 | ||
| 1316 | if (EQ (XBUFFER (real_buffer)->undo_list, Qt)) | 1407 | if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) |
| 1317 | XBUFFER (real_buffer)->undo_list = Qnil; | 1408 | BVAR (XBUFFER (real_buffer), undo_list) = Qnil; |
| 1318 | 1409 | ||
| 1319 | return Qnil; | 1410 | return Qnil; |
| 1320 | } | 1411 | } |
| 1321 | 1412 | ||
| 1322 | /* | 1413 | /* |
| 1323 | DEFVAR_LISP ("kill-buffer-hook", no_cell, "\ | 1414 | DEFVAR_LISP ("kill-buffer-hook", ..., "\ |
| 1324 | Hook to be run (by `run-hooks', which see) when a buffer is killed.\n\ | 1415 | Hook to be run (by `run-hooks', which see) when a buffer is killed.\n\ |
| 1325 | The buffer being killed will be current while the hook is running.\n\ | 1416 | The buffer being killed will be current while the hook is running.\n\ |
| 1326 | See `kill-buffer'." | 1417 | See `kill-buffer'." |
| @@ -1359,16 +1450,16 @@ with SIGHUP. */) | |||
| 1359 | b = XBUFFER (buffer); | 1450 | b = XBUFFER (buffer); |
| 1360 | 1451 | ||
| 1361 | /* Avoid trouble for buffer already dead. */ | 1452 | /* Avoid trouble for buffer already dead. */ |
| 1362 | if (NILP (b->name)) | 1453 | if (NILP (BVAR (b, name))) |
| 1363 | return Qnil; | 1454 | return Qnil; |
| 1364 | 1455 | ||
| 1365 | /* Query if the buffer is still modified. */ | 1456 | /* Query if the buffer is still modified. */ |
| 1366 | if (INTERACTIVE && !NILP (b->filename) | 1457 | if (INTERACTIVE && !NILP (BVAR (b, filename)) |
| 1367 | && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) | 1458 | && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) |
| 1368 | { | 1459 | { |
| 1369 | GCPRO1 (buffer); | 1460 | GCPRO1 (buffer); |
| 1370 | tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", | 1461 | tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", |
| 1371 | b->name, make_number (0))); | 1462 | BVAR (b, name), make_number (0))); |
| 1372 | UNGCPRO; | 1463 | UNGCPRO; |
| 1373 | if (NILP (tem)) | 1464 | if (NILP (tem)) |
| 1374 | return Qnil; | 1465 | return Qnil; |
| @@ -1402,7 +1493,7 @@ with SIGHUP. */) | |||
| 1402 | if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) | 1493 | if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) |
| 1403 | return Qnil; | 1494 | return Qnil; |
| 1404 | 1495 | ||
| 1405 | if (NILP (b->name)) | 1496 | if (NILP (BVAR (b, name))) |
| 1406 | return Qnil; | 1497 | return Qnil; |
| 1407 | 1498 | ||
| 1408 | /* When we kill a base buffer, kill all its indirect buffers. | 1499 | /* When we kill a base buffer, kill all its indirect buffers. |
| @@ -1414,14 +1505,14 @@ with SIGHUP. */) | |||
| 1414 | 1505 | ||
| 1415 | GCPRO1 (buffer); | 1506 | GCPRO1 (buffer); |
| 1416 | 1507 | ||
| 1417 | for (other = all_buffers; other; other = other->next) | 1508 | for (other = all_buffers; other; other = other->header.next.buffer) |
| 1418 | /* all_buffers contains dead buffers too; | 1509 | /* all_buffers contains dead buffers too; |
| 1419 | don't re-kill them. */ | 1510 | don't re-kill them. */ |
| 1420 | if (other->base_buffer == b && !NILP (other->name)) | 1511 | if (other->base_buffer == b && !NILP (BVAR (other, name))) |
| 1421 | { | 1512 | { |
| 1422 | Lisp_Object buffer; | 1513 | Lisp_Object buf; |
| 1423 | XSETBUFFER (buffer, other); | 1514 | XSETBUFFER (buf, other); |
| 1424 | Fkill_buffer (buffer); | 1515 | Fkill_buffer (buf); |
| 1425 | } | 1516 | } |
| 1426 | 1517 | ||
| 1427 | UNGCPRO; | 1518 | UNGCPRO; |
| @@ -1462,30 +1553,37 @@ with SIGHUP. */) | |||
| 1462 | /* Killing buffer processes may run sentinels which may | 1553 | /* Killing buffer processes may run sentinels which may |
| 1463 | have called kill-buffer. */ | 1554 | have called kill-buffer. */ |
| 1464 | 1555 | ||
| 1465 | if (NILP (b->name)) | 1556 | if (NILP (BVAR (b, name))) |
| 1466 | return Qnil; | 1557 | return Qnil; |
| 1467 | 1558 | ||
| 1559 | /* These may run Lisp code and into infinite loops (if someone | ||
| 1560 | insisted on circular lists) so allow quitting here. */ | ||
| 1561 | replace_buffer_in_windows (buffer); | ||
| 1562 | frames_discard_buffer (buffer); | ||
| 1563 | |||
| 1468 | clear_charpos_cache (b); | 1564 | clear_charpos_cache (b); |
| 1469 | 1565 | ||
| 1470 | tem = Vinhibit_quit; | 1566 | tem = Vinhibit_quit; |
| 1471 | Vinhibit_quit = Qt; | 1567 | Vinhibit_quit = Qt; |
| 1472 | replace_buffer_in_all_windows (buffer); | 1568 | /* Remove the buffer from the list of all buffers. */ |
| 1473 | Vbuffer_alist = Fdelq (Frassq (buffer, Vbuffer_alist), Vbuffer_alist); | 1569 | Vbuffer_alist = Fdelq (Frassq (buffer, Vbuffer_alist), Vbuffer_alist); |
| 1474 | frames_discard_buffer (buffer); | 1570 | /* If replace_buffer_in_windows didn't do its job correctly fix that |
| 1571 | now. */ | ||
| 1572 | replace_buffer_in_windows_safely (buffer); | ||
| 1475 | Vinhibit_quit = tem; | 1573 | Vinhibit_quit = tem; |
| 1476 | 1574 | ||
| 1477 | /* Delete any auto-save file, if we saved it in this session. | 1575 | /* Delete any auto-save file, if we saved it in this session. |
| 1478 | But not if the buffer is modified. */ | 1576 | But not if the buffer is modified. */ |
| 1479 | if (STRINGP (b->auto_save_file_name) | 1577 | if (STRINGP (BVAR (b, auto_save_file_name)) |
| 1480 | && BUF_AUTOSAVE_MODIFF (b) != 0 | 1578 | && BUF_AUTOSAVE_MODIFF (b) != 0 |
| 1481 | && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b) | 1579 | && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b) |
| 1482 | && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) | 1580 | && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) |
| 1483 | && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) | 1581 | && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) |
| 1484 | { | 1582 | { |
| 1485 | Lisp_Object tem; | 1583 | Lisp_Object delete; |
| 1486 | tem = Fsymbol_value (intern ("delete-auto-save-files")); | 1584 | delete = Fsymbol_value (intern ("delete-auto-save-files")); |
| 1487 | if (! NILP (tem)) | 1585 | if (! NILP (delete)) |
| 1488 | internal_delete_file (b->auto_save_file_name); | 1586 | internal_delete_file (BVAR (b, auto_save_file_name)); |
| 1489 | } | 1587 | } |
| 1490 | 1588 | ||
| 1491 | if (b->base_buffer) | 1589 | if (b->base_buffer) |
| @@ -1525,7 +1623,7 @@ with SIGHUP. */) | |||
| 1525 | swap_out_buffer_local_variables (b); | 1623 | swap_out_buffer_local_variables (b); |
| 1526 | reset_buffer_local_variables (b, 1); | 1624 | reset_buffer_local_variables (b, 1); |
| 1527 | 1625 | ||
| 1528 | b->name = Qnil; | 1626 | BVAR (b, name) = Qnil; |
| 1529 | 1627 | ||
| 1530 | BLOCK_INPUT; | 1628 | BLOCK_INPUT; |
| 1531 | if (! b->base_buffer) | 1629 | if (! b->base_buffer) |
| @@ -1541,87 +1639,106 @@ with SIGHUP. */) | |||
| 1541 | free_region_cache (b->width_run_cache); | 1639 | free_region_cache (b->width_run_cache); |
| 1542 | b->width_run_cache = 0; | 1640 | b->width_run_cache = 0; |
| 1543 | } | 1641 | } |
| 1544 | b->width_table = Qnil; | 1642 | BVAR (b, width_table) = Qnil; |
| 1545 | UNBLOCK_INPUT; | 1643 | UNBLOCK_INPUT; |
| 1546 | b->undo_list = Qnil; | 1644 | BVAR (b, undo_list) = Qnil; |
| 1645 | |||
| 1646 | /* Run buffer-list-update-hook. */ | ||
| 1647 | if (!NILP (Vrun_hooks)) | ||
| 1648 | call1 (Vrun_hooks, Qbuffer_list_update_hook); | ||
| 1547 | 1649 | ||
| 1548 | return Qt; | 1650 | return Qt; |
| 1549 | } | 1651 | } |
| 1550 | 1652 | ||
| 1551 | /* Move the assoc for buffer BUF to the front of buffer-alist. Since | 1653 | /* Move association for BUFFER to the front of buffer (a)lists. Since |
| 1552 | we do this each time BUF is selected visibly, the more recently | 1654 | we do this each time BUFFER is selected visibly, the more recently |
| 1553 | selected buffers are always closer to the front of the list. This | 1655 | selected buffers are always closer to the front of those lists. This |
| 1554 | means that other_buffer is more likely to choose a relevant buffer. */ | 1656 | means that other_buffer is more likely to choose a relevant buffer. |
| 1657 | |||
| 1658 | Note that this moves BUFFER to the front of the buffer lists of the | ||
| 1659 | selected frame even if BUFFER is not shown there. If BUFFER is not | ||
| 1660 | shown in the selected frame, consider the present behavior a feature. | ||
| 1661 | `select-window' gets this right since it shows BUFFER in the selected | ||
| 1662 | window when calling us. */ | ||
| 1555 | 1663 | ||
| 1556 | void | 1664 | void |
| 1557 | record_buffer (Lisp_Object buf) | 1665 | record_buffer (Lisp_Object buffer) |
| 1558 | { | 1666 | { |
| 1559 | register Lisp_Object link, prev; | 1667 | Lisp_Object aelt, aelt_cons, tem; |
| 1560 | Lisp_Object frame; | 1668 | register struct frame *f = XFRAME (selected_frame); |
| 1561 | frame = selected_frame; | ||
| 1562 | 1669 | ||
| 1563 | prev = Qnil; | 1670 | CHECK_BUFFER (buffer); |
| 1564 | for (link = Vbuffer_alist; CONSP (link); link = XCDR (link)) | ||
| 1565 | { | ||
| 1566 | if (EQ (XCDR (XCAR (link)), buf)) | ||
| 1567 | break; | ||
| 1568 | prev = link; | ||
| 1569 | } | ||
| 1570 | 1671 | ||
| 1571 | /* Effectively do Vbuffer_alist = Fdelq (link, Vbuffer_alist); | 1672 | /* Update Vbuffer_alist (we know that it has an entry for BUFFER). |
| 1572 | we cannot use Fdelq itself here because it allows quitting. */ | 1673 | Don't allow quitting since this might leave the buffer list in an |
| 1674 | inconsistent state. */ | ||
| 1675 | tem = Vinhibit_quit; | ||
| 1676 | Vinhibit_quit = Qt; | ||
| 1677 | aelt = Frassq (buffer, Vbuffer_alist); | ||
| 1678 | aelt_cons = Fmemq (aelt, Vbuffer_alist); | ||
| 1679 | Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); | ||
| 1680 | XSETCDR (aelt_cons, Vbuffer_alist); | ||
| 1681 | Vbuffer_alist = aelt_cons; | ||
| 1682 | Vinhibit_quit = tem; | ||
| 1573 | 1683 | ||
| 1574 | if (NILP (prev)) | 1684 | /* Update buffer list of selected frame. */ |
| 1575 | Vbuffer_alist = XCDR (Vbuffer_alist); | 1685 | f->buffer_list = Fcons (buffer, Fdelq (buffer, f->buffer_list)); |
| 1576 | else | 1686 | f->buried_buffer_list = Fdelq (buffer, f->buried_buffer_list); |
| 1577 | XSETCDR (prev, XCDR (XCDR (prev))); | ||
| 1578 | 1687 | ||
| 1579 | XSETCDR (link, Vbuffer_alist); | 1688 | /* Run buffer-list-update-hook. */ |
| 1580 | Vbuffer_alist = link; | 1689 | if (!NILP (Vrun_hooks)) |
| 1690 | call1 (Vrun_hooks, Qbuffer_list_update_hook); | ||
| 1691 | } | ||
| 1581 | 1692 | ||
| 1582 | /* Effectively do a delq on buried_buffer_list. */ | 1693 | DEFUN ("record-buffer", Frecord_buffer, Srecord_buffer, 1, 1, 0, |
| 1694 | doc: /* Move BUFFER to the front of the buffer list. | ||
| 1695 | Return BUFFER. */) | ||
| 1696 | (Lisp_Object buffer) | ||
| 1697 | { | ||
| 1698 | CHECK_BUFFER (buffer); | ||
| 1583 | 1699 | ||
| 1584 | prev = Qnil; | 1700 | record_buffer (buffer); |
| 1585 | for (link = XFRAME (frame)->buried_buffer_list; CONSP (link); | ||
| 1586 | link = XCDR (link)) | ||
| 1587 | { | ||
| 1588 | if (EQ (XCAR (link), buf)) | ||
| 1589 | { | ||
| 1590 | if (NILP (prev)) | ||
| 1591 | XFRAME (frame)->buried_buffer_list = XCDR (link); | ||
| 1592 | else | ||
| 1593 | XSETCDR (prev, XCDR (XCDR (prev))); | ||
| 1594 | break; | ||
| 1595 | } | ||
| 1596 | prev = link; | ||
| 1597 | } | ||
| 1598 | 1701 | ||
| 1599 | /* Now move this buffer to the front of frame_buffer_list also. */ | 1702 | return buffer; |
| 1703 | } | ||
| 1600 | 1704 | ||
| 1601 | prev = Qnil; | 1705 | /* Move BUFFER to the end of the buffer (a)lists. Do nothing if the |
| 1602 | for (link = frame_buffer_list (frame); CONSP (link); | 1706 | buffer is killed. For the selected frame's buffer list this moves |
| 1603 | link = XCDR (link)) | 1707 | BUFFER to its end even if it was never shown in that frame. If |
| 1604 | { | 1708 | this happens we have a feature, hence `unrecord-buffer' should be |
| 1605 | if (EQ (XCAR (link), buf)) | 1709 | called only when BUFFER was shown in the selected frame. */ |
| 1606 | break; | ||
| 1607 | prev = link; | ||
| 1608 | } | ||
| 1609 | 1710 | ||
| 1610 | /* Effectively do delq. */ | 1711 | DEFUN ("unrecord-buffer", Funrecord_buffer, Sunrecord_buffer, 1, 1, 0, |
| 1712 | doc: /* Move BUFFER to the end of the buffer list. | ||
| 1713 | Return BUFFER. */) | ||
| 1714 | (Lisp_Object buffer) | ||
| 1715 | { | ||
| 1716 | Lisp_Object aelt, aelt_cons, tem; | ||
| 1717 | register struct frame *f = XFRAME (selected_frame); | ||
| 1611 | 1718 | ||
| 1612 | if (CONSP (link)) | 1719 | CHECK_BUFFER (buffer); |
| 1613 | { | ||
| 1614 | if (NILP (prev)) | ||
| 1615 | set_frame_buffer_list (frame, | ||
| 1616 | XCDR (frame_buffer_list (frame))); | ||
| 1617 | else | ||
| 1618 | XSETCDR (prev, XCDR (XCDR (prev))); | ||
| 1619 | 1720 | ||
| 1620 | XSETCDR (link, frame_buffer_list (frame)); | 1721 | /* Update Vbuffer_alist (we know that it has an entry for BUFFER). |
| 1621 | set_frame_buffer_list (frame, link); | 1722 | Don't allow quitting since this might leave the buffer list in an |
| 1622 | } | 1723 | inconsistent state. */ |
| 1623 | else | 1724 | tem = Vinhibit_quit; |
| 1624 | set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame))); | 1725 | Vinhibit_quit = Qt; |
| 1726 | aelt = Frassq (buffer, Vbuffer_alist); | ||
| 1727 | aelt_cons = Fmemq (aelt, Vbuffer_alist); | ||
| 1728 | Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); | ||
| 1729 | XSETCDR (aelt_cons, Qnil); | ||
| 1730 | Vbuffer_alist = nconc2 (Vbuffer_alist, aelt_cons); | ||
| 1731 | Vinhibit_quit = tem; | ||
| 1732 | |||
| 1733 | /* Update buffer lists of selected frame. */ | ||
| 1734 | f->buffer_list = Fdelq (buffer, f->buffer_list); | ||
| 1735 | f->buried_buffer_list = Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)); | ||
| 1736 | |||
| 1737 | /* Run buffer-list-update-hook. */ | ||
| 1738 | if (!NILP (Vrun_hooks)) | ||
| 1739 | call1 (Vrun_hooks, Qbuffer_list_update_hook); | ||
| 1740 | |||
| 1741 | return buffer; | ||
| 1625 | } | 1742 | } |
| 1626 | 1743 | ||
| 1627 | DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, | 1744 | DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, |
| @@ -1637,15 +1754,15 @@ the current buffer's major mode. */) | |||
| 1637 | 1754 | ||
| 1638 | CHECK_BUFFER (buffer); | 1755 | CHECK_BUFFER (buffer); |
| 1639 | 1756 | ||
| 1640 | if (STRINGP (XBUFFER (buffer)->name) | 1757 | if (STRINGP (BVAR (XBUFFER (buffer), name)) |
| 1641 | && strcmp (SSDATA (XBUFFER (buffer)->name), "*scratch*") == 0) | 1758 | && strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0) |
| 1642 | function = find_symbol_value (intern ("initial-major-mode")); | 1759 | function = find_symbol_value (intern ("initial-major-mode")); |
| 1643 | else | 1760 | else |
| 1644 | { | 1761 | { |
| 1645 | function = buffer_defaults.major_mode; | 1762 | function = BVAR (&buffer_defaults, major_mode); |
| 1646 | if (NILP (function) | 1763 | if (NILP (function) |
| 1647 | && NILP (Fget (current_buffer->major_mode, Qmode_class))) | 1764 | && NILP (Fget (BVAR (current_buffer, major_mode), Qmode_class))) |
| 1648 | function = current_buffer->major_mode; | 1765 | function = BVAR (current_buffer, major_mode); |
| 1649 | } | 1766 | } |
| 1650 | 1767 | ||
| 1651 | if (NILP (function) || EQ (function, Qfundamental_mode)) | 1768 | if (NILP (function) || EQ (function, Qfundamental_mode)) |
| @@ -1664,86 +1781,6 @@ the current buffer's major mode. */) | |||
| 1664 | return unbind_to (count, Qnil); | 1781 | return unbind_to (count, Qnil); |
| 1665 | } | 1782 | } |
| 1666 | 1783 | ||
| 1667 | /* Switch to buffer BUFFER in the selected window. | ||
| 1668 | If NORECORD is non-nil, don't call record_buffer. */ | ||
| 1669 | |||
| 1670 | Lisp_Object | ||
| 1671 | switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord) | ||
| 1672 | { | ||
| 1673 | register Lisp_Object buffer; | ||
| 1674 | |||
| 1675 | if (NILP (buffer_or_name)) | ||
| 1676 | buffer = Fother_buffer (Fcurrent_buffer (), Qnil, Qnil); | ||
| 1677 | else | ||
| 1678 | { | ||
| 1679 | buffer = Fget_buffer (buffer_or_name); | ||
| 1680 | if (NILP (buffer)) | ||
| 1681 | { | ||
| 1682 | buffer = Fget_buffer_create (buffer_or_name); | ||
| 1683 | Fset_buffer_major_mode (buffer); | ||
| 1684 | } | ||
| 1685 | } | ||
| 1686 | Fset_buffer (buffer); | ||
| 1687 | if (NILP (norecord)) | ||
| 1688 | record_buffer (buffer); | ||
| 1689 | |||
| 1690 | Fset_window_buffer (EQ (selected_window, minibuf_window) | ||
| 1691 | ? Fnext_window (minibuf_window, Qnil, Qnil) | ||
| 1692 | : selected_window, | ||
| 1693 | buffer, Qnil); | ||
| 1694 | |||
| 1695 | return buffer; | ||
| 1696 | } | ||
| 1697 | |||
| 1698 | DEFUN ("switch-to-buffer", Fswitch_to_buffer, Sswitch_to_buffer, 1, 2, | ||
| 1699 | "(list (read-buffer-to-switch \"Switch to buffer: \"))", | ||
| 1700 | doc: /* Make BUFFER-OR-NAME current and display it in selected window. | ||
| 1701 | BUFFER-OR-NAME may be a buffer, a string \(a buffer name), or | ||
| 1702 | nil. Return the buffer switched to. | ||
| 1703 | |||
| 1704 | If BUFFER-OR-NAME is a string and does not identify an existing | ||
| 1705 | buffer, create a new buffer with that name. Interactively, if | ||
| 1706 | `confirm-nonexistent-file-or-buffer' is non-nil, request | ||
| 1707 | confirmation before creating a new buffer. If BUFFER-OR-NAME is | ||
| 1708 | nil, switch to buffer returned by `other-buffer'. | ||
| 1709 | |||
| 1710 | Optional second arg NORECORD non-nil means do not put this buffer | ||
| 1711 | at the front of the list of recently selected ones. This | ||
| 1712 | function returns the buffer it switched to as a Lisp object. | ||
| 1713 | |||
| 1714 | If the selected window is the minibuffer window or dedicated to | ||
| 1715 | its buffer, use `pop-to-buffer' for displaying the buffer. | ||
| 1716 | |||
| 1717 | WARNING: This is NOT the way to work on another buffer temporarily | ||
| 1718 | within a Lisp program! Use `set-buffer' instead. That avoids | ||
| 1719 | messing with the window-buffer correspondences. */) | ||
| 1720 | (Lisp_Object buffer_or_name, Lisp_Object norecord) | ||
| 1721 | { | ||
| 1722 | if (EQ (buffer_or_name, Fwindow_buffer (selected_window))) | ||
| 1723 | { | ||
| 1724 | /* Basically a NOP. Avoid signalling an error in the case where | ||
| 1725 | the selected window is dedicated, or a minibuffer. */ | ||
| 1726 | |||
| 1727 | /* But do put this buffer at the front of the buffer list, unless | ||
| 1728 | that has been inhibited. Note that even if BUFFER-OR-NAME is | ||
| 1729 | at the front of the main buffer-list already, we still want to | ||
| 1730 | move it to the front of the frame's buffer list. */ | ||
| 1731 | if (NILP (norecord)) | ||
| 1732 | record_buffer (buffer_or_name); | ||
| 1733 | return Fset_buffer (buffer_or_name); | ||
| 1734 | } | ||
| 1735 | else if (EQ (minibuf_window, selected_window) | ||
| 1736 | /* If `dedicated' is neither nil nor t, it means it's | ||
| 1737 | dedicatedness can be overridden by an explicit request | ||
| 1738 | such as a call to switch-to-buffer. */ | ||
| 1739 | || EQ (Fwindow_dedicated_p (selected_window), Qt)) | ||
| 1740 | /* We can't use the selected window so let `pop-to-buffer' try some | ||
| 1741 | other window. */ | ||
| 1742 | return call3 (intern ("pop-to-buffer"), buffer_or_name, Qnil, norecord); | ||
| 1743 | else | ||
| 1744 | return switch_to_buffer_1 (buffer_or_name, norecord); | ||
| 1745 | } | ||
| 1746 | |||
| 1747 | DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, | 1784 | DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, |
| 1748 | doc: /* Return the current buffer as a Lisp object. */) | 1785 | doc: /* Return the current buffer as a Lisp object. */) |
| 1749 | (void) | 1786 | (void) |
| @@ -1795,62 +1832,28 @@ set_buffer_internal_1 (register struct buffer *b) | |||
| 1795 | /* Put the undo list back in the base buffer, so that it appears | 1832 | /* Put the undo list back in the base buffer, so that it appears |
| 1796 | that an indirect buffer shares the undo list of its base. */ | 1833 | that an indirect buffer shares the undo list of its base. */ |
| 1797 | if (old_buf->base_buffer) | 1834 | if (old_buf->base_buffer) |
| 1798 | old_buf->base_buffer->undo_list = old_buf->undo_list; | 1835 | BVAR (old_buf->base_buffer, undo_list) = BVAR (old_buf, undo_list); |
| 1799 | 1836 | ||
| 1800 | /* If the old current buffer has markers to record PT, BEGV and ZV | 1837 | /* If the old current buffer has markers to record PT, BEGV and ZV |
| 1801 | when it is not current, update them now. */ | 1838 | when it is not current, update them now. */ |
| 1802 | if (! NILP (old_buf->pt_marker)) | 1839 | record_buffer_markers (old_buf); |
| 1803 | { | ||
| 1804 | Lisp_Object obuf; | ||
| 1805 | XSETBUFFER (obuf, old_buf); | ||
| 1806 | set_marker_both (old_buf->pt_marker, obuf, | ||
| 1807 | BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); | ||
| 1808 | } | ||
| 1809 | if (! NILP (old_buf->begv_marker)) | ||
| 1810 | { | ||
| 1811 | Lisp_Object obuf; | ||
| 1812 | XSETBUFFER (obuf, old_buf); | ||
| 1813 | set_marker_both (old_buf->begv_marker, obuf, | ||
| 1814 | BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); | ||
| 1815 | } | ||
| 1816 | if (! NILP (old_buf->zv_marker)) | ||
| 1817 | { | ||
| 1818 | Lisp_Object obuf; | ||
| 1819 | XSETBUFFER (obuf, old_buf); | ||
| 1820 | set_marker_both (old_buf->zv_marker, obuf, | ||
| 1821 | BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); | ||
| 1822 | } | ||
| 1823 | } | 1840 | } |
| 1824 | 1841 | ||
| 1825 | /* Get the undo list from the base buffer, so that it appears | 1842 | /* Get the undo list from the base buffer, so that it appears |
| 1826 | that an indirect buffer shares the undo list of its base. */ | 1843 | that an indirect buffer shares the undo list of its base. */ |
| 1827 | if (b->base_buffer) | 1844 | if (b->base_buffer) |
| 1828 | b->undo_list = b->base_buffer->undo_list; | 1845 | BVAR (b, undo_list) = BVAR (b->base_buffer, undo_list); |
| 1829 | 1846 | ||
| 1830 | /* If the new current buffer has markers to record PT, BEGV and ZV | 1847 | /* If the new current buffer has markers to record PT, BEGV and ZV |
| 1831 | when it is not current, fetch them now. */ | 1848 | when it is not current, fetch them now. */ |
| 1832 | if (! NILP (b->pt_marker)) | 1849 | fetch_buffer_markers (b); |
| 1833 | { | ||
| 1834 | BUF_PT (b) = marker_position (b->pt_marker); | ||
| 1835 | BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); | ||
| 1836 | } | ||
| 1837 | if (! NILP (b->begv_marker)) | ||
| 1838 | { | ||
| 1839 | BUF_BEGV (b) = marker_position (b->begv_marker); | ||
| 1840 | BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); | ||
| 1841 | } | ||
| 1842 | if (! NILP (b->zv_marker)) | ||
| 1843 | { | ||
| 1844 | BUF_ZV (b) = marker_position (b->zv_marker); | ||
| 1845 | BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); | ||
| 1846 | } | ||
| 1847 | 1850 | ||
| 1848 | /* Look down buffer's list of local Lisp variables | 1851 | /* Look down buffer's list of local Lisp variables |
| 1849 | to find and update any that forward into C variables. */ | 1852 | to find and update any that forward into C variables. */ |
| 1850 | 1853 | ||
| 1851 | do | 1854 | do |
| 1852 | { | 1855 | { |
| 1853 | for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) | 1856 | for (tail = BVAR (b, local_var_alist); CONSP (tail); tail = XCDR (tail)) |
| 1854 | { | 1857 | { |
| 1855 | Lisp_Object var = XCAR (XCAR (tail)); | 1858 | Lisp_Object var = XCAR (XCAR (tail)); |
| 1856 | struct Lisp_Symbol *sym = XSYMBOL (var); | 1859 | struct Lisp_Symbol *sym = XSYMBOL (var); |
| @@ -1879,50 +1882,13 @@ set_buffer_temp (struct buffer *b) | |||
| 1879 | old_buf = current_buffer; | 1882 | old_buf = current_buffer; |
| 1880 | current_buffer = b; | 1883 | current_buffer = b; |
| 1881 | 1884 | ||
| 1882 | if (old_buf) | 1885 | /* If the old current buffer has markers to record PT, BEGV and ZV |
| 1883 | { | 1886 | when it is not current, update them now. */ |
| 1884 | /* If the old current buffer has markers to record PT, BEGV and ZV | 1887 | record_buffer_markers (old_buf); |
| 1885 | when it is not current, update them now. */ | ||
| 1886 | if (! NILP (old_buf->pt_marker)) | ||
| 1887 | { | ||
| 1888 | Lisp_Object obuf; | ||
| 1889 | XSETBUFFER (obuf, old_buf); | ||
| 1890 | set_marker_both (old_buf->pt_marker, obuf, | ||
| 1891 | BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); | ||
| 1892 | } | ||
| 1893 | if (! NILP (old_buf->begv_marker)) | ||
| 1894 | { | ||
| 1895 | Lisp_Object obuf; | ||
| 1896 | XSETBUFFER (obuf, old_buf); | ||
| 1897 | set_marker_both (old_buf->begv_marker, obuf, | ||
| 1898 | BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); | ||
| 1899 | } | ||
| 1900 | if (! NILP (old_buf->zv_marker)) | ||
| 1901 | { | ||
| 1902 | Lisp_Object obuf; | ||
| 1903 | XSETBUFFER (obuf, old_buf); | ||
| 1904 | set_marker_both (old_buf->zv_marker, obuf, | ||
| 1905 | BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); | ||
| 1906 | } | ||
| 1907 | } | ||
| 1908 | 1888 | ||
| 1909 | /* If the new current buffer has markers to record PT, BEGV and ZV | 1889 | /* If the new current buffer has markers to record PT, BEGV and ZV |
| 1910 | when it is not current, fetch them now. */ | 1890 | when it is not current, fetch them now. */ |
| 1911 | if (! NILP (b->pt_marker)) | 1891 | fetch_buffer_markers (b); |
| 1912 | { | ||
| 1913 | BUF_PT (b) = marker_position (b->pt_marker); | ||
| 1914 | BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); | ||
| 1915 | } | ||
| 1916 | if (! NILP (b->begv_marker)) | ||
| 1917 | { | ||
| 1918 | BUF_BEGV (b) = marker_position (b->begv_marker); | ||
| 1919 | BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); | ||
| 1920 | } | ||
| 1921 | if (! NILP (b->zv_marker)) | ||
| 1922 | { | ||
| 1923 | BUF_ZV (b) = marker_position (b->zv_marker); | ||
| 1924 | BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); | ||
| 1925 | } | ||
| 1926 | } | 1892 | } |
| 1927 | 1893 | ||
| 1928 | DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, | 1894 | DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, |
| @@ -1938,7 +1904,7 @@ ends when the current command terminates. Use `switch-to-buffer' or | |||
| 1938 | buffer = Fget_buffer (buffer_or_name); | 1904 | buffer = Fget_buffer (buffer_or_name); |
| 1939 | if (NILP (buffer)) | 1905 | if (NILP (buffer)) |
| 1940 | nsberror (buffer_or_name); | 1906 | nsberror (buffer_or_name); |
| 1941 | if (NILP (XBUFFER (buffer)->name)) | 1907 | if (NILP (BVAR (XBUFFER (buffer), name))) |
| 1942 | error ("Selecting deleted buffer"); | 1908 | error ("Selecting deleted buffer"); |
| 1943 | set_buffer_internal (XBUFFER (buffer)); | 1909 | set_buffer_internal (XBUFFER (buffer)); |
| 1944 | return buffer; | 1910 | return buffer; |
| @@ -1949,7 +1915,7 @@ ends when the current command terminates. Use `switch-to-buffer' or | |||
| 1949 | Lisp_Object | 1915 | Lisp_Object |
| 1950 | set_buffer_if_live (Lisp_Object buffer) | 1916 | set_buffer_if_live (Lisp_Object buffer) |
| 1951 | { | 1917 | { |
| 1952 | if (! NILP (XBUFFER (buffer)->name)) | 1918 | if (! NILP (BVAR (XBUFFER (buffer), name))) |
| 1953 | Fset_buffer (buffer); | 1919 | Fset_buffer (buffer); |
| 1954 | return Qnil; | 1920 | return Qnil; |
| 1955 | } | 1921 | } |
| @@ -1959,73 +1925,11 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, | |||
| 1959 | doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) | 1925 | doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) |
| 1960 | (void) | 1926 | (void) |
| 1961 | { | 1927 | { |
| 1962 | if (!NILP (current_buffer->read_only) | 1928 | if (!NILP (BVAR (current_buffer, read_only)) |
| 1963 | && NILP (Vinhibit_read_only)) | 1929 | && NILP (Vinhibit_read_only)) |
| 1964 | xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); | 1930 | xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); |
| 1965 | return Qnil; | 1931 | return Qnil; |
| 1966 | } | 1932 | } |
| 1967 | |||
| 1968 | DEFUN ("bury-buffer", Fbury_buffer, Sbury_buffer, 0, 1, "", | ||
| 1969 | doc: /* Put BUFFER-OR-NAME at the end of the list of all buffers. | ||
| 1970 | There it is the least likely candidate for `other-buffer' to return; | ||
| 1971 | thus, the least likely buffer for \\[switch-to-buffer] to select by | ||
| 1972 | default. | ||
| 1973 | |||
| 1974 | The argument may be a buffer name or an actual buffer object. If | ||
| 1975 | BUFFER-OR-NAME is nil or omitted, bury the current buffer and remove it | ||
| 1976 | from the selected window if it is displayed there. If the selected | ||
| 1977 | window is dedicated to its buffer, delete that window if there are other | ||
| 1978 | windows on the same frame. If the selected window is the only window on | ||
| 1979 | its frame, iconify that frame. */) | ||
| 1980 | (register Lisp_Object buffer_or_name) | ||
| 1981 | { | ||
| 1982 | Lisp_Object buffer; | ||
| 1983 | |||
| 1984 | /* Figure out what buffer we're going to bury. */ | ||
| 1985 | if (NILP (buffer_or_name)) | ||
| 1986 | { | ||
| 1987 | Lisp_Object tem; | ||
| 1988 | XSETBUFFER (buffer, current_buffer); | ||
| 1989 | |||
| 1990 | tem = Fwindow_buffer (selected_window); | ||
| 1991 | /* If we're burying the current buffer, unshow it. */ | ||
| 1992 | if (EQ (buffer, tem)) | ||
| 1993 | { | ||
| 1994 | if (NILP (Fwindow_dedicated_p (selected_window))) | ||
| 1995 | Fswitch_to_buffer (Fother_buffer (buffer, Qnil, Qnil), Qnil); | ||
| 1996 | else if (NILP (XWINDOW (selected_window)->parent)) | ||
| 1997 | Ficonify_frame (Fwindow_frame (selected_window)); | ||
| 1998 | else | ||
| 1999 | Fdelete_window (selected_window); | ||
| 2000 | } | ||
| 2001 | } | ||
| 2002 | else | ||
| 2003 | { | ||
| 2004 | buffer = Fget_buffer (buffer_or_name); | ||
| 2005 | if (NILP (buffer)) | ||
| 2006 | nsberror (buffer_or_name); | ||
| 2007 | } | ||
| 2008 | |||
| 2009 | /* Move buffer to the end of the buffer list. Do nothing if the | ||
| 2010 | buffer is killed. */ | ||
| 2011 | if (!NILP (XBUFFER (buffer)->name)) | ||
| 2012 | { | ||
| 2013 | Lisp_Object aelt, link; | ||
| 2014 | |||
| 2015 | aelt = Frassq (buffer, Vbuffer_alist); | ||
| 2016 | link = Fmemq (aelt, Vbuffer_alist); | ||
| 2017 | Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); | ||
| 2018 | XSETCDR (link, Qnil); | ||
| 2019 | Vbuffer_alist = nconc2 (Vbuffer_alist, link); | ||
| 2020 | |||
| 2021 | XFRAME (selected_frame)->buffer_list | ||
| 2022 | = Fdelq (buffer, XFRAME (selected_frame)->buffer_list); | ||
| 2023 | XFRAME (selected_frame)->buried_buffer_list | ||
| 2024 | = Fcons (buffer, Fdelq (buffer, XFRAME (selected_frame)->buried_buffer_list)); | ||
| 2025 | } | ||
| 2026 | |||
| 2027 | return Qnil; | ||
| 2028 | } | ||
| 2029 | 1933 | ||
| 2030 | DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", | 1934 | DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", |
| 2031 | doc: /* Delete the entire contents of the current buffer. | 1935 | doc: /* Delete the entire contents of the current buffer. |
| @@ -2041,7 +1945,7 @@ so the buffer is truly empty after this. */) | |||
| 2041 | /* Prevent warnings, or suspension of auto saving, that would happen | 1945 | /* Prevent warnings, or suspension of auto saving, that would happen |
| 2042 | if future size is less than past size. Use of erase-buffer | 1946 | if future size is less than past size. Use of erase-buffer |
| 2043 | implies that the future text is not really related to the past text. */ | 1947 | implies that the future text is not really related to the past text. */ |
| 2044 | XSETFASTINT (current_buffer->save_length, 0); | 1948 | XSETFASTINT (BVAR (current_buffer, save_length), 0); |
| 2045 | return Qnil; | 1949 | return Qnil; |
| 2046 | } | 1950 | } |
| 2047 | 1951 | ||
| @@ -2065,7 +1969,7 @@ validate_region (register Lisp_Object *b, register Lisp_Object *e) | |||
| 2065 | /* Advance BYTE_POS up to a character boundary | 1969 | /* Advance BYTE_POS up to a character boundary |
| 2066 | and return the adjusted position. */ | 1970 | and return the adjusted position. */ |
| 2067 | 1971 | ||
| 2068 | static int | 1972 | static EMACS_INT |
| 2069 | advance_to_char_boundary (EMACS_INT byte_pos) | 1973 | advance_to_char_boundary (EMACS_INT byte_pos) |
| 2070 | { | 1974 | { |
| 2071 | int c; | 1975 | int c; |
| @@ -2111,7 +2015,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2111 | CHECK_BUFFER (buffer); | 2015 | CHECK_BUFFER (buffer); |
| 2112 | other_buffer = XBUFFER (buffer); | 2016 | other_buffer = XBUFFER (buffer); |
| 2113 | 2017 | ||
| 2114 | if (NILP (other_buffer->name)) | 2018 | if (NILP (BVAR (other_buffer, name))) |
| 2115 | error ("Cannot swap a dead buffer's text"); | 2019 | error ("Cannot swap a dead buffer's text"); |
| 2116 | 2020 | ||
| 2117 | /* Actually, it probably works just fine. | 2021 | /* Actually, it probably works just fine. |
| @@ -2126,7 +2030,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2126 | 2030 | ||
| 2127 | { /* This is probably harder to make work. */ | 2031 | { /* This is probably harder to make work. */ |
| 2128 | struct buffer *other; | 2032 | struct buffer *other; |
| 2129 | for (other = all_buffers; other; other = other->next) | 2033 | for (other = all_buffers; other; other = other->header.next.buffer) |
| 2130 | if (other->base_buffer == other_buffer | 2034 | if (other->base_buffer == other_buffer |
| 2131 | || other->base_buffer == current_buffer) | 2035 | || other->base_buffer == current_buffer) |
| 2132 | error ("One of the buffers to swap has indirect buffers"); | 2036 | error ("One of the buffers to swap has indirect buffers"); |
| @@ -2138,6 +2042,12 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2138 | other_buffer->field = current_buffer->field; \ | 2042 | other_buffer->field = current_buffer->field; \ |
| 2139 | current_buffer->field = tmp##field; \ | 2043 | current_buffer->field = tmp##field; \ |
| 2140 | } while (0) | 2044 | } while (0) |
| 2045 | #define swapfield_(field, type) \ | ||
| 2046 | do { \ | ||
| 2047 | type tmp##field = BVAR (other_buffer, field); \ | ||
| 2048 | BVAR (other_buffer, field) = BVAR (current_buffer, field); \ | ||
| 2049 | BVAR (current_buffer, field) = tmp##field; \ | ||
| 2050 | } while (0) | ||
| 2141 | 2051 | ||
| 2142 | swapfield (own_text, struct buffer_text); | 2052 | swapfield (own_text, struct buffer_text); |
| 2143 | eassert (current_buffer->text == ¤t_buffer->own_text); | 2053 | eassert (current_buffer->text == ¤t_buffer->own_text); |
| @@ -2165,18 +2075,18 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2165 | swapfield (overlays_before, struct Lisp_Overlay *); | 2075 | swapfield (overlays_before, struct Lisp_Overlay *); |
| 2166 | swapfield (overlays_after, struct Lisp_Overlay *); | 2076 | swapfield (overlays_after, struct Lisp_Overlay *); |
| 2167 | swapfield (overlay_center, EMACS_INT); | 2077 | swapfield (overlay_center, EMACS_INT); |
| 2168 | swapfield (undo_list, Lisp_Object); | 2078 | swapfield_ (undo_list, Lisp_Object); |
| 2169 | swapfield (mark, Lisp_Object); | 2079 | swapfield_ (mark, Lisp_Object); |
| 2170 | swapfield (enable_multibyte_characters, Lisp_Object); | 2080 | swapfield_ (enable_multibyte_characters, Lisp_Object); |
| 2171 | swapfield (bidi_display_reordering, Lisp_Object); | 2081 | swapfield_ (bidi_display_reordering, Lisp_Object); |
| 2172 | swapfield (bidi_paragraph_direction, Lisp_Object); | 2082 | swapfield_ (bidi_paragraph_direction, Lisp_Object); |
| 2173 | /* FIXME: Not sure what we should do with these *_marker fields. | 2083 | /* FIXME: Not sure what we should do with these *_marker fields. |
| 2174 | Hopefully they're just nil anyway. */ | 2084 | Hopefully they're just nil anyway. */ |
| 2175 | swapfield (pt_marker, Lisp_Object); | 2085 | swapfield_ (pt_marker, Lisp_Object); |
| 2176 | swapfield (begv_marker, Lisp_Object); | 2086 | swapfield_ (begv_marker, Lisp_Object); |
| 2177 | swapfield (zv_marker, Lisp_Object); | 2087 | swapfield_ (zv_marker, Lisp_Object); |
| 2178 | current_buffer->point_before_scroll = Qnil; | 2088 | BVAR (current_buffer, point_before_scroll) = Qnil; |
| 2179 | other_buffer->point_before_scroll = Qnil; | 2089 | BVAR (other_buffer, point_before_scroll) = Qnil; |
| 2180 | 2090 | ||
| 2181 | current_buffer->text->modiff++; other_buffer->text->modiff++; | 2091 | current_buffer->text->modiff++; other_buffer->text->modiff++; |
| 2182 | current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; | 2092 | current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; |
| @@ -2250,21 +2160,21 @@ current buffer is cleared. */) | |||
| 2250 | EMACS_INT begv, zv; | 2160 | EMACS_INT begv, zv; |
| 2251 | int narrowed = (BEG != BEGV || Z != ZV); | 2161 | int narrowed = (BEG != BEGV || Z != ZV); |
| 2252 | int modified_p = !NILP (Fbuffer_modified_p (Qnil)); | 2162 | int modified_p = !NILP (Fbuffer_modified_p (Qnil)); |
| 2253 | Lisp_Object old_undo = current_buffer->undo_list; | 2163 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); |
| 2254 | struct gcpro gcpro1; | 2164 | struct gcpro gcpro1; |
| 2255 | 2165 | ||
| 2256 | if (current_buffer->base_buffer) | 2166 | if (current_buffer->base_buffer) |
| 2257 | error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); | 2167 | error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); |
| 2258 | 2168 | ||
| 2259 | /* Do nothing if nothing actually changes. */ | 2169 | /* Do nothing if nothing actually changes. */ |
| 2260 | if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) | 2170 | if (NILP (flag) == NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 2261 | return flag; | 2171 | return flag; |
| 2262 | 2172 | ||
| 2263 | GCPRO1 (old_undo); | 2173 | GCPRO1 (old_undo); |
| 2264 | 2174 | ||
| 2265 | /* Don't record these buffer changes. We will put a special undo entry | 2175 | /* Don't record these buffer changes. We will put a special undo entry |
| 2266 | instead. */ | 2176 | instead. */ |
| 2267 | current_buffer->undo_list = Qt; | 2177 | BVAR (current_buffer, undo_list) = Qt; |
| 2268 | 2178 | ||
| 2269 | /* If the cached position is for this buffer, clear it out. */ | 2179 | /* If the cached position is for this buffer, clear it out. */ |
| 2270 | clear_charpos_cache (current_buffer); | 2180 | clear_charpos_cache (current_buffer); |
| @@ -2286,7 +2196,7 @@ current buffer is cleared. */) | |||
| 2286 | to calculate the old correspondences. */ | 2196 | to calculate the old correspondences. */ |
| 2287 | set_intervals_multibyte (0); | 2197 | set_intervals_multibyte (0); |
| 2288 | 2198 | ||
| 2289 | current_buffer->enable_multibyte_characters = Qnil; | 2199 | BVAR (current_buffer, enable_multibyte_characters) = Qnil; |
| 2290 | 2200 | ||
| 2291 | Z = Z_BYTE; | 2201 | Z = Z_BYTE; |
| 2292 | BEGV = BEGV_BYTE; | 2202 | BEGV = BEGV_BYTE; |
| @@ -2355,12 +2265,12 @@ current buffer is cleared. */) | |||
| 2355 | && GPT_BYTE > 1 && GPT_BYTE < Z_BYTE | 2265 | && GPT_BYTE > 1 && GPT_BYTE < Z_BYTE |
| 2356 | && ! CHAR_HEAD_P (*(GAP_END_ADDR))) | 2266 | && ! CHAR_HEAD_P (*(GAP_END_ADDR))) |
| 2357 | { | 2267 | { |
| 2358 | unsigned char *p = GPT_ADDR - 1; | 2268 | unsigned char *q = GPT_ADDR - 1; |
| 2359 | 2269 | ||
| 2360 | while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--; | 2270 | while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--; |
| 2361 | if (LEADING_CODE_P (*p)) | 2271 | if (LEADING_CODE_P (*q)) |
| 2362 | { | 2272 | { |
| 2363 | EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - p); | 2273 | EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - q); |
| 2364 | 2274 | ||
| 2365 | move_gap_both (new_gpt, new_gpt); | 2275 | move_gap_both (new_gpt, new_gpt); |
| 2366 | } | 2276 | } |
| @@ -2401,7 +2311,7 @@ current buffer is cleared. */) | |||
| 2401 | *p = tmp[0]; | 2311 | *p = tmp[0]; |
| 2402 | TEMP_SET_PT_BOTH (pos + 1, pos + 1); | 2312 | TEMP_SET_PT_BOTH (pos + 1, pos + 1); |
| 2403 | bytes--; | 2313 | bytes--; |
| 2404 | insert_1_both (tmp + 1, bytes, bytes, 1, 0, 0); | 2314 | insert_1_both ((char *) tmp + 1, bytes, bytes, 1, 0, 0); |
| 2405 | /* Now the gap is after the just inserted data. */ | 2315 | /* Now the gap is after the just inserted data. */ |
| 2406 | pos = GPT; | 2316 | pos = GPT; |
| 2407 | p = GAP_END_ADDR; | 2317 | p = GAP_END_ADDR; |
| @@ -2424,7 +2334,7 @@ current buffer is cleared. */) | |||
| 2424 | 2334 | ||
| 2425 | /* Do this first, so that chars_in_text asks the right question. | 2335 | /* Do this first, so that chars_in_text asks the right question. |
| 2426 | set_intervals_multibyte needs it too. */ | 2336 | set_intervals_multibyte needs it too. */ |
| 2427 | current_buffer->enable_multibyte_characters = Qt; | 2337 | BVAR (current_buffer, enable_multibyte_characters) = Qt; |
| 2428 | 2338 | ||
| 2429 | GPT_BYTE = advance_to_char_boundary (GPT_BYTE); | 2339 | GPT_BYTE = advance_to_char_boundary (GPT_BYTE); |
| 2430 | GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; | 2340 | GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; |
| @@ -2444,14 +2354,14 @@ current buffer is cleared. */) | |||
| 2444 | ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; | 2354 | ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; |
| 2445 | 2355 | ||
| 2446 | { | 2356 | { |
| 2447 | EMACS_INT pt_byte = advance_to_char_boundary (PT_BYTE); | 2357 | EMACS_INT byte = advance_to_char_boundary (PT_BYTE); |
| 2448 | EMACS_INT pt; | 2358 | EMACS_INT position; |
| 2449 | 2359 | ||
| 2450 | if (pt_byte > GPT_BYTE) | 2360 | if (byte > GPT_BYTE) |
| 2451 | pt = chars_in_text (GAP_END_ADDR, pt_byte - GPT_BYTE) + GPT; | 2361 | position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT; |
| 2452 | else | 2362 | else |
| 2453 | pt = chars_in_text (BEG_ADDR, pt_byte - BEG_BYTE) + BEG; | 2363 | position = chars_in_text (BEG_ADDR, byte - BEG_BYTE) + BEG; |
| 2454 | TEMP_SET_PT_BOTH (pt, pt_byte); | 2364 | TEMP_SET_PT_BOTH (position, byte); |
| 2455 | } | 2365 | } |
| 2456 | 2366 | ||
| 2457 | tail = markers = BUF_MARKERS (current_buffer); | 2367 | tail = markers = BUF_MARKERS (current_buffer); |
| @@ -2482,7 +2392,7 @@ current buffer is cleared. */) | |||
| 2482 | if (!EQ (old_undo, Qt)) | 2392 | if (!EQ (old_undo, Qt)) |
| 2483 | { | 2393 | { |
| 2484 | /* Represent all the above changes by a special undo entry. */ | 2394 | /* Represent all the above changes by a special undo entry. */ |
| 2485 | current_buffer->undo_list = Fcons (list3 (Qapply, | 2395 | BVAR (current_buffer, undo_list) = Fcons (list3 (Qapply, |
| 2486 | intern ("set-buffer-multibyte"), | 2396 | intern ("set-buffer-multibyte"), |
| 2487 | NILP (flag) ? Qt : Qnil), | 2397 | NILP (flag) ? Qt : Qnil), |
| 2488 | old_undo); | 2398 | old_undo); |
| @@ -2497,11 +2407,11 @@ current buffer is cleared. */) | |||
| 2497 | 2407 | ||
| 2498 | /* Copy this buffer's new multibyte status | 2408 | /* Copy this buffer's new multibyte status |
| 2499 | into all of its indirect buffers. */ | 2409 | into all of its indirect buffers. */ |
| 2500 | for (other = all_buffers; other; other = other->next) | 2410 | for (other = all_buffers; other; other = other->header.next.buffer) |
| 2501 | if (other->base_buffer == current_buffer && !NILP (other->name)) | 2411 | if (other->base_buffer == current_buffer && !NILP (BVAR (other, name))) |
| 2502 | { | 2412 | { |
| 2503 | other->enable_multibyte_characters | 2413 | BVAR (other, enable_multibyte_characters) |
| 2504 | = current_buffer->enable_multibyte_characters; | 2414 | = BVAR (current_buffer, enable_multibyte_characters); |
| 2505 | other->prevent_redisplay_optimizations_p = 1; | 2415 | other->prevent_redisplay_optimizations_p = 1; |
| 2506 | } | 2416 | } |
| 2507 | 2417 | ||
| @@ -2521,8 +2431,8 @@ current buffer is cleared. */) | |||
| 2521 | return flag; | 2431 | return flag; |
| 2522 | } | 2432 | } |
| 2523 | 2433 | ||
| 2524 | DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables, | 2434 | DEFUN ("kill-all-local-variables", Fkill_all_local_variables, |
| 2525 | 0, 0, 0, | 2435 | Skill_all_local_variables, 0, 0, 0, |
| 2526 | doc: /* Switch to Fundamental mode by killing current buffer's local variables. | 2436 | doc: /* Switch to Fundamental mode by killing current buffer's local variables. |
| 2527 | Most local variable bindings are eliminated so that the default values | 2437 | Most local variable bindings are eliminated so that the default values |
| 2528 | become effective once more. Also, the syntax table is set from | 2438 | become effective once more. Also, the syntax table is set from |
| @@ -2540,8 +2450,7 @@ The first thing this function does is run | |||
| 2540 | the normal hook `change-major-mode-hook'. */) | 2450 | the normal hook `change-major-mode-hook'. */) |
| 2541 | (void) | 2451 | (void) |
| 2542 | { | 2452 | { |
| 2543 | if (!NILP (Vrun_hooks)) | 2453 | Frun_hooks (1, &Qchange_major_mode_hook); |
| 2544 | call1 (Vrun_hooks, Qchange_major_mode_hook); | ||
| 2545 | 2454 | ||
| 2546 | /* Make sure none of the bindings in local_var_alist | 2455 | /* Make sure none of the bindings in local_var_alist |
| 2547 | remain swapped in, in their symbols. */ | 2456 | remain swapped in, in their symbols. */ |
| @@ -2568,7 +2477,7 @@ swap_out_buffer_local_variables (struct buffer *b) | |||
| 2568 | Lisp_Object oalist, alist, buffer; | 2477 | Lisp_Object oalist, alist, buffer; |
| 2569 | 2478 | ||
| 2570 | XSETBUFFER (buffer, b); | 2479 | XSETBUFFER (buffer, b); |
| 2571 | oalist = b->local_var_alist; | 2480 | oalist = BVAR (b, local_var_alist); |
| 2572 | 2481 | ||
| 2573 | for (alist = oalist; CONSP (alist); alist = XCDR (alist)) | 2482 | for (alist = oalist; CONSP (alist); alist = XCDR (alist)) |
| 2574 | { | 2483 | { |
| @@ -3072,7 +2981,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str | |||
| 3072 | ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); | 2981 | ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); |
| 3073 | ssl->used++; | 2982 | ssl->used++; |
| 3074 | 2983 | ||
| 3075 | if (NILP (current_buffer->enable_multibyte_characters)) | 2984 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 3076 | nbytes = SCHARS (str); | 2985 | nbytes = SCHARS (str); |
| 3077 | else if (! STRING_MULTIBYTE (str)) | 2986 | else if (! STRING_MULTIBYTE (str)) |
| 3078 | nbytes = count_size_as_multibyte (SDATA (str), | 2987 | nbytes = count_size_as_multibyte (SDATA (str), |
| @@ -3084,7 +2993,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str | |||
| 3084 | 2993 | ||
| 3085 | if (STRINGP (str2)) | 2994 | if (STRINGP (str2)) |
| 3086 | { | 2995 | { |
| 3087 | if (NILP (current_buffer->enable_multibyte_characters)) | 2996 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 3088 | nbytes = SCHARS (str2); | 2997 | nbytes = SCHARS (str2); |
| 3089 | else if (! STRING_MULTIBYTE (str2)) | 2998 | else if (! STRING_MULTIBYTE (str2)) |
| 3090 | nbytes = count_size_as_multibyte (SDATA (str2), | 2999 | nbytes = count_size_as_multibyte (SDATA (str2), |
| @@ -3114,7 +3023,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3114 | Lisp_Object overlay, window, str; | 3023 | Lisp_Object overlay, window, str; |
| 3115 | struct Lisp_Overlay *ov; | 3024 | struct Lisp_Overlay *ov; |
| 3116 | EMACS_INT startpos, endpos; | 3025 | EMACS_INT startpos, endpos; |
| 3117 | int multibyte = ! NILP (current_buffer->enable_multibyte_characters); | 3026 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3118 | 3027 | ||
| 3119 | overlay_heads.used = overlay_heads.bytes = 0; | 3028 | overlay_heads.used = overlay_heads.bytes = 0; |
| 3120 | overlay_tails.used = overlay_tails.bytes = 0; | 3029 | overlay_tails.used = overlay_tails.bytes = 0; |
| @@ -3418,7 +3327,8 @@ void | |||
| 3418 | fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) | 3327 | fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) |
| 3419 | { | 3328 | { |
| 3420 | Lisp_Object overlay; | 3329 | Lisp_Object overlay; |
| 3421 | struct Lisp_Overlay *before_list, *after_list; | 3330 | struct Lisp_Overlay *before_list IF_LINT (= NULL); |
| 3331 | struct Lisp_Overlay *after_list IF_LINT (= NULL); | ||
| 3422 | /* These are either nil, indicating that before_list or after_list | 3332 | /* These are either nil, indicating that before_list or after_list |
| 3423 | should be assigned, or the cons cell the cdr of which should be | 3333 | should be assigned, or the cons cell the cdr of which should be |
| 3424 | assigned. */ | 3334 | assigned. */ |
| @@ -3566,7 +3476,7 @@ fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos) | |||
| 3566 | /* If parent is nil, replace overlays_before; otherwise, parent->next. */ | 3476 | /* If parent is nil, replace overlays_before; otherwise, parent->next. */ |
| 3567 | struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; | 3477 | struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; |
| 3568 | Lisp_Object tem; | 3478 | Lisp_Object tem; |
| 3569 | EMACS_INT end; | 3479 | EMACS_INT end IF_LINT (= 0); |
| 3570 | 3480 | ||
| 3571 | /* After the insertion, the several overlays may be in incorrect | 3481 | /* After the insertion, the several overlays may be in incorrect |
| 3572 | order. The possibility is that, in the list `overlays_before', | 3482 | order. The possibility is that, in the list `overlays_before', |
| @@ -4067,7 +3977,6 @@ If there are no overlay boundaries from (point-min) to POS, | |||
| 4067 | the value is (point-min). */) | 3977 | the value is (point-min). */) |
| 4068 | (Lisp_Object pos) | 3978 | (Lisp_Object pos) |
| 4069 | { | 3979 | { |
| 4070 | int noverlays; | ||
| 4071 | EMACS_INT prevpos; | 3980 | EMACS_INT prevpos; |
| 4072 | Lisp_Object *overlay_vec; | 3981 | Lisp_Object *overlay_vec; |
| 4073 | int len; | 3982 | int len; |
| @@ -4085,8 +3994,8 @@ the value is (point-min). */) | |||
| 4085 | /* Put all the overlays we want in a vector in overlay_vec. | 3994 | /* Put all the overlays we want in a vector in overlay_vec. |
| 4086 | Store the length in len. | 3995 | Store the length in len. |
| 4087 | prevpos gets the position of the previous change. */ | 3996 | prevpos gets the position of the previous change. */ |
| 4088 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 3997 | overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 4089 | (EMACS_INT *) 0, &prevpos, 1); | 3998 | (EMACS_INT *) 0, &prevpos, 1); |
| 4090 | 3999 | ||
| 4091 | xfree (overlay_vec); | 4000 | xfree (overlay_vec); |
| 4092 | return make_number (prevpos); | 4001 | return make_number (prevpos); |
| @@ -4200,7 +4109,7 @@ static int last_overlay_modification_hooks_used; | |||
| 4200 | static void | 4109 | static void |
| 4201 | add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) | 4110 | add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) |
| 4202 | { | 4111 | { |
| 4203 | int oldsize = XVECTOR (last_overlay_modification_hooks)->size; | 4112 | int oldsize = ASIZE (last_overlay_modification_hooks); |
| 4204 | 4113 | ||
| 4205 | if (last_overlay_modification_hooks_used == oldsize) | 4114 | if (last_overlay_modification_hooks_used == oldsize) |
| 4206 | last_overlay_modification_hooks = larger_vector | 4115 | last_overlay_modification_hooks = larger_vector |
| @@ -4342,10 +4251,10 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | |||
| 4342 | 4251 | ||
| 4343 | for (i = 0; i < size;) | 4252 | for (i = 0; i < size;) |
| 4344 | { | 4253 | { |
| 4345 | Lisp_Object prop, overlay; | 4254 | Lisp_Object prop_i, overlay_i; |
| 4346 | prop = copy[i++]; | 4255 | prop_i = copy[i++]; |
| 4347 | overlay = copy[i++]; | 4256 | overlay_i = copy[i++]; |
| 4348 | call_overlay_mod_hooks (prop, overlay, after, arg1, arg2, arg3); | 4257 | call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); |
| 4349 | } | 4258 | } |
| 4350 | } | 4259 | } |
| 4351 | UNGCPRO; | 4260 | UNGCPRO; |
| @@ -4914,7 +4823,7 @@ alloc_buffer_text (struct buffer *b, size_t nbytes) | |||
| 4914 | if (p == NULL) | 4823 | if (p == NULL) |
| 4915 | { | 4824 | { |
| 4916 | UNBLOCK_INPUT; | 4825 | UNBLOCK_INPUT; |
| 4917 | memory_full (); | 4826 | memory_full (nbytes); |
| 4918 | } | 4827 | } |
| 4919 | 4828 | ||
| 4920 | b->text->beg = (unsigned char *) p; | 4829 | b->text->beg = (unsigned char *) p; |
| @@ -4942,7 +4851,7 @@ enlarge_buffer_text (struct buffer *b, EMACS_INT delta) | |||
| 4942 | if (p == NULL) | 4851 | if (p == NULL) |
| 4943 | { | 4852 | { |
| 4944 | UNBLOCK_INPUT; | 4853 | UNBLOCK_INPUT; |
| 4945 | memory_full (); | 4854 | memory_full (nbytes); |
| 4946 | } | 4855 | } |
| 4947 | 4856 | ||
| 4948 | BUF_BEG_ADDR (b) = (unsigned char *) p; | 4857 | BUF_BEG_ADDR (b) = (unsigned char *) p; |
| @@ -4985,9 +4894,9 @@ init_buffer_once (void) | |||
| 4985 | /* Make sure all markable slots in buffer_defaults | 4894 | /* Make sure all markable slots in buffer_defaults |
| 4986 | are initialized reasonably, so mark_buffer won't choke. */ | 4895 | are initialized reasonably, so mark_buffer won't choke. */ |
| 4987 | reset_buffer (&buffer_defaults); | 4896 | reset_buffer (&buffer_defaults); |
| 4988 | eassert (EQ (buffer_defaults.name, make_number (0))); | 4897 | eassert (EQ (BVAR (&buffer_defaults, name), make_number (0))); |
| 4989 | reset_buffer_local_variables (&buffer_defaults, 1); | 4898 | reset_buffer_local_variables (&buffer_defaults, 1); |
| 4990 | eassert (EQ (buffer_local_symbols.name, make_number (0))); | 4899 | eassert (EQ (BVAR (&buffer_local_symbols, name), make_number (0))); |
| 4991 | reset_buffer (&buffer_local_symbols); | 4900 | reset_buffer (&buffer_local_symbols); |
| 4992 | reset_buffer_local_variables (&buffer_local_symbols, 1); | 4901 | reset_buffer_local_variables (&buffer_local_symbols, 1); |
| 4993 | /* Prevent GC from getting confused. */ | 4902 | /* Prevent GC from getting confused. */ |
| @@ -4995,69 +4904,66 @@ init_buffer_once (void) | |||
| 4995 | buffer_local_symbols.text = &buffer_local_symbols.own_text; | 4904 | buffer_local_symbols.text = &buffer_local_symbols.own_text; |
| 4996 | BUF_INTERVALS (&buffer_defaults) = 0; | 4905 | BUF_INTERVALS (&buffer_defaults) = 0; |
| 4997 | BUF_INTERVALS (&buffer_local_symbols) = 0; | 4906 | BUF_INTERVALS (&buffer_local_symbols) = 0; |
| 4998 | XSETPVECTYPE (&buffer_defaults, PVEC_BUFFER); | 4907 | XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0); |
| 4999 | XSETBUFFER (Vbuffer_defaults, &buffer_defaults); | 4908 | XSETBUFFER (Vbuffer_defaults, &buffer_defaults); |
| 5000 | XSETPVECTYPE (&buffer_local_symbols, PVEC_BUFFER); | 4909 | XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0); |
| 5001 | XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); | 4910 | XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); |
| 5002 | 4911 | ||
| 5003 | /* Set up the default values of various buffer slots. */ | 4912 | /* Set up the default values of various buffer slots. */ |
| 5004 | /* Must do these before making the first buffer! */ | 4913 | /* Must do these before making the first buffer! */ |
| 5005 | 4914 | ||
| 5006 | /* real setup is done in bindings.el */ | 4915 | /* real setup is done in bindings.el */ |
| 5007 | buffer_defaults.mode_line_format = make_pure_c_string ("%-"); | 4916 | BVAR (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-"); |
| 5008 | buffer_defaults.header_line_format = Qnil; | 4917 | BVAR (&buffer_defaults, header_line_format) = Qnil; |
| 5009 | buffer_defaults.abbrev_mode = Qnil; | 4918 | BVAR (&buffer_defaults, abbrev_mode) = Qnil; |
| 5010 | buffer_defaults.overwrite_mode = Qnil; | 4919 | BVAR (&buffer_defaults, overwrite_mode) = Qnil; |
| 5011 | buffer_defaults.case_fold_search = Qt; | 4920 | BVAR (&buffer_defaults, case_fold_search) = Qt; |
| 5012 | buffer_defaults.auto_fill_function = Qnil; | 4921 | BVAR (&buffer_defaults, auto_fill_function) = Qnil; |
| 5013 | buffer_defaults.selective_display = Qnil; | 4922 | BVAR (&buffer_defaults, selective_display) = Qnil; |
| 5014 | #ifndef old | 4923 | #ifndef old |
| 5015 | buffer_defaults.selective_display_ellipses = Qt; | 4924 | BVAR (&buffer_defaults, selective_display_ellipses) = Qt; |
| 5016 | #endif | 4925 | #endif |
| 5017 | buffer_defaults.abbrev_table = Qnil; | 4926 | BVAR (&buffer_defaults, abbrev_table) = Qnil; |
| 5018 | buffer_defaults.display_table = Qnil; | 4927 | BVAR (&buffer_defaults, display_table) = Qnil; |
| 5019 | buffer_defaults.undo_list = Qnil; | 4928 | BVAR (&buffer_defaults, undo_list) = Qnil; |
| 5020 | buffer_defaults.mark_active = Qnil; | 4929 | BVAR (&buffer_defaults, mark_active) = Qnil; |
| 5021 | buffer_defaults.file_format = Qnil; | 4930 | BVAR (&buffer_defaults, file_format) = Qnil; |
| 5022 | buffer_defaults.auto_save_file_format = Qt; | 4931 | BVAR (&buffer_defaults, auto_save_file_format) = Qt; |
| 5023 | buffer_defaults.overlays_before = NULL; | 4932 | buffer_defaults.overlays_before = NULL; |
| 5024 | buffer_defaults.overlays_after = NULL; | 4933 | buffer_defaults.overlays_after = NULL; |
| 5025 | buffer_defaults.overlay_center = BEG; | 4934 | buffer_defaults.overlay_center = BEG; |
| 5026 | 4935 | ||
| 5027 | XSETFASTINT (buffer_defaults.tab_width, 8); | 4936 | XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); |
| 5028 | buffer_defaults.truncate_lines = Qnil; | 4937 | BVAR (&buffer_defaults, truncate_lines) = Qnil; |
| 5029 | buffer_defaults.word_wrap = Qnil; | 4938 | BVAR (&buffer_defaults, word_wrap) = Qnil; |
| 5030 | buffer_defaults.ctl_arrow = Qt; | 4939 | BVAR (&buffer_defaults, ctl_arrow) = Qt; |
| 5031 | buffer_defaults.bidi_display_reordering = Qnil; | 4940 | BVAR (&buffer_defaults, bidi_display_reordering) = Qnil; |
| 5032 | buffer_defaults.bidi_paragraph_direction = Qnil; | 4941 | BVAR (&buffer_defaults, bidi_paragraph_direction) = Qnil; |
| 5033 | buffer_defaults.cursor_type = Qt; | 4942 | BVAR (&buffer_defaults, cursor_type) = Qt; |
| 5034 | buffer_defaults.extra_line_spacing = Qnil; | 4943 | BVAR (&buffer_defaults, extra_line_spacing) = Qnil; |
| 5035 | buffer_defaults.cursor_in_non_selected_windows = Qt; | 4944 | BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt; |
| 5036 | 4945 | ||
| 5037 | #ifdef DOS_NT | 4946 | BVAR (&buffer_defaults, enable_multibyte_characters) = Qt; |
| 5038 | buffer_defaults.buffer_file_type = Qnil; /* TEXT */ | 4947 | BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil; |
| 5039 | #endif | 4948 | XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); |
| 5040 | buffer_defaults.enable_multibyte_characters = Qt; | 4949 | XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); |
| 5041 | buffer_defaults.buffer_file_coding_system = Qnil; | 4950 | BVAR (&buffer_defaults, cache_long_line_scans) = Qnil; |
| 5042 | XSETFASTINT (buffer_defaults.fill_column, 70); | 4951 | BVAR (&buffer_defaults, file_truename) = Qnil; |
| 5043 | XSETFASTINT (buffer_defaults.left_margin, 0); | 4952 | XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); |
| 5044 | buffer_defaults.cache_long_line_scans = Qnil; | 4953 | XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); |
| 5045 | buffer_defaults.file_truename = Qnil; | 4954 | XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); |
| 5046 | XSETFASTINT (buffer_defaults.display_count, 0); | 4955 | BVAR (&buffer_defaults, left_fringe_width) = Qnil; |
| 5047 | XSETFASTINT (buffer_defaults.left_margin_cols, 0); | 4956 | BVAR (&buffer_defaults, right_fringe_width) = Qnil; |
| 5048 | XSETFASTINT (buffer_defaults.right_margin_cols, 0); | 4957 | BVAR (&buffer_defaults, fringes_outside_margins) = Qnil; |
| 5049 | buffer_defaults.left_fringe_width = Qnil; | 4958 | BVAR (&buffer_defaults, scroll_bar_width) = Qnil; |
| 5050 | buffer_defaults.right_fringe_width = Qnil; | 4959 | BVAR (&buffer_defaults, vertical_scroll_bar_type) = Qt; |
| 5051 | buffer_defaults.fringes_outside_margins = Qnil; | 4960 | BVAR (&buffer_defaults, indicate_empty_lines) = Qnil; |
| 5052 | buffer_defaults.scroll_bar_width = Qnil; | 4961 | BVAR (&buffer_defaults, indicate_buffer_boundaries) = Qnil; |
| 5053 | buffer_defaults.vertical_scroll_bar_type = Qt; | 4962 | BVAR (&buffer_defaults, fringe_indicator_alist) = Qnil; |
| 5054 | buffer_defaults.indicate_empty_lines = Qnil; | 4963 | BVAR (&buffer_defaults, fringe_cursor_alist) = Qnil; |
| 5055 | buffer_defaults.indicate_buffer_boundaries = Qnil; | 4964 | BVAR (&buffer_defaults, scroll_up_aggressively) = Qnil; |
| 5056 | buffer_defaults.fringe_indicator_alist = Qnil; | 4965 | BVAR (&buffer_defaults, scroll_down_aggressively) = Qnil; |
| 5057 | buffer_defaults.fringe_cursor_alist = Qnil; | 4966 | BVAR (&buffer_defaults, display_time) = Qnil; |
| 5058 | buffer_defaults.scroll_up_aggressively = Qnil; | ||
| 5059 | buffer_defaults.scroll_down_aggressively = Qnil; | ||
| 5060 | buffer_defaults.display_time = Qnil; | ||
| 5061 | 4967 | ||
| 5062 | /* Assign the local-flags to the slots that have default values. | 4968 | /* Assign the local-flags to the slots that have default values. |
| 5063 | The local flag is a bit that is used in the buffer | 4969 | The local flag is a bit that is used in the buffer |
| @@ -5069,73 +4975,68 @@ init_buffer_once (void) | |||
| 5069 | 4975 | ||
| 5070 | /* 0 means not a lisp var, -1 means always local, else mask */ | 4976 | /* 0 means not a lisp var, -1 means always local, else mask */ |
| 5071 | memset (&buffer_local_flags, 0, sizeof buffer_local_flags); | 4977 | memset (&buffer_local_flags, 0, sizeof buffer_local_flags); |
| 5072 | XSETINT (buffer_local_flags.filename, -1); | 4978 | XSETINT (BVAR (&buffer_local_flags, filename), -1); |
| 5073 | XSETINT (buffer_local_flags.directory, -1); | 4979 | XSETINT (BVAR (&buffer_local_flags, directory), -1); |
| 5074 | XSETINT (buffer_local_flags.backed_up, -1); | 4980 | XSETINT (BVAR (&buffer_local_flags, backed_up), -1); |
| 5075 | XSETINT (buffer_local_flags.save_length, -1); | 4981 | XSETINT (BVAR (&buffer_local_flags, save_length), -1); |
| 5076 | XSETINT (buffer_local_flags.auto_save_file_name, -1); | 4982 | XSETINT (BVAR (&buffer_local_flags, auto_save_file_name), -1); |
| 5077 | XSETINT (buffer_local_flags.read_only, -1); | 4983 | XSETINT (BVAR (&buffer_local_flags, read_only), -1); |
| 5078 | XSETINT (buffer_local_flags.major_mode, -1); | 4984 | XSETINT (BVAR (&buffer_local_flags, major_mode), -1); |
| 5079 | XSETINT (buffer_local_flags.mode_name, -1); | 4985 | XSETINT (BVAR (&buffer_local_flags, mode_name), -1); |
| 5080 | XSETINT (buffer_local_flags.undo_list, -1); | 4986 | XSETINT (BVAR (&buffer_local_flags, undo_list), -1); |
| 5081 | XSETINT (buffer_local_flags.mark_active, -1); | 4987 | XSETINT (BVAR (&buffer_local_flags, mark_active), -1); |
| 5082 | XSETINT (buffer_local_flags.point_before_scroll, -1); | 4988 | XSETINT (BVAR (&buffer_local_flags, point_before_scroll), -1); |
| 5083 | XSETINT (buffer_local_flags.file_truename, -1); | 4989 | XSETINT (BVAR (&buffer_local_flags, file_truename), -1); |
| 5084 | XSETINT (buffer_local_flags.invisibility_spec, -1); | 4990 | XSETINT (BVAR (&buffer_local_flags, invisibility_spec), -1); |
| 5085 | XSETINT (buffer_local_flags.file_format, -1); | 4991 | XSETINT (BVAR (&buffer_local_flags, file_format), -1); |
| 5086 | XSETINT (buffer_local_flags.auto_save_file_format, -1); | 4992 | XSETINT (BVAR (&buffer_local_flags, auto_save_file_format), -1); |
| 5087 | XSETINT (buffer_local_flags.display_count, -1); | 4993 | XSETINT (BVAR (&buffer_local_flags, display_count), -1); |
| 5088 | XSETINT (buffer_local_flags.display_time, -1); | 4994 | XSETINT (BVAR (&buffer_local_flags, display_time), -1); |
| 5089 | XSETINT (buffer_local_flags.enable_multibyte_characters, -1); | 4995 | XSETINT (BVAR (&buffer_local_flags, enable_multibyte_characters), -1); |
| 5090 | 4996 | ||
| 5091 | idx = 1; | 4997 | idx = 1; |
| 5092 | XSETFASTINT (buffer_local_flags.mode_line_format, idx); ++idx; | 4998 | XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; |
| 5093 | XSETFASTINT (buffer_local_flags.abbrev_mode, idx); ++idx; | 4999 | XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx; |
| 5094 | XSETFASTINT (buffer_local_flags.overwrite_mode, idx); ++idx; | 5000 | XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx; |
| 5095 | XSETFASTINT (buffer_local_flags.case_fold_search, idx); ++idx; | 5001 | XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx; |
| 5096 | XSETFASTINT (buffer_local_flags.auto_fill_function, idx); ++idx; | 5002 | XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx; |
| 5097 | XSETFASTINT (buffer_local_flags.selective_display, idx); ++idx; | 5003 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx; |
| 5098 | #ifndef old | 5004 | #ifndef old |
| 5099 | XSETFASTINT (buffer_local_flags.selective_display_ellipses, idx); ++idx; | 5005 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx; |
| 5100 | #endif | 5006 | #endif |
| 5101 | XSETFASTINT (buffer_local_flags.tab_width, idx); ++idx; | 5007 | XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx; |
| 5102 | XSETFASTINT (buffer_local_flags.truncate_lines, idx); ++idx; | 5008 | XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx; |
| 5103 | XSETFASTINT (buffer_local_flags.word_wrap, idx); ++idx; | 5009 | XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx; |
| 5104 | XSETFASTINT (buffer_local_flags.ctl_arrow, idx); ++idx; | 5010 | XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx; |
| 5105 | XSETFASTINT (buffer_local_flags.fill_column, idx); ++idx; | 5011 | XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx; |
| 5106 | XSETFASTINT (buffer_local_flags.left_margin, idx); ++idx; | 5012 | XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx; |
| 5107 | XSETFASTINT (buffer_local_flags.abbrev_table, idx); ++idx; | 5013 | XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; |
| 5108 | XSETFASTINT (buffer_local_flags.display_table, idx); ++idx; | 5014 | XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; |
| 5109 | #ifdef DOS_NT | 5015 | XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; |
| 5110 | XSETFASTINT (buffer_local_flags.buffer_file_type, idx); | 5016 | XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx; |
| 5017 | XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; | ||
| 5018 | XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx; | ||
| 5019 | XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; | ||
| 5020 | XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx); | ||
| 5111 | /* Make this one a permanent local. */ | 5021 | /* Make this one a permanent local. */ |
| 5112 | buffer_permanent_local_flags[idx++] = 1; | 5022 | buffer_permanent_local_flags[idx++] = 1; |
| 5113 | #endif | 5023 | XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx; |
| 5114 | XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx; | 5024 | XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx; |
| 5115 | XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; | 5025 | XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx; |
| 5116 | XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; | 5026 | XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx; |
| 5117 | XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; | 5027 | XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx; |
| 5118 | XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx; | 5028 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx; |
| 5119 | XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); | 5029 | XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; |
| 5120 | /* Make this one a permanent local. */ | 5030 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx; |
| 5121 | buffer_permanent_local_flags[idx++] = 1; | 5031 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; |
| 5122 | XSETFASTINT (buffer_local_flags.left_margin_cols, idx); ++idx; | 5032 | XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; |
| 5123 | XSETFASTINT (buffer_local_flags.right_margin_cols, idx); ++idx; | 5033 | XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx; |
| 5124 | XSETFASTINT (buffer_local_flags.left_fringe_width, idx); ++idx; | 5034 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; |
| 5125 | XSETFASTINT (buffer_local_flags.right_fringe_width, idx); ++idx; | 5035 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; |
| 5126 | XSETFASTINT (buffer_local_flags.fringes_outside_margins, idx); ++idx; | 5036 | XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx; |
| 5127 | XSETFASTINT (buffer_local_flags.scroll_bar_width, idx); ++idx; | 5037 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx; |
| 5128 | XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx; | 5038 | XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx; |
| 5129 | XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx; | 5039 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; |
| 5130 | XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx; | ||
| 5131 | XSETFASTINT (buffer_local_flags.fringe_indicator_alist, idx); ++idx; | ||
| 5132 | XSETFASTINT (buffer_local_flags.fringe_cursor_alist, idx); ++idx; | ||
| 5133 | XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx; | ||
| 5134 | XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx; | ||
| 5135 | XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx; | ||
| 5136 | XSETFASTINT (buffer_local_flags.cursor_type, idx); ++idx; | ||
| 5137 | XSETFASTINT (buffer_local_flags.extra_line_spacing, idx); ++idx; | ||
| 5138 | XSETFASTINT (buffer_local_flags.cursor_in_non_selected_windows, idx); ++idx; | ||
| 5139 | 5040 | ||
| 5140 | /* Need more room? */ | 5041 | /* Need more room? */ |
| 5141 | if (idx >= MAX_PER_BUFFER_VARS) | 5042 | if (idx >= MAX_PER_BUFFER_VARS) |
| @@ -5149,7 +5050,7 @@ init_buffer_once (void) | |||
| 5149 | QSFundamental = make_pure_c_string ("Fundamental"); | 5050 | QSFundamental = make_pure_c_string ("Fundamental"); |
| 5150 | 5051 | ||
| 5151 | Qfundamental_mode = intern_c_string ("fundamental-mode"); | 5052 | Qfundamental_mode = intern_c_string ("fundamental-mode"); |
| 5152 | buffer_defaults.major_mode = Qfundamental_mode; | 5053 | BVAR (&buffer_defaults, major_mode) = Qfundamental_mode; |
| 5153 | 5054 | ||
| 5154 | Qmode_class = intern_c_string ("mode-class"); | 5055 | Qmode_class = intern_c_string ("mode-class"); |
| 5155 | 5056 | ||
| @@ -5185,14 +5086,14 @@ init_buffer (void) | |||
| 5185 | Map new memory. */ | 5086 | Map new memory. */ |
| 5186 | struct buffer *b; | 5087 | struct buffer *b; |
| 5187 | 5088 | ||
| 5188 | for (b = all_buffers; b; b = b->next) | 5089 | for (b = all_buffers; b; b = b->header.next.buffer) |
| 5189 | if (b->text->beg == NULL) | 5090 | if (b->text->beg == NULL) |
| 5190 | enlarge_buffer_text (b, 0); | 5091 | enlarge_buffer_text (b, 0); |
| 5191 | } | 5092 | } |
| 5192 | #endif /* USE_MMAP_FOR_BUFFERS */ | 5093 | #endif /* USE_MMAP_FOR_BUFFERS */ |
| 5193 | 5094 | ||
| 5194 | Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); | 5095 | Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); |
| 5195 | if (NILP (buffer_defaults.enable_multibyte_characters)) | 5096 | if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) |
| 5196 | Fset_buffer_multibyte (Qnil); | 5097 | Fset_buffer_multibyte (Qnil); |
| 5197 | 5098 | ||
| 5198 | pwd = get_current_dir_name (); | 5099 | pwd = get_current_dir_name (); |
| @@ -5213,28 +5114,28 @@ init_buffer (void) | |||
| 5213 | pwd[len + 1] = '\0'; | 5114 | pwd[len + 1] = '\0'; |
| 5214 | } | 5115 | } |
| 5215 | 5116 | ||
| 5216 | current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); | 5117 | BVAR (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd)); |
| 5217 | if (! NILP (buffer_defaults.enable_multibyte_characters)) | 5118 | if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) |
| 5218 | /* At this moment, we still don't know how to decode the | 5119 | /* At this moment, we still don't know how to decode the |
| 5219 | directory name. So, we keep the bytes in multibyte form so | 5120 | directory name. So, we keep the bytes in multibyte form so |
| 5220 | that ENCODE_FILE correctly gets the original bytes. */ | 5121 | that ENCODE_FILE correctly gets the original bytes. */ |
| 5221 | current_buffer->directory | 5122 | BVAR (current_buffer, directory) |
| 5222 | = string_to_multibyte (current_buffer->directory); | 5123 | = string_to_multibyte (BVAR (current_buffer, directory)); |
| 5223 | 5124 | ||
| 5224 | /* Add /: to the front of the name | 5125 | /* Add /: to the front of the name |
| 5225 | if it would otherwise be treated as magic. */ | 5126 | if it would otherwise be treated as magic. */ |
| 5226 | temp = Ffind_file_name_handler (current_buffer->directory, Qt); | 5127 | temp = Ffind_file_name_handler (BVAR (current_buffer, directory), Qt); |
| 5227 | if (! NILP (temp) | 5128 | if (! NILP (temp) |
| 5228 | /* If the default dir is just /, TEMP is non-nil | 5129 | /* If the default dir is just /, TEMP is non-nil |
| 5229 | because of the ange-ftp completion handler. | 5130 | because of the ange-ftp completion handler. |
| 5230 | However, it is not necessary to turn / into /:/. | 5131 | However, it is not necessary to turn / into /:/. |
| 5231 | So avoid doing that. */ | 5132 | So avoid doing that. */ |
| 5232 | && strcmp ("/", SSDATA (current_buffer->directory))) | 5133 | && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) |
| 5233 | current_buffer->directory | 5134 | BVAR (current_buffer, directory) |
| 5234 | = concat2 (build_string ("/:"), current_buffer->directory); | 5135 | = concat2 (build_string ("/:"), BVAR (current_buffer, directory)); |
| 5235 | 5136 | ||
| 5236 | temp = get_minibuffer (0); | 5137 | temp = get_minibuffer (0); |
| 5237 | XBUFFER (temp)->directory = current_buffer->directory; | 5138 | BVAR (XBUFFER (temp), directory) = BVAR (current_buffer, directory); |
| 5238 | 5139 | ||
| 5239 | free (pwd); | 5140 | free (pwd); |
| 5240 | } | 5141 | } |
| @@ -5252,12 +5153,12 @@ init_buffer (void) | |||
| 5252 | #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ | 5153 | #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ |
| 5253 | do { \ | 5154 | do { \ |
| 5254 | static struct Lisp_Buffer_Objfwd bo_fwd; \ | 5155 | static struct Lisp_Buffer_Objfwd bo_fwd; \ |
| 5255 | defvar_per_buffer (&bo_fwd, lname, vname, type, 0); \ | 5156 | defvar_per_buffer (&bo_fwd, lname, vname, type); \ |
| 5256 | } while (0) | 5157 | } while (0) |
| 5257 | 5158 | ||
| 5258 | static void | 5159 | static void |
| 5259 | defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, | 5160 | defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, |
| 5260 | Lisp_Object *address, Lisp_Object type, char *doc) | 5161 | Lisp_Object *address, Lisp_Object type) |
| 5261 | { | 5162 | { |
| 5262 | struct Lisp_Symbol *sym; | 5163 | struct Lisp_Symbol *sym; |
| 5263 | int offset; | 5164 | int offset; |
| @@ -5268,6 +5169,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, | |||
| 5268 | bo_fwd->type = Lisp_Fwd_Buffer_Obj; | 5169 | bo_fwd->type = Lisp_Fwd_Buffer_Obj; |
| 5269 | bo_fwd->offset = offset; | 5170 | bo_fwd->offset = offset; |
| 5270 | bo_fwd->slottype = type; | 5171 | bo_fwd->slottype = type; |
| 5172 | sym->declared_special = 1; | ||
| 5271 | sym->redirect = SYMBOL_FORWARDED; | 5173 | sym->redirect = SYMBOL_FORWARDED; |
| 5272 | { | 5174 | { |
| 5273 | /* I tried to do the job without a cast, but it seems impossible. | 5175 | /* I tried to do the job without a cast, but it seems impossible. |
| @@ -5337,9 +5239,6 @@ syms_of_buffer (void) | |||
| 5337 | Fput (Qprotected_field, Qerror_message, | 5239 | Fput (Qprotected_field, Qerror_message, |
| 5338 | make_pure_c_string ("Attempt to modify a protected field")); | 5240 | make_pure_c_string ("Attempt to modify a protected field")); |
| 5339 | 5241 | ||
| 5340 | /* All these use DEFVAR_LISP_NOPRO because the slots in | ||
| 5341 | buffer_defaults will all be marked via Vbuffer_defaults. */ | ||
| 5342 | |||
| 5343 | DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", | 5242 | DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", |
| 5344 | mode_line_format, | 5243 | mode_line_format, |
| 5345 | doc: /* Default value of `mode-line-format' for buffers that don't override it. | 5244 | doc: /* Default value of `mode-line-format' for buffers that don't override it. |
| @@ -5409,14 +5308,6 @@ This is the same as (default-value 'tab-width). */); | |||
| 5409 | doc: /* Default value of `case-fold-search' for buffers that don't override it. | 5308 | doc: /* Default value of `case-fold-search' for buffers that don't override it. |
| 5410 | This is the same as (default-value 'case-fold-search). */); | 5309 | This is the same as (default-value 'case-fold-search). */); |
| 5411 | 5310 | ||
| 5412 | #ifdef DOS_NT | ||
| 5413 | DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-type", | ||
| 5414 | buffer_file_type, | ||
| 5415 | doc: /* Default file type for buffers that do not override it. | ||
| 5416 | This is the same as (default-value 'buffer-file-type). | ||
| 5417 | The file type is nil for text, t for binary. */); | ||
| 5418 | #endif | ||
| 5419 | |||
| 5420 | DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", | 5311 | DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", |
| 5421 | left_margin_cols, | 5312 | left_margin_cols, |
| 5422 | doc: /* Default value of `left-margin-width' for buffers that don't override it. | 5313 | doc: /* Default value of `left-margin-width' for buffers that don't override it. |
| @@ -5485,13 +5376,13 @@ This value applies in buffers that don't have their own local values. | |||
| 5485 | This is the same as (default-value 'scroll-down-aggressively). */); | 5376 | This is the same as (default-value 'scroll-down-aggressively). */); |
| 5486 | 5377 | ||
| 5487 | DEFVAR_PER_BUFFER ("header-line-format", | 5378 | DEFVAR_PER_BUFFER ("header-line-format", |
| 5488 | ¤t_buffer->header_line_format, | 5379 | &BVAR (current_buffer, header_line_format), |
| 5489 | Qnil, | 5380 | Qnil, |
| 5490 | doc: /* Analogous to `mode-line-format', but controls the header line. | 5381 | doc: /* Analogous to `mode-line-format', but controls the header line. |
| 5491 | The header line appears, optionally, at the top of a window; | 5382 | The header line appears, optionally, at the top of a window; |
| 5492 | the mode line appears at the bottom. */); | 5383 | the mode line appears at the bottom. */); |
| 5493 | 5384 | ||
| 5494 | DEFVAR_PER_BUFFER ("mode-line-format", ¤t_buffer->mode_line_format, | 5385 | DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format), |
| 5495 | Qnil, | 5386 | Qnil, |
| 5496 | doc: /* Template for displaying mode line for current buffer. | 5387 | doc: /* Template for displaying mode line for current buffer. |
| 5497 | Each buffer has its own value of this variable. | 5388 | Each buffer has its own value of this variable. |
| @@ -5548,7 +5439,7 @@ Decimal digits after the % specify field width to which to pad. */); | |||
| 5548 | DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, | 5439 | DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, |
| 5549 | doc: /* *Value of `major-mode' for new buffers. */); | 5440 | doc: /* *Value of `major-mode' for new buffers. */); |
| 5550 | 5441 | ||
| 5551 | DEFVAR_PER_BUFFER ("major-mode", ¤t_buffer->major_mode, | 5442 | DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), |
| 5552 | make_number (Lisp_Symbol), | 5443 | make_number (Lisp_Symbol), |
| 5553 | doc: /* Symbol for current buffer's major mode. | 5444 | doc: /* Symbol for current buffer's major mode. |
| 5554 | The default value (normally `fundamental-mode') affects new buffers. | 5445 | The default value (normally `fundamental-mode') affects new buffers. |
| @@ -5561,46 +5452,47 @@ the buffer. Thus, the mode and its hooks should not expect certain | |||
| 5561 | variables such as `buffer-read-only' and `buffer-file-coding-system' | 5452 | variables such as `buffer-read-only' and `buffer-file-coding-system' |
| 5562 | to be set up. */); | 5453 | to be set up. */); |
| 5563 | 5454 | ||
| 5564 | DEFVAR_PER_BUFFER ("mode-name", ¤t_buffer->mode_name, | 5455 | DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name), |
| 5565 | Qnil, | 5456 | Qnil, |
| 5566 | doc: /* Pretty name of current buffer's major mode. | 5457 | doc: /* Pretty name of current buffer's major mode. |
| 5567 | Usually a string, but can use any of the constructs for `mode-line-format', | 5458 | Usually a string, but can use any of the constructs for `mode-line-format', |
| 5568 | which see. | 5459 | which see. |
| 5569 | Format with `format-mode-line' to produce a string value. */); | 5460 | Format with `format-mode-line' to produce a string value. */); |
| 5570 | 5461 | ||
| 5571 | DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, | 5462 | DEFVAR_PER_BUFFER ("local-abbrev-table", &BVAR (current_buffer, abbrev_table), Qnil, |
| 5572 | doc: /* Local (mode-specific) abbrev table of current buffer. */); | 5463 | doc: /* Local (mode-specific) abbrev table of current buffer. */); |
| 5573 | 5464 | ||
| 5574 | DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, | 5465 | DEFVAR_PER_BUFFER ("abbrev-mode", &BVAR (current_buffer, abbrev_mode), Qnil, |
| 5575 | doc: /* Non-nil if Abbrev mode is enabled. | 5466 | doc: /* Non-nil if Abbrev mode is enabled. |
| 5576 | Use the command `abbrev-mode' to change this variable. */); | 5467 | Use the command `abbrev-mode' to change this variable. */); |
| 5577 | 5468 | ||
| 5578 | DEFVAR_PER_BUFFER ("case-fold-search", ¤t_buffer->case_fold_search, | 5469 | DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search), |
| 5579 | Qnil, | 5470 | Qnil, |
| 5580 | doc: /* *Non-nil if searches and matches should ignore case. */); | 5471 | doc: /* *Non-nil if searches and matches should ignore case. */); |
| 5581 | 5472 | ||
| 5582 | DEFVAR_PER_BUFFER ("fill-column", ¤t_buffer->fill_column, | 5473 | DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), |
| 5583 | make_number (LISP_INT_TAG), | 5474 | make_number (LISP_INT_TAG), |
| 5584 | doc: /* *Column beyond which automatic line-wrapping should happen. | 5475 | doc: /* *Column beyond which automatic line-wrapping should happen. |
| 5585 | Interactively, you can set the buffer local value using \\[set-fill-column]. */); | 5476 | Interactively, you can set the buffer local value using \\[set-fill-column]. */); |
| 5586 | 5477 | ||
| 5587 | DEFVAR_PER_BUFFER ("left-margin", ¤t_buffer->left_margin, | 5478 | DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), |
| 5588 | make_number (LISP_INT_TAG), | 5479 | make_number (LISP_INT_TAG), |
| 5589 | doc: /* *Column for the default `indent-line-function' to indent to. | 5480 | doc: /* *Column for the default `indent-line-function' to indent to. |
| 5590 | Linefeed indents to this column in Fundamental mode. */); | 5481 | Linefeed indents to this column in Fundamental mode. */); |
| 5591 | 5482 | ||
| 5592 | DEFVAR_PER_BUFFER ("tab-width", ¤t_buffer->tab_width, | 5483 | DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), |
| 5593 | make_number (LISP_INT_TAG), | 5484 | make_number (LISP_INT_TAG), |
| 5594 | doc: /* *Distance between tab stops (for display of tab characters), in columns. */); | 5485 | doc: /* *Distance between tab stops (for display of tab characters), in columns. |
| 5486 | This should be an integer greater than zero. */); | ||
| 5595 | 5487 | ||
| 5596 | DEFVAR_PER_BUFFER ("ctl-arrow", ¤t_buffer->ctl_arrow, Qnil, | 5488 | DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil, |
| 5597 | doc: /* *Non-nil means display control chars with uparrow. | 5489 | doc: /* *Non-nil means display control chars with uparrow. |
| 5598 | A value of nil means use backslash and octal digits. | 5490 | A value of nil means use backslash and octal digits. |
| 5599 | This variable does not apply to characters whose display is specified | 5491 | This variable does not apply to characters whose display is specified |
| 5600 | in the current display table (if there is one). */); | 5492 | in the current display table (if there is one). */); |
| 5601 | 5493 | ||
| 5602 | DEFVAR_PER_BUFFER ("enable-multibyte-characters", | 5494 | DEFVAR_PER_BUFFER ("enable-multibyte-characters", |
| 5603 | ¤t_buffer->enable_multibyte_characters, | 5495 | &BVAR (current_buffer, enable_multibyte_characters), |
| 5604 | Qnil, | 5496 | Qnil, |
| 5605 | doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. | 5497 | doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. |
| 5606 | Otherwise they are regarded as unibyte. This affects the display, | 5498 | Otherwise they are regarded as unibyte. This affects the display, |
| @@ -5614,7 +5506,7 @@ See also variable `default-enable-multibyte-characters' and Info node | |||
| 5614 | XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; | 5506 | XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; |
| 5615 | 5507 | ||
| 5616 | DEFVAR_PER_BUFFER ("buffer-file-coding-system", | 5508 | DEFVAR_PER_BUFFER ("buffer-file-coding-system", |
| 5617 | ¤t_buffer->buffer_file_coding_system, Qnil, | 5509 | &BVAR (current_buffer, buffer_file_coding_system), Qnil, |
| 5618 | doc: /* Coding system to be used for encoding the buffer contents on saving. | 5510 | doc: /* Coding system to be used for encoding the buffer contents on saving. |
| 5619 | This variable applies to saving the buffer, and also to `write-region' | 5511 | This variable applies to saving the buffer, and also to `write-region' |
| 5620 | and other functions that use `write-region'. | 5512 | and other functions that use `write-region'. |
| @@ -5632,11 +5524,11 @@ The variable `coding-system-for-write', if non-nil, overrides this variable. | |||
| 5632 | This variable is never applied to a way of decoding a file while reading it. */); | 5524 | This variable is never applied to a way of decoding a file while reading it. */); |
| 5633 | 5525 | ||
| 5634 | DEFVAR_PER_BUFFER ("bidi-display-reordering", | 5526 | DEFVAR_PER_BUFFER ("bidi-display-reordering", |
| 5635 | ¤t_buffer->bidi_display_reordering, Qnil, | 5527 | &BVAR (current_buffer, bidi_display_reordering), Qnil, |
| 5636 | doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); | 5528 | doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); |
| 5637 | 5529 | ||
| 5638 | DEFVAR_PER_BUFFER ("bidi-paragraph-direction", | 5530 | DEFVAR_PER_BUFFER ("bidi-paragraph-direction", |
| 5639 | ¤t_buffer->bidi_paragraph_direction, Qnil, | 5531 | &BVAR (current_buffer, bidi_paragraph_direction), Qnil, |
| 5640 | doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. | 5532 | doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. |
| 5641 | 5533 | ||
| 5642 | If this is nil (the default), the direction of each paragraph is | 5534 | If this is nil (the default), the direction of each paragraph is |
| @@ -5647,7 +5539,7 @@ Any other value is treated as nil. | |||
| 5647 | This variable has no effect unless the buffer's value of | 5539 | This variable has no effect unless the buffer's value of |
| 5648 | \`bidi-display-reordering' is non-nil. */); | 5540 | \`bidi-display-reordering' is non-nil. */); |
| 5649 | 5541 | ||
| 5650 | DEFVAR_PER_BUFFER ("truncate-lines", ¤t_buffer->truncate_lines, Qnil, | 5542 | DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil, |
| 5651 | doc: /* *Non-nil means do not display continuation lines. | 5543 | doc: /* *Non-nil means do not display continuation lines. |
| 5652 | Instead, give each line of text just one screen line. | 5544 | Instead, give each line of text just one screen line. |
| 5653 | 5545 | ||
| @@ -5655,7 +5547,7 @@ Note that this is overridden by the variable | |||
| 5655 | `truncate-partial-width-windows' if that variable is non-nil | 5547 | `truncate-partial-width-windows' if that variable is non-nil |
| 5656 | and this buffer is not full-frame width. */); | 5548 | and this buffer is not full-frame width. */); |
| 5657 | 5549 | ||
| 5658 | DEFVAR_PER_BUFFER ("word-wrap", ¤t_buffer->word_wrap, Qnil, | 5550 | DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, |
| 5659 | doc: /* *Non-nil means to use word-wrapping for continuation lines. | 5551 | doc: /* *Non-nil means to use word-wrapping for continuation lines. |
| 5660 | When word-wrapping is on, continuation lines are wrapped at the space | 5552 | When word-wrapping is on, continuation lines are wrapped at the space |
| 5661 | or tab character nearest to the right window edge. | 5553 | or tab character nearest to the right window edge. |
| @@ -5667,21 +5559,12 @@ word-wrapping, you might want to reduce the value of | |||
| 5667 | `truncate-partial-width-windows', since wrapping can make text readable | 5559 | `truncate-partial-width-windows', since wrapping can make text readable |
| 5668 | in narrower windows. */); | 5560 | in narrower windows. */); |
| 5669 | 5561 | ||
| 5670 | #ifdef DOS_NT | 5562 | DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), |
| 5671 | DEFVAR_PER_BUFFER ("buffer-file-type", ¤t_buffer->buffer_file_type, | ||
| 5672 | Qnil, | ||
| 5673 | doc: /* Non-nil if the visited file is a binary file. | ||
| 5674 | This variable is meaningful on MS-DOG and Windows NT. | ||
| 5675 | On those systems, it is automatically local in every buffer. | ||
| 5676 | On other systems, this variable is normally always nil. */); | ||
| 5677 | #endif | ||
| 5678 | |||
| 5679 | DEFVAR_PER_BUFFER ("default-directory", ¤t_buffer->directory, | ||
| 5680 | make_number (Lisp_String), | 5563 | make_number (Lisp_String), |
| 5681 | doc: /* Name of default directory of current buffer. Should end with slash. | 5564 | doc: /* Name of default directory of current buffer. Should end with slash. |
| 5682 | To interactively change the default directory, use command `cd'. */); | 5565 | To interactively change the default directory, use command `cd'. */); |
| 5683 | 5566 | ||
| 5684 | DEFVAR_PER_BUFFER ("auto-fill-function", ¤t_buffer->auto_fill_function, | 5567 | DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), |
| 5685 | Qnil, | 5568 | Qnil, |
| 5686 | doc: /* Function called (if non-nil) to perform auto-fill. | 5569 | doc: /* Function called (if non-nil) to perform auto-fill. |
| 5687 | It is called after self-inserting any character specified in | 5570 | It is called after self-inserting any character specified in |
| @@ -5689,30 +5572,30 @@ the `auto-fill-chars' table. | |||
| 5689 | NOTE: This variable is not a hook; | 5572 | NOTE: This variable is not a hook; |
| 5690 | its value may not be a list of functions. */); | 5573 | its value may not be a list of functions. */); |
| 5691 | 5574 | ||
| 5692 | DEFVAR_PER_BUFFER ("buffer-file-name", ¤t_buffer->filename, | 5575 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), |
| 5693 | make_number (Lisp_String), | 5576 | make_number (Lisp_String), |
| 5694 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); | 5577 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); |
| 5695 | 5578 | ||
| 5696 | DEFVAR_PER_BUFFER ("buffer-file-truename", ¤t_buffer->file_truename, | 5579 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), |
| 5697 | make_number (Lisp_String), | 5580 | make_number (Lisp_String), |
| 5698 | doc: /* Abbreviated truename of file visited in current buffer, or nil if none. | 5581 | doc: /* Abbreviated truename of file visited in current buffer, or nil if none. |
| 5699 | The truename of a file is calculated by `file-truename' | 5582 | The truename of a file is calculated by `file-truename' |
| 5700 | and then abbreviated with `abbreviate-file-name'. */); | 5583 | and then abbreviated with `abbreviate-file-name'. */); |
| 5701 | 5584 | ||
| 5702 | DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", | 5585 | DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", |
| 5703 | ¤t_buffer->auto_save_file_name, | 5586 | &BVAR (current_buffer, auto_save_file_name), |
| 5704 | make_number (Lisp_String), | 5587 | make_number (Lisp_String), |
| 5705 | doc: /* Name of file for auto-saving current buffer. | 5588 | doc: /* Name of file for auto-saving current buffer. |
| 5706 | If it is nil, that means don't auto-save this buffer. */); | 5589 | If it is nil, that means don't auto-save this buffer. */); |
| 5707 | 5590 | ||
| 5708 | DEFVAR_PER_BUFFER ("buffer-read-only", ¤t_buffer->read_only, Qnil, | 5591 | DEFVAR_PER_BUFFER ("buffer-read-only", &BVAR (current_buffer, read_only), Qnil, |
| 5709 | doc: /* Non-nil if this buffer is read-only. */); | 5592 | doc: /* Non-nil if this buffer is read-only. */); |
| 5710 | 5593 | ||
| 5711 | DEFVAR_PER_BUFFER ("buffer-backed-up", ¤t_buffer->backed_up, Qnil, | 5594 | DEFVAR_PER_BUFFER ("buffer-backed-up", &BVAR (current_buffer, backed_up), Qnil, |
| 5712 | doc: /* Non-nil if this buffer's file has been backed up. | 5595 | doc: /* Non-nil if this buffer's file has been backed up. |
| 5713 | Backing up is done before the first time the file is saved. */); | 5596 | Backing up is done before the first time the file is saved. */); |
| 5714 | 5597 | ||
| 5715 | DEFVAR_PER_BUFFER ("buffer-saved-size", ¤t_buffer->save_length, | 5598 | DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), |
| 5716 | make_number (LISP_INT_TAG), | 5599 | make_number (LISP_INT_TAG), |
| 5717 | doc: /* Length of current buffer when last read in, saved or auto-saved. | 5600 | doc: /* Length of current buffer when last read in, saved or auto-saved. |
| 5718 | 0 initially. | 5601 | 0 initially. |
| @@ -5722,7 +5605,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer | |||
| 5722 | if its text size shrinks. If you use `buffer-swap-text' on a buffer, | 5605 | if its text size shrinks. If you use `buffer-swap-text' on a buffer, |
| 5723 | you probably should set this to -2 in that buffer. */); | 5606 | you probably should set this to -2 in that buffer. */); |
| 5724 | 5607 | ||
| 5725 | DEFVAR_PER_BUFFER ("selective-display", ¤t_buffer->selective_display, | 5608 | DEFVAR_PER_BUFFER ("selective-display", &BVAR (current_buffer, selective_display), |
| 5726 | Qnil, | 5609 | Qnil, |
| 5727 | doc: /* Non-nil enables selective display. | 5610 | doc: /* Non-nil enables selective display. |
| 5728 | An integer N as value means display only lines | 5611 | An integer N as value means display only lines |
| @@ -5733,12 +5616,12 @@ in a file, save the ^M as a newline. */); | |||
| 5733 | 5616 | ||
| 5734 | #ifndef old | 5617 | #ifndef old |
| 5735 | DEFVAR_PER_BUFFER ("selective-display-ellipses", | 5618 | DEFVAR_PER_BUFFER ("selective-display-ellipses", |
| 5736 | ¤t_buffer->selective_display_ellipses, | 5619 | &BVAR (current_buffer, selective_display_ellipses), |
| 5737 | Qnil, | 5620 | Qnil, |
| 5738 | doc: /* Non-nil means display ... on previous line when a line is invisible. */); | 5621 | doc: /* Non-nil means display ... on previous line when a line is invisible. */); |
| 5739 | #endif | 5622 | #endif |
| 5740 | 5623 | ||
| 5741 | DEFVAR_PER_BUFFER ("overwrite-mode", ¤t_buffer->overwrite_mode, Qnil, | 5624 | DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, |
| 5742 | doc: /* Non-nil if self-insertion should replace existing text. | 5625 | doc: /* Non-nil if self-insertion should replace existing text. |
| 5743 | The value should be one of `overwrite-mode-textual', | 5626 | The value should be one of `overwrite-mode-textual', |
| 5744 | `overwrite-mode-binary', or nil. | 5627 | `overwrite-mode-binary', or nil. |
| @@ -5747,7 +5630,7 @@ inserts at the end of a line, and inserts when point is before a tab, | |||
| 5747 | until the tab is filled in. | 5630 | until the tab is filled in. |
| 5748 | If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); | 5631 | If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); |
| 5749 | 5632 | ||
| 5750 | DEFVAR_PER_BUFFER ("buffer-display-table", ¤t_buffer->display_table, | 5633 | DEFVAR_PER_BUFFER ("buffer-display-table", &BVAR (current_buffer, display_table), |
| 5751 | Qnil, | 5634 | Qnil, |
| 5752 | doc: /* Display table that controls display of the contents of current buffer. | 5635 | doc: /* Display table that controls display of the contents of current buffer. |
| 5753 | 5636 | ||
| @@ -5784,39 +5667,39 @@ In addition, a char-table has six extra slots to control the display of: | |||
| 5784 | 5667 | ||
| 5785 | See also the functions `display-table-slot' and `set-display-table-slot'. */); | 5668 | See also the functions `display-table-slot' and `set-display-table-slot'. */); |
| 5786 | 5669 | ||
| 5787 | DEFVAR_PER_BUFFER ("left-margin-width", ¤t_buffer->left_margin_cols, | 5670 | DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), |
| 5788 | Qnil, | 5671 | Qnil, |
| 5789 | doc: /* *Width of left marginal area for display of a buffer. | 5672 | doc: /* *Width of left marginal area for display of a buffer. |
| 5790 | A value of nil means no marginal area. */); | 5673 | A value of nil means no marginal area. */); |
| 5791 | 5674 | ||
| 5792 | DEFVAR_PER_BUFFER ("right-margin-width", ¤t_buffer->right_margin_cols, | 5675 | DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), |
| 5793 | Qnil, | 5676 | Qnil, |
| 5794 | doc: /* *Width of right marginal area for display of a buffer. | 5677 | doc: /* *Width of right marginal area for display of a buffer. |
| 5795 | A value of nil means no marginal area. */); | 5678 | A value of nil means no marginal area. */); |
| 5796 | 5679 | ||
| 5797 | DEFVAR_PER_BUFFER ("left-fringe-width", ¤t_buffer->left_fringe_width, | 5680 | DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), |
| 5798 | Qnil, | 5681 | Qnil, |
| 5799 | doc: /* *Width of this buffer's left fringe (in pixels). | 5682 | doc: /* *Width of this buffer's left fringe (in pixels). |
| 5800 | A value of 0 means no left fringe is shown in this buffer's window. | 5683 | A value of 0 means no left fringe is shown in this buffer's window. |
| 5801 | A value of nil means to use the left fringe width from the window's frame. */); | 5684 | A value of nil means to use the left fringe width from the window's frame. */); |
| 5802 | 5685 | ||
| 5803 | DEFVAR_PER_BUFFER ("right-fringe-width", ¤t_buffer->right_fringe_width, | 5686 | DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), |
| 5804 | Qnil, | 5687 | Qnil, |
| 5805 | doc: /* *Width of this buffer's right fringe (in pixels). | 5688 | doc: /* *Width of this buffer's right fringe (in pixels). |
| 5806 | A value of 0 means no right fringe is shown in this buffer's window. | 5689 | A value of 0 means no right fringe is shown in this buffer's window. |
| 5807 | A value of nil means to use the right fringe width from the window's frame. */); | 5690 | A value of nil means to use the right fringe width from the window's frame. */); |
| 5808 | 5691 | ||
| 5809 | DEFVAR_PER_BUFFER ("fringes-outside-margins", ¤t_buffer->fringes_outside_margins, | 5692 | DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins), |
| 5810 | Qnil, | 5693 | Qnil, |
| 5811 | doc: /* *Non-nil means to display fringes outside display margins. | 5694 | doc: /* *Non-nil means to display fringes outside display margins. |
| 5812 | A value of nil means to display fringes between margins and buffer text. */); | 5695 | A value of nil means to display fringes between margins and buffer text. */); |
| 5813 | 5696 | ||
| 5814 | DEFVAR_PER_BUFFER ("scroll-bar-width", ¤t_buffer->scroll_bar_width, | 5697 | DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), |
| 5815 | Qnil, | 5698 | Qnil, |
| 5816 | doc: /* *Width of this buffer's scroll bars in pixels. | 5699 | doc: /* *Width of this buffer's scroll bars in pixels. |
| 5817 | A value of nil means to use the scroll bar width from the window's frame. */); | 5700 | A value of nil means to use the scroll bar width from the window's frame. */); |
| 5818 | 5701 | ||
| 5819 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", ¤t_buffer->vertical_scroll_bar_type, | 5702 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), |
| 5820 | Qnil, | 5703 | Qnil, |
| 5821 | doc: /* *Position of this buffer's vertical scroll bar. | 5704 | doc: /* *Position of this buffer's vertical scroll bar. |
| 5822 | The value takes effect whenever you tell a window to display this buffer; | 5705 | The value takes effect whenever you tell a window to display this buffer; |
| @@ -5827,13 +5710,13 @@ of the window; a value of nil means don't show any vertical scroll bars. | |||
| 5827 | A value of t (the default) means do whatever the window's frame specifies. */); | 5710 | A value of t (the default) means do whatever the window's frame specifies. */); |
| 5828 | 5711 | ||
| 5829 | DEFVAR_PER_BUFFER ("indicate-empty-lines", | 5712 | DEFVAR_PER_BUFFER ("indicate-empty-lines", |
| 5830 | ¤t_buffer->indicate_empty_lines, Qnil, | 5713 | &BVAR (current_buffer, indicate_empty_lines), Qnil, |
| 5831 | doc: /* *Visually indicate empty lines after the buffer end. | 5714 | doc: /* *Visually indicate empty lines after the buffer end. |
| 5832 | If non-nil, a bitmap is displayed in the left fringe of a window on | 5715 | If non-nil, a bitmap is displayed in the left fringe of a window on |
| 5833 | window-systems. */); | 5716 | window-systems. */); |
| 5834 | 5717 | ||
| 5835 | DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", | 5718 | DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", |
| 5836 | ¤t_buffer->indicate_buffer_boundaries, Qnil, | 5719 | &BVAR (current_buffer, indicate_buffer_boundaries), Qnil, |
| 5837 | doc: /* *Visually indicate buffer boundaries and scrolling. | 5720 | doc: /* *Visually indicate buffer boundaries and scrolling. |
| 5838 | If non-nil, the first and last line of the buffer are marked in the fringe | 5721 | If non-nil, the first and last line of the buffer are marked in the fringe |
| 5839 | of a window on window-systems with angle bitmaps, or if the window can be | 5722 | of a window on window-systems with angle bitmaps, or if the window can be |
| @@ -5858,7 +5741,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left | |||
| 5858 | fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); | 5741 | fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); |
| 5859 | 5742 | ||
| 5860 | DEFVAR_PER_BUFFER ("fringe-indicator-alist", | 5743 | DEFVAR_PER_BUFFER ("fringe-indicator-alist", |
| 5861 | ¤t_buffer->fringe_indicator_alist, Qnil, | 5744 | &BVAR (current_buffer, fringe_indicator_alist), Qnil, |
| 5862 | doc: /* *Mapping from logical to physical fringe indicator bitmaps. | 5745 | doc: /* *Mapping from logical to physical fringe indicator bitmaps. |
| 5863 | The value is an alist where each element (INDICATOR . BITMAPS) | 5746 | The value is an alist where each element (INDICATOR . BITMAPS) |
| 5864 | specifies the fringe bitmaps used to display a specific logical | 5747 | specifies the fringe bitmaps used to display a specific logical |
| @@ -5877,7 +5760,7 @@ last (only) line has no final newline. BITMAPS may also be a single | |||
| 5877 | symbol which is used in both left and right fringes. */); | 5760 | symbol which is used in both left and right fringes. */); |
| 5878 | 5761 | ||
| 5879 | DEFVAR_PER_BUFFER ("fringe-cursor-alist", | 5762 | DEFVAR_PER_BUFFER ("fringe-cursor-alist", |
| 5880 | ¤t_buffer->fringe_cursor_alist, Qnil, | 5763 | &BVAR (current_buffer, fringe_cursor_alist), Qnil, |
| 5881 | doc: /* *Mapping from logical to physical fringe cursor bitmaps. | 5764 | doc: /* *Mapping from logical to physical fringe cursor bitmaps. |
| 5882 | The value is an alist where each element (CURSOR . BITMAP) | 5765 | The value is an alist where each element (CURSOR . BITMAP) |
| 5883 | specifies the fringe bitmaps used to display a specific logical | 5766 | specifies the fringe bitmaps used to display a specific logical |
| @@ -5892,7 +5775,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical | |||
| 5892 | cursor type. */); | 5775 | cursor type. */); |
| 5893 | 5776 | ||
| 5894 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", | 5777 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", |
| 5895 | ¤t_buffer->scroll_up_aggressively, Qnil, | 5778 | &BVAR (current_buffer, scroll_up_aggressively), Qnil, |
| 5896 | doc: /* How far to scroll windows upward. | 5779 | doc: /* How far to scroll windows upward. |
| 5897 | If you move point off the bottom, the window scrolls automatically. | 5780 | If you move point off the bottom, the window scrolls automatically. |
| 5898 | This variable controls how far it scrolls. The value nil, the default, | 5781 | This variable controls how far it scrolls. The value nil, the default, |
| @@ -5905,7 +5788,7 @@ window scrolls by a full window height. Meaningful values are | |||
| 5905 | between 0.0 and 1.0, inclusive. */); | 5788 | between 0.0 and 1.0, inclusive. */); |
| 5906 | 5789 | ||
| 5907 | DEFVAR_PER_BUFFER ("scroll-down-aggressively", | 5790 | DEFVAR_PER_BUFFER ("scroll-down-aggressively", |
| 5908 | ¤t_buffer->scroll_down_aggressively, Qnil, | 5791 | &BVAR (current_buffer, scroll_down_aggressively), Qnil, |
| 5909 | doc: /* How far to scroll windows downward. | 5792 | doc: /* How far to scroll windows downward. |
| 5910 | If you move point off the top, the window scrolls automatically. | 5793 | If you move point off the top, the window scrolls automatically. |
| 5911 | This variable controls how far it scrolls. The value nil, the default, | 5794 | This variable controls how far it scrolls. The value nil, the default, |
| @@ -5960,7 +5843,7 @@ from happening repeatedly and making Emacs nonfunctional. */); | |||
| 5960 | The functions are run using the `run-hooks' function. */); | 5843 | The functions are run using the `run-hooks' function. */); |
| 5961 | Vfirst_change_hook = Qnil; | 5844 | Vfirst_change_hook = Qnil; |
| 5962 | 5845 | ||
| 5963 | DEFVAR_PER_BUFFER ("buffer-undo-list", ¤t_buffer->undo_list, Qnil, | 5846 | DEFVAR_PER_BUFFER ("buffer-undo-list", &BVAR (current_buffer, undo_list), Qnil, |
| 5964 | doc: /* List of undo entries in current buffer. | 5847 | doc: /* List of undo entries in current buffer. |
| 5965 | Recent changes come first; older changes follow newer. | 5848 | Recent changes come first; older changes follow newer. |
| 5966 | 5849 | ||
| @@ -6001,10 +5884,10 @@ the changes between two undo boundaries as a single step to be undone. | |||
| 6001 | 5884 | ||
| 6002 | If the value of the variable is t, undo information is not recorded. */); | 5885 | If the value of the variable is t, undo information is not recorded. */); |
| 6003 | 5886 | ||
| 6004 | DEFVAR_PER_BUFFER ("mark-active", ¤t_buffer->mark_active, Qnil, | 5887 | DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil, |
| 6005 | doc: /* Non-nil means the mark and region are currently active in this buffer. */); | 5888 | doc: /* Non-nil means the mark and region are currently active in this buffer. */); |
| 6006 | 5889 | ||
| 6007 | DEFVAR_PER_BUFFER ("cache-long-line-scans", ¤t_buffer->cache_long_line_scans, Qnil, | 5890 | DEFVAR_PER_BUFFER ("cache-long-line-scans", &BVAR (current_buffer, cache_long_line_scans), Qnil, |
| 6008 | doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. | 5891 | doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. |
| 6009 | 5892 | ||
| 6010 | Normally, the line-motion functions work by scanning the buffer for | 5893 | Normally, the line-motion functions work by scanning the buffer for |
| @@ -6032,23 +5915,23 @@ maintained internally by the Emacs primitives. Enabling or disabling | |||
| 6032 | the cache should not affect the behavior of any of the motion | 5915 | the cache should not affect the behavior of any of the motion |
| 6033 | functions; it should only affect their performance. */); | 5916 | functions; it should only affect their performance. */); |
| 6034 | 5917 | ||
| 6035 | DEFVAR_PER_BUFFER ("point-before-scroll", ¤t_buffer->point_before_scroll, Qnil, | 5918 | DEFVAR_PER_BUFFER ("point-before-scroll", &BVAR (current_buffer, point_before_scroll), Qnil, |
| 6036 | doc: /* Value of point before the last series of scroll operations, or nil. */); | 5919 | doc: /* Value of point before the last series of scroll operations, or nil. */); |
| 6037 | 5920 | ||
| 6038 | DEFVAR_PER_BUFFER ("buffer-file-format", ¤t_buffer->file_format, Qnil, | 5921 | DEFVAR_PER_BUFFER ("buffer-file-format", &BVAR (current_buffer, file_format), Qnil, |
| 6039 | doc: /* List of formats to use when saving this buffer. | 5922 | doc: /* List of formats to use when saving this buffer. |
| 6040 | Formats are defined by `format-alist'. This variable is | 5923 | Formats are defined by `format-alist'. This variable is |
| 6041 | set when a file is visited. */); | 5924 | set when a file is visited. */); |
| 6042 | 5925 | ||
| 6043 | DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", | 5926 | DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", |
| 6044 | ¤t_buffer->auto_save_file_format, Qnil, | 5927 | &BVAR (current_buffer, auto_save_file_format), Qnil, |
| 6045 | doc: /* *Format in which to write auto-save files. | 5928 | doc: /* *Format in which to write auto-save files. |
| 6046 | Should be a list of symbols naming formats that are defined in `format-alist'. | 5929 | Should be a list of symbols naming formats that are defined in `format-alist'. |
| 6047 | If it is t, which is the default, auto-save files are written in the | 5930 | If it is t, which is the default, auto-save files are written in the |
| 6048 | same format as a regular save would use. */); | 5931 | same format as a regular save would use. */); |
| 6049 | 5932 | ||
| 6050 | DEFVAR_PER_BUFFER ("buffer-invisibility-spec", | 5933 | DEFVAR_PER_BUFFER ("buffer-invisibility-spec", |
| 6051 | ¤t_buffer->invisibility_spec, Qnil, | 5934 | &BVAR (current_buffer, invisibility_spec), Qnil, |
| 6052 | doc: /* Invisibility spec of this buffer. | 5935 | doc: /* Invisibility spec of this buffer. |
| 6053 | The default is t, which means that text is invisible | 5936 | The default is t, which means that text is invisible |
| 6054 | if it has a non-nil `invisible' property. | 5937 | if it has a non-nil `invisible' property. |
| @@ -6059,12 +5942,12 @@ then characters with property value PROP are invisible, | |||
| 6059 | and they have an ellipsis as well if ELLIPSIS is non-nil. */); | 5942 | and they have an ellipsis as well if ELLIPSIS is non-nil. */); |
| 6060 | 5943 | ||
| 6061 | DEFVAR_PER_BUFFER ("buffer-display-count", | 5944 | DEFVAR_PER_BUFFER ("buffer-display-count", |
| 6062 | ¤t_buffer->display_count, Qnil, | 5945 | &BVAR (current_buffer, display_count), Qnil, |
| 6063 | doc: /* A number incremented each time this buffer is displayed in a window. | 5946 | doc: /* A number incremented each time this buffer is displayed in a window. |
| 6064 | The function `set-window-buffer' increments it. */); | 5947 | The function `set-window-buffer' increments it. */); |
| 6065 | 5948 | ||
| 6066 | DEFVAR_PER_BUFFER ("buffer-display-time", | 5949 | DEFVAR_PER_BUFFER ("buffer-display-time", |
| 6067 | ¤t_buffer->display_time, Qnil, | 5950 | &BVAR (current_buffer, display_time), Qnil, |
| 6068 | doc: /* Time stamp updated each time this buffer is displayed in a window. | 5951 | doc: /* Time stamp updated each time this buffer is displayed in a window. |
| 6069 | The function `set-window-buffer' updates this variable | 5952 | The function `set-window-buffer' updates this variable |
| 6070 | to the value obtained by calling `current-time'. | 5953 | to the value obtained by calling `current-time'. |
| @@ -6099,7 +5982,7 @@ and disregard a `read-only' text property if the property value | |||
| 6099 | is a member of the list. */); | 5982 | is a member of the list. */); |
| 6100 | Vinhibit_read_only = Qnil; | 5983 | Vinhibit_read_only = Qnil; |
| 6101 | 5984 | ||
| 6102 | DEFVAR_PER_BUFFER ("cursor-type", ¤t_buffer->cursor_type, Qnil, | 5985 | DEFVAR_PER_BUFFER ("cursor-type", &BVAR (current_buffer, cursor_type), Qnil, |
| 6103 | doc: /* Cursor to use when this buffer is in the selected window. | 5986 | doc: /* Cursor to use when this buffer is in the selected window. |
| 6104 | Values are interpreted as follows: | 5987 | Values are interpreted as follows: |
| 6105 | 5988 | ||
| @@ -6118,7 +6001,7 @@ cursor's appearance is instead controlled by the variable | |||
| 6118 | `cursor-in-non-selected-windows'. */); | 6001 | `cursor-in-non-selected-windows'. */); |
| 6119 | 6002 | ||
| 6120 | DEFVAR_PER_BUFFER ("line-spacing", | 6003 | DEFVAR_PER_BUFFER ("line-spacing", |
| 6121 | ¤t_buffer->extra_line_spacing, Qnil, | 6004 | &BVAR (current_buffer, extra_line_spacing), Qnil, |
| 6122 | doc: /* Additional space to put between lines when displaying a buffer. | 6005 | doc: /* Additional space to put between lines when displaying a buffer. |
| 6123 | The space is measured in pixels, and put below lines on graphic displays, | 6006 | The space is measured in pixels, and put below lines on graphic displays, |
| 6124 | see `display-graphic-p'. | 6007 | see `display-graphic-p'. |
| @@ -6126,7 +6009,7 @@ If value is a floating point number, it specifies the spacing relative | |||
| 6126 | to the default frame line height. A value of nil means add no extra space. */); | 6009 | to the default frame line height. A value of nil means add no extra space. */); |
| 6127 | 6010 | ||
| 6128 | DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", | 6011 | DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", |
| 6129 | ¤t_buffer->cursor_in_non_selected_windows, Qnil, | 6012 | &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil, |
| 6130 | doc: /* *Non-nil means show a cursor in non-selected windows. | 6013 | doc: /* *Non-nil means show a cursor in non-selected windows. |
| 6131 | If nil, only shows a cursor in the selected window. | 6014 | If nil, only shows a cursor in the selected window. |
| 6132 | If t, displays a cursor related to the usual cursor type | 6015 | If t, displays a cursor related to the usual cursor type |
| @@ -6147,6 +6030,15 @@ The function `kill-all-local-variables' runs this before doing anything else. * | |||
| 6147 | Qchange_major_mode_hook = intern_c_string ("change-major-mode-hook"); | 6030 | Qchange_major_mode_hook = intern_c_string ("change-major-mode-hook"); |
| 6148 | staticpro (&Qchange_major_mode_hook); | 6031 | staticpro (&Qchange_major_mode_hook); |
| 6149 | 6032 | ||
| 6033 | DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook, | ||
| 6034 | doc: /* Hook run when the buffer list changes. | ||
| 6035 | Functions running this hook are `get-buffer-create', | ||
| 6036 | `make-indirect-buffer', `rename-buffer', `kill-buffer', | ||
| 6037 | `record-buffer' and `unrecord-buffer'. */); | ||
| 6038 | Vbuffer_list_update_hook = Qnil; | ||
| 6039 | Qbuffer_list_update_hook = intern_c_string ("buffer-list-update-hook"); | ||
| 6040 | staticpro (&Qbuffer_list_update_hook); | ||
| 6041 | |||
| 6150 | defsubr (&Sbuffer_live_p); | 6042 | defsubr (&Sbuffer_live_p); |
| 6151 | defsubr (&Sbuffer_list); | 6043 | defsubr (&Sbuffer_list); |
| 6152 | defsubr (&Sget_buffer); | 6044 | defsubr (&Sget_buffer); |
| @@ -6168,12 +6060,12 @@ The function `kill-all-local-variables' runs this before doing anything else. * | |||
| 6168 | defsubr (&Sother_buffer); | 6060 | defsubr (&Sother_buffer); |
| 6169 | defsubr (&Sbuffer_enable_undo); | 6061 | defsubr (&Sbuffer_enable_undo); |
| 6170 | defsubr (&Skill_buffer); | 6062 | defsubr (&Skill_buffer); |
| 6063 | defsubr (&Srecord_buffer); | ||
| 6064 | defsubr (&Sunrecord_buffer); | ||
| 6171 | defsubr (&Sset_buffer_major_mode); | 6065 | defsubr (&Sset_buffer_major_mode); |
| 6172 | defsubr (&Sswitch_to_buffer); | ||
| 6173 | defsubr (&Scurrent_buffer); | 6066 | defsubr (&Scurrent_buffer); |
| 6174 | defsubr (&Sset_buffer); | 6067 | defsubr (&Sset_buffer); |
| 6175 | defsubr (&Sbarf_if_buffer_read_only); | 6068 | defsubr (&Sbarf_if_buffer_read_only); |
| 6176 | defsubr (&Sbury_buffer); | ||
| 6177 | defsubr (&Serase_buffer); | 6069 | defsubr (&Serase_buffer); |
| 6178 | defsubr (&Sbuffer_swap_text); | 6070 | defsubr (&Sbuffer_swap_text); |
| 6179 | defsubr (&Sset_buffer_multibyte); | 6071 | defsubr (&Sset_buffer_multibyte); |