diff options
| author | Ken Raeburn | 2015-11-01 01:42:21 -0400 |
|---|---|---|
| committer | Ken Raeburn | 2015-11-01 01:42:21 -0400 |
| commit | 39372e1a1032521be74575bb06f95a3898fbae30 (patch) | |
| tree | 754bd242a23d2358ea116126fcb0a629947bd9ec /src/buffer.h | |
| parent | 6a3121904d76e3b2f63007341d48c5c1af55de80 (diff) | |
| parent | e11aaee266da52937a3a031cb108fe13f68958c3 (diff) | |
| download | emacs-39372e1a1032521be74575bb06f95a3898fbae30.tar.gz emacs-39372e1a1032521be74575bb06f95a3898fbae30.zip | |
merge from trunk
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 353 |
1 files changed, 187 insertions, 166 deletions
diff --git a/src/buffer.h b/src/buffer.h index a2645981e01..b36f9c8f895 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Header file for the buffer manipulation primitives. | 1 | /* Header file for the buffer manipulation primitives. |
| 2 | 2 | ||
| 3 | Copyright (C) 1985-1986, 1993-1995, 1997-2013 Free Software Foundation, | 3 | Copyright (C) 1985-1986, 1993-1995, 1997-2015 Free Software Foundation, |
| 4 | Inc. | 4 | Inc. |
| 5 | 5 | ||
| 6 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| @@ -18,13 +18,16 @@ GNU General Public License for more details. | |||
| 18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 20 | 20 | ||
| 21 | #include <sys/types.h> /* for off_t, time_t */ | 21 | #ifndef EMACS_BUFFER_H |
| 22 | #include "systime.h" /* for EMACS_TIME */ | 22 | #define EMACS_BUFFER_H |
| 23 | |||
| 24 | #include <sys/types.h> | ||
| 25 | #include <time.h> | ||
| 26 | |||
| 27 | #include "character.h" | ||
| 28 | #include "lisp.h" | ||
| 23 | 29 | ||
| 24 | INLINE_HEADER_BEGIN | 30 | INLINE_HEADER_BEGIN |
| 25 | #ifndef BUFFER_INLINE | ||
| 26 | # define BUFFER_INLINE INLINE | ||
| 27 | #endif | ||
| 28 | 31 | ||
| 29 | /* Accessing the parameters of the current buffer. */ | 32 | /* Accessing the parameters of the current buffer. */ |
| 30 | 33 | ||
| @@ -229,7 +232,7 @@ INLINE_HEADER_BEGIN | |||
| 229 | BUF_BEG_UNCHANGED (buf) = (start) - BUF_BEG (buf); \ | 232 | BUF_BEG_UNCHANGED (buf) = (start) - BUF_BEG (buf); \ |
| 230 | } \ | 233 | } \ |
| 231 | } \ | 234 | } \ |
| 232 | while (0) | 235 | while (false) |
| 233 | 236 | ||
| 234 | 237 | ||
| 235 | /* Macros to set PT in the current buffer, or another buffer. */ | 238 | /* Macros to set PT in the current buffer, or another buffer. */ |
| @@ -249,6 +252,7 @@ extern void temp_set_point (struct buffer *, ptrdiff_t); | |||
| 249 | extern void set_point_both (ptrdiff_t, ptrdiff_t); | 252 | extern void set_point_both (ptrdiff_t, ptrdiff_t); |
| 250 | extern void temp_set_point_both (struct buffer *, | 253 | extern void temp_set_point_both (struct buffer *, |
| 251 | ptrdiff_t, ptrdiff_t); | 254 | ptrdiff_t, ptrdiff_t); |
| 255 | extern void set_point_from_marker (Lisp_Object); | ||
| 252 | extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); | 256 | extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); |
| 253 | 257 | ||
| 254 | 258 | ||
| @@ -304,7 +308,7 @@ extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); | |||
| 304 | else \ | 308 | else \ |
| 305 | wrong_type_argument (Qinteger_or_marker_p, __pos); \ | 309 | wrong_type_argument (Qinteger_or_marker_p, __pos); \ |
| 306 | } \ | 310 | } \ |
| 307 | while (0) | 311 | while (false) |
| 308 | 312 | ||
| 309 | /* Maximum number of bytes in a buffer. | 313 | /* Maximum number of bytes in a buffer. |
| 310 | A buffer cannot contain more bytes than a 1-origin fixnum can represent, | 314 | A buffer cannot contain more bytes than a 1-origin fixnum can represent, |
| @@ -474,15 +478,18 @@ struct buffer_text | |||
| 474 | to move a marker within a buffer. */ | 478 | to move a marker within a buffer. */ |
| 475 | struct Lisp_Marker *markers; | 479 | struct Lisp_Marker *markers; |
| 476 | 480 | ||
| 477 | /* Usually 0. Temporarily set to 1 in decode_coding_gap to | 481 | /* Usually false. Temporarily true in decode_coding_gap to |
| 478 | prevent Fgarbage_collect from shrinking the gap and losing | 482 | prevent Fgarbage_collect from shrinking the gap and losing |
| 479 | not-yet-decoded bytes. */ | 483 | not-yet-decoded bytes. */ |
| 480 | bool inhibit_shrinking; | 484 | bool_bf inhibit_shrinking : 1; |
| 485 | |||
| 486 | /* True if it needs to be redisplayed. */ | ||
| 487 | bool_bf redisplay : 1; | ||
| 481 | }; | 488 | }; |
| 482 | 489 | ||
| 483 | /* Most code should use this macro to access Lisp fields in struct buffer. */ | 490 | /* Most code should use this macro to access Lisp fields in struct buffer. */ |
| 484 | 491 | ||
| 485 | #define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field)) | 492 | #define BVAR(buf, field) ((buf)->field ## _) |
| 486 | 493 | ||
| 487 | /* This is the structure that the buffer Lisp object points to. */ | 494 | /* This is the structure that the buffer Lisp object points to. */ |
| 488 | 495 | ||
| @@ -491,17 +498,17 @@ struct buffer | |||
| 491 | struct vectorlike_header header; | 498 | struct vectorlike_header header; |
| 492 | 499 | ||
| 493 | /* The name of this buffer. */ | 500 | /* The name of this buffer. */ |
| 494 | Lisp_Object INTERNAL_FIELD (name); | 501 | Lisp_Object name_; |
| 495 | 502 | ||
| 496 | /* The name of the file visited in this buffer, or nil. */ | 503 | /* The name of the file visited in this buffer, or nil. */ |
| 497 | Lisp_Object INTERNAL_FIELD (filename); | 504 | Lisp_Object filename_; |
| 498 | 505 | ||
| 499 | /* Directory for expanding relative file names. */ | 506 | /* Directory for expanding relative file names. */ |
| 500 | Lisp_Object INTERNAL_FIELD (directory); | 507 | Lisp_Object directory_; |
| 501 | 508 | ||
| 502 | /* True if this buffer has been backed up (if you write to the visited | 509 | /* True if this buffer has been backed up (if you write to the visited |
| 503 | file and it hasn't been backed up, then a backup will be made). */ | 510 | file and it hasn't been backed up, then a backup will be made). */ |
| 504 | Lisp_Object INTERNAL_FIELD (backed_up); | 511 | Lisp_Object backed_up_; |
| 505 | 512 | ||
| 506 | /* Length of file when last read or saved. | 513 | /* Length of file when last read or saved. |
| 507 | -1 means auto saving turned off because buffer shrank a lot. | 514 | -1 means auto saving turned off because buffer shrank a lot. |
| @@ -509,132 +516,132 @@ struct buffer | |||
| 509 | (That value is used with buffer-swap-text.) | 516 | (That value is used with buffer-swap-text.) |
| 510 | This is not in the struct buffer_text | 517 | This is not in the struct buffer_text |
| 511 | because it's not used in indirect buffers at all. */ | 518 | because it's not used in indirect buffers at all. */ |
| 512 | Lisp_Object INTERNAL_FIELD (save_length); | 519 | Lisp_Object save_length_; |
| 513 | 520 | ||
| 514 | /* File name used for auto-saving this buffer. | 521 | /* File name used for auto-saving this buffer. |
| 515 | This is not in the struct buffer_text | 522 | This is not in the struct buffer_text |
| 516 | because it's not used in indirect buffers at all. */ | 523 | because it's not used in indirect buffers at all. */ |
| 517 | Lisp_Object INTERNAL_FIELD (auto_save_file_name); | 524 | Lisp_Object auto_save_file_name_; |
| 518 | 525 | ||
| 519 | /* Non-nil if buffer read-only. */ | 526 | /* Non-nil if buffer read-only. */ |
| 520 | Lisp_Object INTERNAL_FIELD (read_only); | 527 | Lisp_Object read_only_; |
| 521 | 528 | ||
| 522 | /* "The mark". This is a marker which may | 529 | /* "The mark". This is a marker which may |
| 523 | point into this buffer or may point nowhere. */ | 530 | point into this buffer or may point nowhere. */ |
| 524 | Lisp_Object INTERNAL_FIELD (mark); | 531 | Lisp_Object mark_; |
| 525 | 532 | ||
| 526 | /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all | 533 | /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all |
| 527 | per-buffer variables of this buffer. For locally unbound | 534 | per-buffer variables of this buffer. For locally unbound |
| 528 | symbols, just the symbol appears as the element. */ | 535 | symbols, just the symbol appears as the element. */ |
| 529 | Lisp_Object INTERNAL_FIELD (local_var_alist); | 536 | Lisp_Object local_var_alist_; |
| 530 | 537 | ||
| 531 | /* Symbol naming major mode (e.g., lisp-mode). */ | 538 | /* Symbol naming major mode (e.g., lisp-mode). */ |
| 532 | Lisp_Object INTERNAL_FIELD (major_mode); | 539 | Lisp_Object major_mode_; |
| 533 | 540 | ||
| 534 | /* Pretty name of major mode (e.g., "Lisp"). */ | 541 | /* Pretty name of major mode (e.g., "Lisp"). */ |
| 535 | Lisp_Object INTERNAL_FIELD (mode_name); | 542 | Lisp_Object mode_name_; |
| 536 | 543 | ||
| 537 | /* Mode line element that controls format of mode line. */ | 544 | /* Mode line element that controls format of mode line. */ |
| 538 | Lisp_Object INTERNAL_FIELD (mode_line_format); | 545 | Lisp_Object mode_line_format_; |
| 539 | 546 | ||
| 540 | /* Analogous to mode_line_format for the line displayed at the top | 547 | /* Analogous to mode_line_format for the line displayed at the top |
| 541 | of windows. Nil means don't display that line. */ | 548 | of windows. Nil means don't display that line. */ |
| 542 | Lisp_Object INTERNAL_FIELD (header_line_format); | 549 | Lisp_Object header_line_format_; |
| 543 | 550 | ||
| 544 | /* Keys that are bound local to this buffer. */ | 551 | /* Keys that are bound local to this buffer. */ |
| 545 | Lisp_Object INTERNAL_FIELD (keymap); | 552 | Lisp_Object keymap_; |
| 546 | 553 | ||
| 547 | /* This buffer's local abbrev table. */ | 554 | /* This buffer's local abbrev table. */ |
| 548 | Lisp_Object INTERNAL_FIELD (abbrev_table); | 555 | Lisp_Object abbrev_table_; |
| 549 | 556 | ||
| 550 | /* This buffer's syntax table. */ | 557 | /* This buffer's syntax table. */ |
| 551 | Lisp_Object INTERNAL_FIELD (syntax_table); | 558 | Lisp_Object syntax_table_; |
| 552 | 559 | ||
| 553 | /* This buffer's category table. */ | 560 | /* This buffer's category table. */ |
| 554 | Lisp_Object INTERNAL_FIELD (category_table); | 561 | Lisp_Object category_table_; |
| 555 | 562 | ||
| 556 | /* Values of several buffer-local variables. */ | 563 | /* Values of several buffer-local variables. */ |
| 557 | /* tab-width is buffer-local so that redisplay can find it | 564 | /* tab-width is buffer-local so that redisplay can find it |
| 558 | in buffers that are not current. */ | 565 | in buffers that are not current. */ |
| 559 | Lisp_Object INTERNAL_FIELD (case_fold_search); | 566 | Lisp_Object case_fold_search_; |
| 560 | Lisp_Object INTERNAL_FIELD (tab_width); | 567 | Lisp_Object tab_width_; |
| 561 | Lisp_Object INTERNAL_FIELD (fill_column); | 568 | Lisp_Object fill_column_; |
| 562 | Lisp_Object INTERNAL_FIELD (left_margin); | 569 | Lisp_Object left_margin_; |
| 563 | 570 | ||
| 564 | /* Function to call when insert space past fill column. */ | 571 | /* Function to call when insert space past fill column. */ |
| 565 | Lisp_Object INTERNAL_FIELD (auto_fill_function); | 572 | Lisp_Object auto_fill_function_; |
| 566 | 573 | ||
| 567 | /* Case table for case-conversion in this buffer. | 574 | /* Case table for case-conversion in this buffer. |
| 568 | This char-table maps each char into its lower-case version. */ | 575 | This char-table maps each char into its lower-case version. */ |
| 569 | Lisp_Object INTERNAL_FIELD (downcase_table); | 576 | Lisp_Object downcase_table_; |
| 570 | 577 | ||
| 571 | /* Char-table mapping each char to its upper-case version. */ | 578 | /* Char-table mapping each char to its upper-case version. */ |
| 572 | Lisp_Object INTERNAL_FIELD (upcase_table); | 579 | Lisp_Object upcase_table_; |
| 573 | 580 | ||
| 574 | /* Char-table for conversion for case-folding search. */ | 581 | /* Char-table for conversion for case-folding search. */ |
| 575 | Lisp_Object INTERNAL_FIELD (case_canon_table); | 582 | Lisp_Object case_canon_table_; |
| 576 | 583 | ||
| 577 | /* Char-table of equivalences for case-folding search. */ | 584 | /* Char-table of equivalences for case-folding search. */ |
| 578 | Lisp_Object INTERNAL_FIELD (case_eqv_table); | 585 | Lisp_Object case_eqv_table_; |
| 579 | 586 | ||
| 580 | /* Non-nil means do not display continuation lines. */ | 587 | /* Non-nil means do not display continuation lines. */ |
| 581 | Lisp_Object INTERNAL_FIELD (truncate_lines); | 588 | Lisp_Object truncate_lines_; |
| 582 | 589 | ||
| 583 | /* Non-nil means to use word wrapping when displaying continuation lines. */ | 590 | /* Non-nil means to use word wrapping when displaying continuation lines. */ |
| 584 | Lisp_Object INTERNAL_FIELD (word_wrap); | 591 | Lisp_Object word_wrap_; |
| 585 | 592 | ||
| 586 | /* Non-nil means display ctl chars with uparrow. */ | 593 | /* Non-nil means display ctl chars with uparrow. */ |
| 587 | Lisp_Object INTERNAL_FIELD (ctl_arrow); | 594 | Lisp_Object ctl_arrow_; |
| 588 | 595 | ||
| 589 | /* Non-nil means reorder bidirectional text for display in the | 596 | /* Non-nil means reorder bidirectional text for display in the |
| 590 | visual order. */ | 597 | visual order. */ |
| 591 | Lisp_Object INTERNAL_FIELD (bidi_display_reordering); | 598 | Lisp_Object bidi_display_reordering_; |
| 592 | 599 | ||
| 593 | /* If non-nil, specifies which direction of text to force in all the | 600 | /* If non-nil, specifies which direction of text to force in all the |
| 594 | paragraphs of the buffer. Nil means determine paragraph | 601 | paragraphs of the buffer. Nil means determine paragraph |
| 595 | direction dynamically for each paragraph. */ | 602 | direction dynamically for each paragraph. */ |
| 596 | Lisp_Object INTERNAL_FIELD (bidi_paragraph_direction); | 603 | Lisp_Object bidi_paragraph_direction_; |
| 597 | 604 | ||
| 598 | /* Non-nil means do selective display; | 605 | /* Non-nil means do selective display; |
| 599 | see doc string in syms_of_buffer (buffer.c) for details. */ | 606 | see doc string in syms_of_buffer (buffer.c) for details. */ |
| 600 | Lisp_Object INTERNAL_FIELD (selective_display); | 607 | Lisp_Object selective_display_; |
| 601 | 608 | ||
| 602 | /* Non-nil means show ... at end of line followed by invisible lines. */ | 609 | /* Non-nil means show ... at end of line followed by invisible lines. */ |
| 603 | Lisp_Object INTERNAL_FIELD (selective_display_ellipses); | 610 | Lisp_Object selective_display_ellipses_; |
| 604 | 611 | ||
| 605 | /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ | 612 | /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ |
| 606 | Lisp_Object INTERNAL_FIELD (minor_modes); | 613 | Lisp_Object minor_modes_; |
| 607 | 614 | ||
| 608 | /* t if "self-insertion" should overwrite; `binary' if it should also | 615 | /* t if "self-insertion" should overwrite; `binary' if it should also |
| 609 | overwrite newlines and tabs - for editing executables and the like. */ | 616 | overwrite newlines and tabs - for editing executables and the like. */ |
| 610 | Lisp_Object INTERNAL_FIELD (overwrite_mode); | 617 | Lisp_Object overwrite_mode_; |
| 611 | 618 | ||
| 612 | /* Non-nil means abbrev mode is on. Expand abbrevs automatically. */ | 619 | /* Non-nil means abbrev mode is on. Expand abbrevs automatically. */ |
| 613 | Lisp_Object INTERNAL_FIELD (abbrev_mode); | 620 | Lisp_Object abbrev_mode_; |
| 614 | 621 | ||
| 615 | /* Display table to use for text in this buffer. */ | 622 | /* Display table to use for text in this buffer. */ |
| 616 | Lisp_Object INTERNAL_FIELD (display_table); | 623 | Lisp_Object display_table_; |
| 617 | 624 | ||
| 618 | /* t means the mark and region are currently active. */ | 625 | /* t means the mark and region are currently active. */ |
| 619 | Lisp_Object INTERNAL_FIELD (mark_active); | 626 | Lisp_Object mark_active_; |
| 620 | 627 | ||
| 621 | /* Non-nil means the buffer contents are regarded as multi-byte | 628 | /* Non-nil means the buffer contents are regarded as multi-byte |
| 622 | form of characters, not a binary code. */ | 629 | form of characters, not a binary code. */ |
| 623 | Lisp_Object INTERNAL_FIELD (enable_multibyte_characters); | 630 | Lisp_Object enable_multibyte_characters_; |
| 624 | 631 | ||
| 625 | /* Coding system to be used for encoding the buffer contents on | 632 | /* Coding system to be used for encoding the buffer contents on |
| 626 | saving. */ | 633 | saving. */ |
| 627 | Lisp_Object INTERNAL_FIELD (buffer_file_coding_system); | 634 | Lisp_Object buffer_file_coding_system_; |
| 628 | 635 | ||
| 629 | /* List of symbols naming the file format used for visited file. */ | 636 | /* List of symbols naming the file format used for visited file. */ |
| 630 | Lisp_Object INTERNAL_FIELD (file_format); | 637 | Lisp_Object file_format_; |
| 631 | 638 | ||
| 632 | /* List of symbols naming the file format used for auto-save file. */ | 639 | /* List of symbols naming the file format used for auto-save file. */ |
| 633 | Lisp_Object INTERNAL_FIELD (auto_save_file_format); | 640 | Lisp_Object auto_save_file_format_; |
| 634 | 641 | ||
| 635 | /* True if the newline position cache, width run cache and BIDI paragraph | 642 | /* True if the newline position cache, width run cache and BIDI paragraph |
| 636 | cache are enabled. See search.c, indent.c and bidi.c for details. */ | 643 | cache are enabled. See search.c, indent.c and bidi.c for details. */ |
| 637 | Lisp_Object INTERNAL_FIELD (cache_long_scans); | 644 | Lisp_Object cache_long_scans_; |
| 638 | 645 | ||
| 639 | /* If the width run cache is enabled, this table contains the | 646 | /* If the width run cache is enabled, this table contains the |
| 640 | character widths width_run_cache (see above) assumes. When we | 647 | character widths width_run_cache (see above) assumes. When we |
| @@ -642,105 +649,107 @@ struct buffer | |||
| 642 | current display table to see whether the display table has | 649 | current display table to see whether the display table has |
| 643 | affected the widths of any characters. If it has, we | 650 | affected the widths of any characters. If it has, we |
| 644 | invalidate the width run cache, and re-initialize width_table. */ | 651 | invalidate the width run cache, and re-initialize width_table. */ |
| 645 | Lisp_Object INTERNAL_FIELD (width_table); | 652 | Lisp_Object width_table_; |
| 646 | 653 | ||
| 647 | /* In an indirect buffer, or a buffer that is the base of an | 654 | /* In an indirect buffer, or a buffer that is the base of an |
| 648 | indirect buffer, this holds a marker that records | 655 | indirect buffer, this holds a marker that records |
| 649 | PT for this buffer when the buffer is not current. */ | 656 | PT for this buffer when the buffer is not current. */ |
| 650 | Lisp_Object INTERNAL_FIELD (pt_marker); | 657 | Lisp_Object pt_marker_; |
| 651 | 658 | ||
| 652 | /* In an indirect buffer, or a buffer that is the base of an | 659 | /* In an indirect buffer, or a buffer that is the base of an |
| 653 | indirect buffer, this holds a marker that records | 660 | indirect buffer, this holds a marker that records |
| 654 | BEGV for this buffer when the buffer is not current. */ | 661 | BEGV for this buffer when the buffer is not current. */ |
| 655 | Lisp_Object INTERNAL_FIELD (begv_marker); | 662 | Lisp_Object begv_marker_; |
| 656 | 663 | ||
| 657 | /* In an indirect buffer, or a buffer that is the base of an | 664 | /* In an indirect buffer, or a buffer that is the base of an |
| 658 | indirect buffer, this holds a marker that records | 665 | indirect buffer, this holds a marker that records |
| 659 | ZV for this buffer when the buffer is not current. */ | 666 | ZV for this buffer when the buffer is not current. */ |
| 660 | Lisp_Object INTERNAL_FIELD (zv_marker); | 667 | Lisp_Object zv_marker_; |
| 661 | 668 | ||
| 662 | /* This holds the point value before the last scroll operation. | 669 | /* This holds the point value before the last scroll operation. |
| 663 | Explicitly setting point sets this to nil. */ | 670 | Explicitly setting point sets this to nil. */ |
| 664 | Lisp_Object INTERNAL_FIELD (point_before_scroll); | 671 | Lisp_Object point_before_scroll_; |
| 665 | 672 | ||
| 666 | /* Truename of the visited file, or nil. */ | 673 | /* Truename of the visited file, or nil. */ |
| 667 | Lisp_Object INTERNAL_FIELD (file_truename); | 674 | Lisp_Object file_truename_; |
| 668 | 675 | ||
| 669 | /* Invisibility spec of this buffer. | 676 | /* Invisibility spec of this buffer. |
| 670 | t => any non-nil `invisible' property means invisible. | 677 | t => any non-nil `invisible' property means invisible. |
| 671 | A list => `invisible' property means invisible | 678 | A list => `invisible' property means invisible |
| 672 | if it is memq in that list. */ | 679 | if it is memq in that list. */ |
| 673 | Lisp_Object INTERNAL_FIELD (invisibility_spec); | 680 | Lisp_Object invisibility_spec_; |
| 674 | 681 | ||
| 675 | /* This is the last window that was selected with this buffer in it, | 682 | /* This is the last window that was selected with this buffer in it, |
| 676 | or nil if that window no longer displays this buffer. */ | 683 | or nil if that window no longer displays this buffer. */ |
| 677 | Lisp_Object INTERNAL_FIELD (last_selected_window); | 684 | Lisp_Object last_selected_window_; |
| 678 | 685 | ||
| 679 | /* Incremented each time the buffer is displayed in a window. */ | 686 | /* Incremented each time the buffer is displayed in a window. */ |
| 680 | Lisp_Object INTERNAL_FIELD (display_count); | 687 | Lisp_Object display_count_; |
| 681 | 688 | ||
| 682 | /* Widths of left and right marginal areas for windows displaying | 689 | /* Widths of left and right marginal areas for windows displaying |
| 683 | this buffer. */ | 690 | this buffer. */ |
| 684 | Lisp_Object INTERNAL_FIELD (left_margin_cols); | 691 | Lisp_Object left_margin_cols_; |
| 685 | Lisp_Object INTERNAL_FIELD (right_margin_cols); | 692 | Lisp_Object right_margin_cols_; |
| 686 | 693 | ||
| 687 | /* Widths of left and right fringe areas for windows displaying | 694 | /* Widths of left and right fringe areas for windows displaying |
| 688 | this buffer. */ | 695 | this buffer. */ |
| 689 | Lisp_Object INTERNAL_FIELD (left_fringe_width); | 696 | Lisp_Object left_fringe_width_; |
| 690 | Lisp_Object INTERNAL_FIELD (right_fringe_width); | 697 | Lisp_Object right_fringe_width_; |
| 691 | 698 | ||
| 692 | /* Non-nil means fringes are drawn outside display margins; | 699 | /* Non-nil means fringes are drawn outside display margins; |
| 693 | othersize draw them between margin areas and text. */ | 700 | othersize draw them between margin areas and text. */ |
| 694 | Lisp_Object INTERNAL_FIELD (fringes_outside_margins); | 701 | Lisp_Object fringes_outside_margins_; |
| 695 | 702 | ||
| 696 | /* Width and type of scroll bar areas for windows displaying | 703 | /* Width, height and types of scroll bar areas for windows displaying |
| 697 | this buffer. */ | 704 | this buffer. */ |
| 698 | Lisp_Object INTERNAL_FIELD (scroll_bar_width); | 705 | Lisp_Object scroll_bar_width_; |
| 699 | Lisp_Object INTERNAL_FIELD (vertical_scroll_bar_type); | 706 | Lisp_Object scroll_bar_height_; |
| 707 | Lisp_Object vertical_scroll_bar_type_; | ||
| 708 | Lisp_Object horizontal_scroll_bar_type_; | ||
| 700 | 709 | ||
| 701 | /* Non-nil means indicate lines not displaying text (in a style | 710 | /* Non-nil means indicate lines not displaying text (in a style |
| 702 | like vi). */ | 711 | like vi). */ |
| 703 | Lisp_Object INTERNAL_FIELD (indicate_empty_lines); | 712 | Lisp_Object indicate_empty_lines_; |
| 704 | 713 | ||
| 705 | /* Non-nil means indicate buffer boundaries and scrolling. */ | 714 | /* Non-nil means indicate buffer boundaries and scrolling. */ |
| 706 | Lisp_Object INTERNAL_FIELD (indicate_buffer_boundaries); | 715 | Lisp_Object indicate_buffer_boundaries_; |
| 707 | 716 | ||
| 708 | /* Logical to physical fringe bitmap mappings. */ | 717 | /* Logical to physical fringe bitmap mappings. */ |
| 709 | Lisp_Object INTERNAL_FIELD (fringe_indicator_alist); | 718 | Lisp_Object fringe_indicator_alist_; |
| 710 | 719 | ||
| 711 | /* Logical to physical cursor bitmap mappings. */ | 720 | /* Logical to physical cursor bitmap mappings. */ |
| 712 | Lisp_Object INTERNAL_FIELD (fringe_cursor_alist); | 721 | Lisp_Object fringe_cursor_alist_; |
| 713 | 722 | ||
| 714 | /* Time stamp updated each time this buffer is displayed in a window. */ | 723 | /* Time stamp updated each time this buffer is displayed in a window. */ |
| 715 | Lisp_Object INTERNAL_FIELD (display_time); | 724 | Lisp_Object display_time_; |
| 716 | 725 | ||
| 717 | /* If scrolling the display because point is below the bottom of a | 726 | /* If scrolling the display because point is below the bottom of a |
| 718 | window showing this buffer, try to choose a window start so | 727 | window showing this buffer, try to choose a window start so |
| 719 | that point ends up this number of lines from the top of the | 728 | that point ends up this number of lines from the top of the |
| 720 | window. Nil means that scrolling method isn't used. */ | 729 | window. Nil means that scrolling method isn't used. */ |
| 721 | Lisp_Object INTERNAL_FIELD (scroll_up_aggressively); | 730 | Lisp_Object scroll_up_aggressively_; |
| 722 | 731 | ||
| 723 | /* If scrolling the display because point is above the top of a | 732 | /* If scrolling the display because point is above the top of a |
| 724 | window showing this buffer, try to choose a window start so | 733 | window showing this buffer, try to choose a window start so |
| 725 | that point ends up this number of lines from the bottom of the | 734 | that point ends up this number of lines from the bottom of the |
| 726 | window. Nil means that scrolling method isn't used. */ | 735 | window. Nil means that scrolling method isn't used. */ |
| 727 | Lisp_Object INTERNAL_FIELD (scroll_down_aggressively); | 736 | Lisp_Object scroll_down_aggressively_; |
| 728 | 737 | ||
| 729 | /* Desired cursor type in this buffer. See the doc string of | 738 | /* Desired cursor type in this buffer. See the doc string of |
| 730 | per-buffer variable `cursor-type'. */ | 739 | per-buffer variable `cursor-type'. */ |
| 731 | Lisp_Object INTERNAL_FIELD (cursor_type); | 740 | Lisp_Object cursor_type_; |
| 732 | 741 | ||
| 733 | /* An integer > 0 means put that number of pixels below text lines | 742 | /* An integer > 0 means put that number of pixels below text lines |
| 734 | in the display of this buffer. */ | 743 | in the display of this buffer. */ |
| 735 | Lisp_Object INTERNAL_FIELD (extra_line_spacing); | 744 | Lisp_Object extra_line_spacing_; |
| 736 | 745 | ||
| 737 | /* Cursor type to display in non-selected windows. | 746 | /* Cursor type to display in non-selected windows. |
| 738 | t means to use hollow box cursor. | 747 | t means to use hollow box cursor. |
| 739 | See `cursor-type' for other values. */ | 748 | See `cursor-type' for other values. */ |
| 740 | Lisp_Object INTERNAL_FIELD (cursor_in_non_selected_windows); | 749 | Lisp_Object cursor_in_non_selected_windows_; |
| 741 | 750 | ||
| 742 | /* No more Lisp_Object beyond this point. Except undo_list, | 751 | /* No more Lisp_Object beyond this point. Except undo_list, |
| 743 | which is handled specially in Fgarbage_collect . */ | 752 | which is handled specially in Fgarbage_collect. */ |
| 744 | 753 | ||
| 745 | /* This structure holds the coordinates of the buffer contents | 754 | /* This structure holds the coordinates of the buffer contents |
| 746 | in ordinary buffers. In indirect buffers, this is not used. */ | 755 | in ordinary buffers. In indirect buffers, this is not used. */ |
| @@ -794,13 +803,13 @@ struct buffer | |||
| 794 | char local_flags[MAX_PER_BUFFER_VARS]; | 803 | char local_flags[MAX_PER_BUFFER_VARS]; |
| 795 | 804 | ||
| 796 | /* Set to the modtime of the visited file when read or written. | 805 | /* Set to the modtime of the visited file when read or written. |
| 797 | EMACS_NSECS (modtime) == NONEXISTENT_MODTIME_NSECS means | 806 | modtime.tv_nsec == NONEXISTENT_MODTIME_NSECS means |
| 798 | visited file was nonexistent. EMACS_NSECS (modtime) == | 807 | visited file was nonexistent. modtime.tv_nsec == |
| 799 | UNKNOWN_MODTIME_NSECS means visited file modtime unknown; | 808 | UNKNOWN_MODTIME_NSECS means visited file modtime unknown; |
| 800 | in no case complain about any mismatch on next save attempt. */ | 809 | in no case complain about any mismatch on next save attempt. */ |
| 801 | #define NONEXISTENT_MODTIME_NSECS (-1) | 810 | #define NONEXISTENT_MODTIME_NSECS (-1) |
| 802 | #define UNKNOWN_MODTIME_NSECS (-2) | 811 | #define UNKNOWN_MODTIME_NSECS (-2) |
| 803 | EMACS_TIME modtime; | 812 | struct timespec modtime; |
| 804 | 813 | ||
| 805 | /* Size of the file when modtime was set. This is used to detect the | 814 | /* Size of the file when modtime was set. This is used to detect the |
| 806 | case where the file grew while we were reading it, so the modtime | 815 | case where the file grew while we were reading it, so the modtime |
| @@ -846,12 +855,12 @@ struct buffer | |||
| 846 | struct region_cache *width_run_cache; | 855 | struct region_cache *width_run_cache; |
| 847 | struct region_cache *bidi_paragraph_cache; | 856 | struct region_cache *bidi_paragraph_cache; |
| 848 | 857 | ||
| 849 | /* Non-zero means don't use redisplay optimizations for | 858 | /* Non-zero means disable redisplay optimizations when rebuilding the glyph |
| 850 | displaying this buffer. */ | 859 | matrices (but not when redrawing). */ |
| 851 | unsigned prevent_redisplay_optimizations_p : 1; | 860 | bool_bf prevent_redisplay_optimizations_p : 1; |
| 852 | 861 | ||
| 853 | /* Non-zero whenever the narrowing is changed in this buffer. */ | 862 | /* Non-zero whenever the narrowing is changed in this buffer. */ |
| 854 | unsigned clip_changed : 1; | 863 | bool_bf clip_changed : 1; |
| 855 | 864 | ||
| 856 | /* List of overlays that end at or before the current center, | 865 | /* List of overlays that end at or before the current center, |
| 857 | in order of end-position. */ | 866 | in order of end-position. */ |
| @@ -869,105 +878,111 @@ struct buffer | |||
| 869 | buffer of an indirect buffer. But we can't store it in the | 878 | buffer of an indirect buffer. But we can't store it in the |
| 870 | struct buffer_text because local variables have to be right in | 879 | struct buffer_text because local variables have to be right in |
| 871 | the struct buffer. So we copy it around in set_buffer_internal. */ | 880 | the struct buffer. So we copy it around in set_buffer_internal. */ |
| 872 | Lisp_Object INTERNAL_FIELD (undo_list); | 881 | Lisp_Object undo_list_; |
| 873 | }; | 882 | }; |
| 874 | 883 | ||
| 875 | /* Most code should use these functions to set Lisp fields in struct | 884 | /* Most code should use these functions to set Lisp fields in struct |
| 876 | buffer. */ | 885 | buffer. (Some setters that are private to a single .c file are |
| 877 | BUFFER_INLINE void | 886 | defined as static in those files.) */ |
| 887 | INLINE void | ||
| 878 | bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) | 888 | bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) |
| 879 | { | 889 | { |
| 880 | b->INTERNAL_FIELD (bidi_paragraph_direction) = val; | 890 | b->bidi_paragraph_direction_ = val; |
| 891 | } | ||
| 892 | INLINE void | ||
| 893 | bset_cache_long_scans (struct buffer *b, Lisp_Object val) | ||
| 894 | { | ||
| 895 | b->cache_long_scans_ = val; | ||
| 881 | } | 896 | } |
| 882 | BUFFER_INLINE void | 897 | INLINE void |
| 883 | bset_case_canon_table (struct buffer *b, Lisp_Object val) | 898 | bset_case_canon_table (struct buffer *b, Lisp_Object val) |
| 884 | { | 899 | { |
| 885 | b->INTERNAL_FIELD (case_canon_table) = val; | 900 | b->case_canon_table_ = val; |
| 886 | } | 901 | } |
| 887 | BUFFER_INLINE void | 902 | INLINE void |
| 888 | bset_case_eqv_table (struct buffer *b, Lisp_Object val) | 903 | bset_case_eqv_table (struct buffer *b, Lisp_Object val) |
| 889 | { | 904 | { |
| 890 | b->INTERNAL_FIELD (case_eqv_table) = val; | 905 | b->case_eqv_table_ = val; |
| 891 | } | 906 | } |
| 892 | BUFFER_INLINE void | 907 | INLINE void |
| 893 | bset_directory (struct buffer *b, Lisp_Object val) | 908 | bset_directory (struct buffer *b, Lisp_Object val) |
| 894 | { | 909 | { |
| 895 | b->INTERNAL_FIELD (directory) = val; | 910 | b->directory_ = val; |
| 896 | } | 911 | } |
| 897 | BUFFER_INLINE void | 912 | INLINE void |
| 898 | bset_display_count (struct buffer *b, Lisp_Object val) | 913 | bset_display_count (struct buffer *b, Lisp_Object val) |
| 899 | { | 914 | { |
| 900 | b->INTERNAL_FIELD (display_count) = val; | 915 | b->display_count_ = val; |
| 901 | } | 916 | } |
| 902 | BUFFER_INLINE void | 917 | INLINE void |
| 903 | bset_display_time (struct buffer *b, Lisp_Object val) | 918 | bset_display_time (struct buffer *b, Lisp_Object val) |
| 904 | { | 919 | { |
| 905 | b->INTERNAL_FIELD (display_time) = val; | 920 | b->display_time_ = val; |
| 906 | } | 921 | } |
| 907 | BUFFER_INLINE void | 922 | INLINE void |
| 908 | bset_downcase_table (struct buffer *b, Lisp_Object val) | 923 | bset_downcase_table (struct buffer *b, Lisp_Object val) |
| 909 | { | 924 | { |
| 910 | b->INTERNAL_FIELD (downcase_table) = val; | 925 | b->downcase_table_ = val; |
| 911 | } | 926 | } |
| 912 | BUFFER_INLINE void | 927 | INLINE void |
| 913 | bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) | 928 | bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) |
| 914 | { | 929 | { |
| 915 | b->INTERNAL_FIELD (enable_multibyte_characters) = val; | 930 | b->enable_multibyte_characters_ = val; |
| 916 | } | 931 | } |
| 917 | BUFFER_INLINE void | 932 | INLINE void |
| 918 | bset_filename (struct buffer *b, Lisp_Object val) | 933 | bset_filename (struct buffer *b, Lisp_Object val) |
| 919 | { | 934 | { |
| 920 | b->INTERNAL_FIELD (filename) = val; | 935 | b->filename_ = val; |
| 921 | } | 936 | } |
| 922 | BUFFER_INLINE void | 937 | INLINE void |
| 923 | bset_keymap (struct buffer *b, Lisp_Object val) | 938 | bset_keymap (struct buffer *b, Lisp_Object val) |
| 924 | { | 939 | { |
| 925 | b->INTERNAL_FIELD (keymap) = val; | 940 | b->keymap_ = val; |
| 926 | } | 941 | } |
| 927 | BUFFER_INLINE void | 942 | INLINE void |
| 928 | bset_last_selected_window (struct buffer *b, Lisp_Object val) | 943 | bset_last_selected_window (struct buffer *b, Lisp_Object val) |
| 929 | { | 944 | { |
| 930 | b->INTERNAL_FIELD (last_selected_window) = val; | 945 | b->last_selected_window_ = val; |
| 931 | } | 946 | } |
| 932 | BUFFER_INLINE void | 947 | INLINE void |
| 933 | bset_local_var_alist (struct buffer *b, Lisp_Object val) | 948 | bset_local_var_alist (struct buffer *b, Lisp_Object val) |
| 934 | { | 949 | { |
| 935 | b->INTERNAL_FIELD (local_var_alist) = val; | 950 | b->local_var_alist_ = val; |
| 936 | } | 951 | } |
| 937 | BUFFER_INLINE void | 952 | INLINE void |
| 938 | bset_mark_active (struct buffer *b, Lisp_Object val) | 953 | bset_mark_active (struct buffer *b, Lisp_Object val) |
| 939 | { | 954 | { |
| 940 | b->INTERNAL_FIELD (mark_active) = val; | 955 | b->mark_active_ = val; |
| 941 | } | 956 | } |
| 942 | BUFFER_INLINE void | 957 | INLINE void |
| 943 | bset_point_before_scroll (struct buffer *b, Lisp_Object val) | 958 | bset_point_before_scroll (struct buffer *b, Lisp_Object val) |
| 944 | { | 959 | { |
| 945 | b->INTERNAL_FIELD (point_before_scroll) = val; | 960 | b->point_before_scroll_ = val; |
| 946 | } | 961 | } |
| 947 | BUFFER_INLINE void | 962 | INLINE void |
| 948 | bset_read_only (struct buffer *b, Lisp_Object val) | 963 | bset_read_only (struct buffer *b, Lisp_Object val) |
| 949 | { | 964 | { |
| 950 | b->INTERNAL_FIELD (read_only) = val; | 965 | b->read_only_ = val; |
| 951 | } | 966 | } |
| 952 | BUFFER_INLINE void | 967 | INLINE void |
| 953 | bset_truncate_lines (struct buffer *b, Lisp_Object val) | 968 | bset_truncate_lines (struct buffer *b, Lisp_Object val) |
| 954 | { | 969 | { |
| 955 | b->INTERNAL_FIELD (truncate_lines) = val; | 970 | b->truncate_lines_ = val; |
| 956 | } | 971 | } |
| 957 | BUFFER_INLINE void | 972 | INLINE void |
| 958 | bset_undo_list (struct buffer *b, Lisp_Object val) | 973 | bset_undo_list (struct buffer *b, Lisp_Object val) |
| 959 | { | 974 | { |
| 960 | b->INTERNAL_FIELD (undo_list) = val; | 975 | b->undo_list_ = val; |
| 961 | } | 976 | } |
| 962 | BUFFER_INLINE void | 977 | INLINE void |
| 963 | bset_upcase_table (struct buffer *b, Lisp_Object val) | 978 | bset_upcase_table (struct buffer *b, Lisp_Object val) |
| 964 | { | 979 | { |
| 965 | b->INTERNAL_FIELD (upcase_table) = val; | 980 | b->upcase_table_ = val; |
| 966 | } | 981 | } |
| 967 | BUFFER_INLINE void | 982 | INLINE void |
| 968 | bset_width_table (struct buffer *b, Lisp_Object val) | 983 | bset_width_table (struct buffer *b, Lisp_Object val) |
| 969 | { | 984 | { |
| 970 | b->INTERNAL_FIELD (width_table) = val; | 985 | b->width_table_ = val; |
| 971 | } | 986 | } |
| 972 | 987 | ||
| 973 | /* Number of Lisp_Objects at the beginning of struct buffer. | 988 | /* Number of Lisp_Objects at the beginning of struct buffer. |
| @@ -1014,7 +1029,7 @@ bset_width_table (struct buffer *b, Lisp_Object val) | |||
| 1014 | else \ | 1029 | else \ |
| 1015 | eassert (b->indirections >= 0); \ | 1030 | eassert (b->indirections >= 0); \ |
| 1016 | } \ | 1031 | } \ |
| 1017 | } while (0) | 1032 | } while (false) |
| 1018 | 1033 | ||
| 1019 | /* Chain of all buffers, including killed ones. */ | 1034 | /* Chain of all buffers, including killed ones. */ |
| 1020 | 1035 | ||
| @@ -1068,13 +1083,21 @@ extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **); | |||
| 1068 | extern void validate_region (Lisp_Object *, Lisp_Object *); | 1083 | extern void validate_region (Lisp_Object *, Lisp_Object *); |
| 1069 | extern void set_buffer_internal_1 (struct buffer *); | 1084 | extern void set_buffer_internal_1 (struct buffer *); |
| 1070 | extern void set_buffer_temp (struct buffer *); | 1085 | extern void set_buffer_temp (struct buffer *); |
| 1071 | extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object); | 1086 | extern Lisp_Object buffer_local_value (Lisp_Object, Lisp_Object); |
| 1072 | extern void record_buffer (Lisp_Object); | 1087 | extern void record_buffer (Lisp_Object); |
| 1073 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); | 1088 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 1074 | extern void mmap_set_vars (bool); | 1089 | extern void mmap_set_vars (bool); |
| 1075 | extern void restore_buffer (Lisp_Object); | 1090 | extern void restore_buffer (Lisp_Object); |
| 1076 | extern void set_buffer_if_live (Lisp_Object); | 1091 | extern void set_buffer_if_live (Lisp_Object); |
| 1077 | 1092 | ||
| 1093 | /* Return B as a struct buffer pointer, defaulting to the current buffer. */ | ||
| 1094 | |||
| 1095 | INLINE struct buffer * | ||
| 1096 | decode_buffer (Lisp_Object b) | ||
| 1097 | { | ||
| 1098 | return NILP (b) ? current_buffer : (CHECK_BUFFER (b), XBUFFER (b)); | ||
| 1099 | } | ||
| 1100 | |||
| 1078 | /* Set the current buffer to B. | 1101 | /* Set the current buffer to B. |
| 1079 | 1102 | ||
| 1080 | We previously set windows_or_buffers_changed here to invalidate | 1103 | We previously set windows_or_buffers_changed here to invalidate |
| @@ -1084,7 +1107,7 @@ extern void set_buffer_if_live (Lisp_Object); | |||
| 1084 | windows than the selected one requires a select_window at some | 1107 | windows than the selected one requires a select_window at some |
| 1085 | time, and that increments windows_or_buffers_changed. */ | 1108 | time, and that increments windows_or_buffers_changed. */ |
| 1086 | 1109 | ||
| 1087 | BUFFER_INLINE void | 1110 | INLINE void |
| 1088 | set_buffer_internal (struct buffer *b) | 1111 | set_buffer_internal (struct buffer *b) |
| 1089 | { | 1112 | { |
| 1090 | if (current_buffer != b) | 1113 | if (current_buffer != b) |
| @@ -1094,7 +1117,7 @@ set_buffer_internal (struct buffer *b) | |||
| 1094 | /* Arrange to go back to the original buffer after the next | 1117 | /* Arrange to go back to the original buffer after the next |
| 1095 | call to unbind_to if the original buffer is still alive. */ | 1118 | call to unbind_to if the original buffer is still alive. */ |
| 1096 | 1119 | ||
| 1097 | BUFFER_INLINE void | 1120 | INLINE void |
| 1098 | record_unwind_current_buffer (void) | 1121 | record_unwind_current_buffer (void) |
| 1099 | { | 1122 | { |
| 1100 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); | 1123 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); |
| @@ -1107,23 +1130,19 @@ record_unwind_current_buffer (void) | |||
| 1107 | #define GET_OVERLAYS_AT(posn, overlays, noverlays, nextp, chrq) \ | 1130 | #define GET_OVERLAYS_AT(posn, overlays, noverlays, nextp, chrq) \ |
| 1108 | do { \ | 1131 | do { \ |
| 1109 | ptrdiff_t maxlen = 40; \ | 1132 | ptrdiff_t maxlen = 40; \ |
| 1110 | overlays = alloca (maxlen * sizeof *overlays); \ | 1133 | SAFE_NALLOCA (overlays, 1, maxlen); \ |
| 1111 | noverlays = overlays_at (posn, 0, &overlays, &maxlen, \ | 1134 | (noverlays) = overlays_at (posn, false, &(overlays), &maxlen, \ |
| 1112 | nextp, NULL, chrq); \ | 1135 | nextp, NULL, chrq); \ |
| 1113 | if (noverlays > maxlen) \ | 1136 | if ((noverlays) > maxlen) \ |
| 1114 | { \ | 1137 | { \ |
| 1115 | maxlen = noverlays; \ | 1138 | maxlen = noverlays; \ |
| 1116 | overlays = alloca (maxlen * sizeof *overlays); \ | 1139 | SAFE_NALLOCA (overlays, 1, maxlen); \ |
| 1117 | noverlays = overlays_at (posn, 0, &overlays, &maxlen, \ | 1140 | (noverlays) = overlays_at (posn, false, &(overlays), &maxlen, \ |
| 1118 | nextp, NULL, chrq); \ | 1141 | nextp, NULL, chrq); \ |
| 1119 | } \ | 1142 | } \ |
| 1120 | } while (0) | 1143 | } while (false) |
| 1121 | 1144 | ||
| 1122 | extern Lisp_Object Vbuffer_alist; | 1145 | extern Lisp_Object Vbuffer_alist; |
| 1123 | extern Lisp_Object Qbefore_change_functions; | ||
| 1124 | extern Lisp_Object Qafter_change_functions; | ||
| 1125 | extern Lisp_Object Qfirst_change_hook; | ||
| 1126 | extern Lisp_Object Qpriority, Qbefore_string, Qafter_string; | ||
| 1127 | 1146 | ||
| 1128 | /* FOR_EACH_LIVE_BUFFER (LIST_VAR, BUF_VAR) followed by a statement is | 1147 | /* FOR_EACH_LIVE_BUFFER (LIST_VAR, BUF_VAR) followed by a statement is |
| 1129 | a `for' loop which iterates over the buffers from Vbuffer_alist. */ | 1148 | a `for' loop which iterates over the buffers from Vbuffer_alist. */ |
| @@ -1133,7 +1152,7 @@ extern Lisp_Object Qpriority, Qbefore_string, Qafter_string; | |||
| 1133 | 1152 | ||
| 1134 | /* Get text properties of B. */ | 1153 | /* Get text properties of B. */ |
| 1135 | 1154 | ||
| 1136 | BUFFER_INLINE INTERVAL | 1155 | INLINE INTERVAL |
| 1137 | buffer_intervals (struct buffer *b) | 1156 | buffer_intervals (struct buffer *b) |
| 1138 | { | 1157 | { |
| 1139 | eassert (b->text != NULL); | 1158 | eassert (b->text != NULL); |
| @@ -1142,7 +1161,7 @@ buffer_intervals (struct buffer *b) | |||
| 1142 | 1161 | ||
| 1143 | /* Set text properties of B to I. */ | 1162 | /* Set text properties of B to I. */ |
| 1144 | 1163 | ||
| 1145 | BUFFER_INLINE void | 1164 | INLINE void |
| 1146 | set_buffer_intervals (struct buffer *b, INTERVAL i) | 1165 | set_buffer_intervals (struct buffer *b, INTERVAL i) |
| 1147 | { | 1166 | { |
| 1148 | eassert (b->text != NULL); | 1167 | eassert (b->text != NULL); |
| @@ -1151,7 +1170,7 @@ set_buffer_intervals (struct buffer *b, INTERVAL i) | |||
| 1151 | 1170 | ||
| 1152 | /* Non-zero if current buffer has overlays. */ | 1171 | /* Non-zero if current buffer has overlays. */ |
| 1153 | 1172 | ||
| 1154 | BUFFER_INLINE bool | 1173 | INLINE bool |
| 1155 | buffer_has_overlays (void) | 1174 | buffer_has_overlays (void) |
| 1156 | { | 1175 | { |
| 1157 | return current_buffer->overlays_before || current_buffer->overlays_after; | 1176 | return current_buffer->overlays_before || current_buffer->overlays_after; |
| @@ -1171,7 +1190,7 @@ buffer_has_overlays (void) | |||
| 1171 | the buffer to the next character after fetching this one. Instead, | 1190 | the buffer to the next character after fetching this one. Instead, |
| 1172 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ | 1191 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ |
| 1173 | 1192 | ||
| 1174 | BUFFER_INLINE int | 1193 | INLINE int |
| 1175 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | 1194 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) |
| 1176 | { | 1195 | { |
| 1177 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) | 1196 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) |
| @@ -1183,7 +1202,7 @@ FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | |||
| 1183 | If POS doesn't point the head of valid multi-byte form, only the byte at | 1202 | If POS doesn't point the head of valid multi-byte form, only the byte at |
| 1184 | POS is returned. No range checking. */ | 1203 | POS is returned. No range checking. */ |
| 1185 | 1204 | ||
| 1186 | BUFFER_INLINE int | 1205 | INLINE int |
| 1187 | BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) | 1206 | BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) |
| 1188 | { | 1207 | { |
| 1189 | unsigned char *p | 1208 | unsigned char *p |
| @@ -1194,7 +1213,7 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) | |||
| 1194 | 1213 | ||
| 1195 | /* Return number of windows showing B. */ | 1214 | /* Return number of windows showing B. */ |
| 1196 | 1215 | ||
| 1197 | BUFFER_INLINE int | 1216 | INLINE int |
| 1198 | buffer_window_count (struct buffer *b) | 1217 | buffer_window_count (struct buffer *b) |
| 1199 | { | 1218 | { |
| 1200 | if (b->base_buffer) | 1219 | if (b->base_buffer) |
| @@ -1236,7 +1255,7 @@ extern int last_per_buffer_idx; | |||
| 1236 | from the start of a buffer structure. */ | 1255 | from the start of a buffer structure. */ |
| 1237 | 1256 | ||
| 1238 | #define PER_BUFFER_VAR_OFFSET(VAR) \ | 1257 | #define PER_BUFFER_VAR_OFFSET(VAR) \ |
| 1239 | offsetof (struct buffer, INTERNAL_FIELD (VAR)) | 1258 | offsetof (struct buffer, VAR ## _) |
| 1240 | 1259 | ||
| 1241 | /* Used to iterate over normal Lisp_Object fields of struct buffer (all | 1260 | /* Used to iterate over normal Lisp_Object fields of struct buffer (all |
| 1242 | Lisp_Objects except undo_list). If you add, remove, or reorder | 1261 | Lisp_Objects except undo_list). If you add, remove, or reorder |
| @@ -1256,12 +1275,12 @@ extern int last_per_buffer_idx; | |||
| 1256 | #define PER_BUFFER_VAR_IDX(VAR) \ | 1275 | #define PER_BUFFER_VAR_IDX(VAR) \ |
| 1257 | PER_BUFFER_IDX (PER_BUFFER_VAR_OFFSET (VAR)) | 1276 | PER_BUFFER_IDX (PER_BUFFER_VAR_OFFSET (VAR)) |
| 1258 | 1277 | ||
| 1259 | /* Value is non-zero if the variable with index IDX has a local value | 1278 | /* Value is true if the variable with index IDX has a local value |
| 1260 | in buffer B. */ | 1279 | in buffer B. */ |
| 1261 | 1280 | ||
| 1262 | #define PER_BUFFER_VALUE_P(B, IDX) \ | 1281 | #define PER_BUFFER_VALUE_P(B, IDX) \ |
| 1263 | (((IDX) < 0 || IDX >= last_per_buffer_idx) \ | 1282 | (((IDX) < 0 || IDX >= last_per_buffer_idx) \ |
| 1264 | ? (emacs_abort (), 0) \ | 1283 | ? (emacs_abort (), false) \ |
| 1265 | : ((B)->local_flags[IDX] != 0)) | 1284 | : ((B)->local_flags[IDX] != 0)) |
| 1266 | 1285 | ||
| 1267 | /* Set whether per-buffer variable with index IDX has a buffer-local | 1286 | /* Set whether per-buffer variable with index IDX has a buffer-local |
| @@ -1272,7 +1291,7 @@ extern int last_per_buffer_idx; | |||
| 1272 | if ((IDX) < 0 || (IDX) >= last_per_buffer_idx) \ | 1291 | if ((IDX) < 0 || (IDX) >= last_per_buffer_idx) \ |
| 1273 | emacs_abort (); \ | 1292 | emacs_abort (); \ |
| 1274 | (B)->local_flags[IDX] = (VAL); \ | 1293 | (B)->local_flags[IDX] = (VAL); \ |
| 1275 | } while (0) | 1294 | } while (false) |
| 1276 | 1295 | ||
| 1277 | /* Return the index value of the per-buffer variable at offset OFFSET | 1296 | /* Return the index value of the per-buffer variable at offset OFFSET |
| 1278 | in the buffer structure. | 1297 | in the buffer structure. |
| @@ -1301,13 +1320,13 @@ extern int last_per_buffer_idx; | |||
| 1301 | /* Functions to get and set default value of the per-buffer | 1320 | /* Functions to get and set default value of the per-buffer |
| 1302 | variable at offset OFFSET in the buffer structure. */ | 1321 | variable at offset OFFSET in the buffer structure. */ |
| 1303 | 1322 | ||
| 1304 | BUFFER_INLINE Lisp_Object | 1323 | INLINE Lisp_Object |
| 1305 | per_buffer_default (int offset) | 1324 | per_buffer_default (int offset) |
| 1306 | { | 1325 | { |
| 1307 | return *(Lisp_Object *)(offset + (char *) &buffer_defaults); | 1326 | return *(Lisp_Object *)(offset + (char *) &buffer_defaults); |
| 1308 | } | 1327 | } |
| 1309 | 1328 | ||
| 1310 | BUFFER_INLINE void | 1329 | INLINE void |
| 1311 | set_per_buffer_default (int offset, Lisp_Object value) | 1330 | set_per_buffer_default (int offset, Lisp_Object value) |
| 1312 | { | 1331 | { |
| 1313 | *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; | 1332 | *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; |
| @@ -1316,20 +1335,20 @@ set_per_buffer_default (int offset, Lisp_Object value) | |||
| 1316 | /* Functions to get and set buffer-local value of the per-buffer | 1335 | /* Functions to get and set buffer-local value of the per-buffer |
| 1317 | variable at offset OFFSET in the buffer structure. */ | 1336 | variable at offset OFFSET in the buffer structure. */ |
| 1318 | 1337 | ||
| 1319 | BUFFER_INLINE Lisp_Object | 1338 | INLINE Lisp_Object |
| 1320 | per_buffer_value (struct buffer *b, int offset) | 1339 | per_buffer_value (struct buffer *b, int offset) |
| 1321 | { | 1340 | { |
| 1322 | return *(Lisp_Object *)(offset + (char *) b); | 1341 | return *(Lisp_Object *)(offset + (char *) b); |
| 1323 | } | 1342 | } |
| 1324 | 1343 | ||
| 1325 | BUFFER_INLINE void | 1344 | INLINE void |
| 1326 | set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) | 1345 | set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) |
| 1327 | { | 1346 | { |
| 1328 | *(Lisp_Object *)(offset + (char *) b) = value; | 1347 | *(Lisp_Object *)(offset + (char *) b) = value; |
| 1329 | } | 1348 | } |
| 1330 | 1349 | ||
| 1331 | /* Downcase a character C, or make no change if that cannot be done. */ | 1350 | /* Downcase a character C, or make no change if that cannot be done. */ |
| 1332 | BUFFER_INLINE int | 1351 | INLINE int |
| 1333 | downcase (int c) | 1352 | downcase (int c) |
| 1334 | { | 1353 | { |
| 1335 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); | 1354 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); |
| @@ -1337,11 +1356,11 @@ downcase (int c) | |||
| 1337 | return NATNUMP (down) ? XFASTINT (down) : c; | 1356 | return NATNUMP (down) ? XFASTINT (down) : c; |
| 1338 | } | 1357 | } |
| 1339 | 1358 | ||
| 1340 | /* 1 if C is upper case. */ | 1359 | /* True if C is upper case. */ |
| 1341 | BUFFER_INLINE bool uppercasep (int c) { return downcase (c) != c; } | 1360 | INLINE bool uppercasep (int c) { return downcase (c) != c; } |
| 1342 | 1361 | ||
| 1343 | /* Upcase a character C known to be not upper case. */ | 1362 | /* Upcase a character C known to be not upper case. */ |
| 1344 | BUFFER_INLINE int | 1363 | INLINE int |
| 1345 | upcase1 (int c) | 1364 | upcase1 (int c) |
| 1346 | { | 1365 | { |
| 1347 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); | 1366 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); |
| @@ -1349,14 +1368,16 @@ upcase1 (int c) | |||
| 1349 | return NATNUMP (up) ? XFASTINT (up) : c; | 1368 | return NATNUMP (up) ? XFASTINT (up) : c; |
| 1350 | } | 1369 | } |
| 1351 | 1370 | ||
| 1352 | /* 1 if C is lower case. */ | 1371 | /* True if C is lower case. */ |
| 1353 | BUFFER_INLINE bool | 1372 | INLINE bool |
| 1354 | lowercasep (int c) | 1373 | lowercasep (int c) |
| 1355 | { | 1374 | { |
| 1356 | return !uppercasep (c) && upcase1 (c) != c; | 1375 | return !uppercasep (c) && upcase1 (c) != c; |
| 1357 | } | 1376 | } |
| 1358 | 1377 | ||
| 1359 | /* Upcase a character C, or make no change if that cannot be done. */ | 1378 | /* Upcase a character C, or make no change if that cannot be done. */ |
| 1360 | BUFFER_INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } | 1379 | INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } |
| 1361 | 1380 | ||
| 1362 | INLINE_HEADER_END | 1381 | INLINE_HEADER_END |
| 1382 | |||
| 1383 | #endif /* EMACS_BUFFER_H */ | ||