diff options
| author | Paul Eggert | 2019-05-22 13:25:47 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-05-22 13:29:13 -0700 |
| commit | dfed333b312d06b3416ebfadff544eae38313391 (patch) | |
| tree | c4c013baf966e177418675b5ed08c9a08832396d /src | |
| parent | 5c21832ae866077874fb662e49c695a7850ec22c (diff) | |
| download | emacs-dfed333b312d06b3416ebfadff544eae38313391.tar.gz emacs-dfed333b312d06b3416ebfadff544eae38313391.zip | |
Remove fixnum restriction on some display vars
This is a minor patch to remove some fixnum restrictions.
Many more such patches are needed, but one thing at a time.
* doc/emacs/custom.texi (Examining): Update fill-column example.
* src/buffer.c (fill-column, left-margin, tab-width)
(buffer-saved-size, left-margin-width, right-margin-width)
(left-fringe-width, right-fringe-width, scroll-bar-width)
(scroll-bar-height, buffer-display-count):
Allow any integer; do not restrict to fixnums.
* src/character.h (SANE_TAB_WIDTH): Do not assume tab_width
is a nonnegative fixnum.
(sanitize_tab_width): Take a Lisp_Object integer, not an
EMACS_INT. Only use changed.
* src/data.c (store_symval_forwarding): Remove unnecessary
SYMBOLP since the predicate (e.g., Qintegerp) is always a
symbol (leave the test in as an eassert). Avoid assignments
inside if-conditions.
* src/fileio.c (Fdo_auto_save): Do not assume
buffer-saved-size is a fixnum. Avoid undefined behavior
on EMACS_INT overflow by multiplying a fixnum by at most 4,
not by at most 13.
* src/window.c (set_window_buffer): When buffer-display-count
is too large for a fixnum, make it a bignum.
* src/xdisp.c (FILL_COLUMN_INDICATOR_NEEDED): Remove macro, ...
(fill_column_indicator_column): ... replacing with this new function.
All uses changed. The function is a bit pickier, to prevent
problems with non-character fixnums and columns out of range
for int, and to remove the assumption that integers are in
fixnum range.
(append_space_for_newline, extend_face_to_end_of_line):
Avoid undefined behavior with signed integer overflow.
Simplify.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 22 | ||||
| -rw-r--r-- | src/character.h | 9 | ||||
| -rw-r--r-- | src/data.c | 23 | ||||
| -rw-r--r-- | src/fileio.c | 9 | ||||
| -rw-r--r-- | src/lisp.h | 2 | ||||
| -rw-r--r-- | src/window.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 141 |
7 files changed, 100 insertions, 110 deletions
diff --git a/src/buffer.c b/src/buffer.c index 3b5078a175b..209e29f0f19 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5603,17 +5603,17 @@ Use the command `abbrev-mode' to change this variable. */); | |||
| 5603 | doc: /* Non-nil if searches and matches should ignore case. */); | 5603 | doc: /* Non-nil if searches and matches should ignore case. */); |
| 5604 | 5604 | ||
| 5605 | DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), | 5605 | DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), |
| 5606 | Qfixnump, | 5606 | Qintegerp, |
| 5607 | doc: /* Column beyond which automatic line-wrapping should happen. | 5607 | doc: /* Column beyond which automatic line-wrapping should happen. |
| 5608 | Interactively, you can set the buffer local value using \\[set-fill-column]. */); | 5608 | Interactively, you can set the buffer local value using \\[set-fill-column]. */); |
| 5609 | 5609 | ||
| 5610 | DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), | 5610 | DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), |
| 5611 | Qfixnump, | 5611 | Qintegerp, |
| 5612 | doc: /* Column for the default `indent-line-function' to indent to. | 5612 | doc: /* Column for the default `indent-line-function' to indent to. |
| 5613 | Linefeed indents to this column in Fundamental mode. */); | 5613 | Linefeed indents to this column in Fundamental mode. */); |
| 5614 | 5614 | ||
| 5615 | DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), | 5615 | DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), |
| 5616 | Qfixnump, | 5616 | Qintegerp, |
| 5617 | doc: /* Distance between tab stops (for display of tab characters), in columns. | 5617 | doc: /* Distance between tab stops (for display of tab characters), in columns. |
| 5618 | NOTE: This controls the display width of a TAB character, and not | 5618 | NOTE: This controls the display width of a TAB character, and not |
| 5619 | the size of an indentation step. | 5619 | the size of an indentation step. |
| @@ -5784,7 +5784,7 @@ If it is nil, that means don't auto-save this buffer. */); | |||
| 5784 | Backing up is done before the first time the file is saved. */); | 5784 | Backing up is done before the first time the file is saved. */); |
| 5785 | 5785 | ||
| 5786 | DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), | 5786 | DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), |
| 5787 | Qfixnump, | 5787 | Qintegerp, |
| 5788 | doc: /* Length of current buffer when last read in, saved or auto-saved. | 5788 | doc: /* Length of current buffer when last read in, saved or auto-saved. |
| 5789 | 0 initially. | 5789 | 0 initially. |
| 5790 | -1 means auto-saving turned off until next real save. | 5790 | -1 means auto-saving turned off until next real save. |
| @@ -5858,7 +5858,7 @@ In addition, a char-table has six extra slots to control the display of: | |||
| 5858 | See also the functions `display-table-slot' and `set-display-table-slot'. */); | 5858 | See also the functions `display-table-slot' and `set-display-table-slot'. */); |
| 5859 | 5859 | ||
| 5860 | DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), | 5860 | DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), |
| 5861 | Qfixnump, | 5861 | Qintegerp, |
| 5862 | doc: /* Width in columns of left marginal area for display of a buffer. | 5862 | doc: /* Width in columns of left marginal area for display of a buffer. |
| 5863 | A value of nil means no marginal area. | 5863 | A value of nil means no marginal area. |
| 5864 | 5864 | ||
| @@ -5866,7 +5866,7 @@ Setting this variable does not take effect until a new buffer is displayed | |||
| 5866 | in a window. To make the change take effect, call `set-window-buffer'. */); | 5866 | in a window. To make the change take effect, call `set-window-buffer'. */); |
| 5867 | 5867 | ||
| 5868 | DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), | 5868 | DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), |
| 5869 | Qfixnump, | 5869 | Qintegerp, |
| 5870 | doc: /* Width in columns of right marginal area for display of a buffer. | 5870 | doc: /* Width in columns of right marginal area for display of a buffer. |
| 5871 | A value of nil means no marginal area. | 5871 | A value of nil means no marginal area. |
| 5872 | 5872 | ||
| @@ -5874,7 +5874,7 @@ Setting this variable does not take effect until a new buffer is displayed | |||
| 5874 | in a window. To make the change take effect, call `set-window-buffer'. */); | 5874 | in a window. To make the change take effect, call `set-window-buffer'. */); |
| 5875 | 5875 | ||
| 5876 | DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), | 5876 | DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), |
| 5877 | Qfixnump, | 5877 | Qintegerp, |
| 5878 | doc: /* Width of this buffer's left fringe (in pixels). | 5878 | doc: /* Width of this buffer's left fringe (in pixels). |
| 5879 | A value of 0 means no left fringe is shown in this buffer's window. | 5879 | A value of 0 means no left fringe is shown in this buffer's window. |
| 5880 | A value of nil means to use the left fringe width from the window's frame. | 5880 | A value of nil means to use the left fringe width from the window's frame. |
| @@ -5883,7 +5883,7 @@ Setting this variable does not take effect until a new buffer is displayed | |||
| 5883 | in a window. To make the change take effect, call `set-window-buffer'. */); | 5883 | in a window. To make the change take effect, call `set-window-buffer'. */); |
| 5884 | 5884 | ||
| 5885 | DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), | 5885 | DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), |
| 5886 | Qfixnump, | 5886 | Qintegerp, |
| 5887 | doc: /* Width of this buffer's right fringe (in pixels). | 5887 | doc: /* Width of this buffer's right fringe (in pixels). |
| 5888 | A value of 0 means no right fringe is shown in this buffer's window. | 5888 | A value of 0 means no right fringe is shown in this buffer's window. |
| 5889 | A value of nil means to use the right fringe width from the window's frame. | 5889 | A value of nil means to use the right fringe width from the window's frame. |
| @@ -5900,12 +5900,12 @@ Setting this variable does not take effect until a new buffer is displayed | |||
| 5900 | in a window. To make the change take effect, call `set-window-buffer'. */); | 5900 | in a window. To make the change take effect, call `set-window-buffer'. */); |
| 5901 | 5901 | ||
| 5902 | DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), | 5902 | DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), |
| 5903 | Qfixnump, | 5903 | Qintegerp, |
| 5904 | doc: /* Width of this buffer's vertical scroll bars in pixels. | 5904 | doc: /* Width of this buffer's vertical scroll bars in pixels. |
| 5905 | A value of nil means to use the scroll bar width from the window's frame. */); | 5905 | A value of nil means to use the scroll bar width from the window's frame. */); |
| 5906 | 5906 | ||
| 5907 | DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height), | 5907 | DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height), |
| 5908 | Qfixnump, | 5908 | Qintegerp, |
| 5909 | doc: /* Height of this buffer's horizontal scroll bars in pixels. | 5909 | doc: /* Height of this buffer's horizontal scroll bars in pixels. |
| 5910 | A value of nil means to use the scroll bar height from the window's frame. */); | 5910 | A value of nil means to use the scroll bar height from the window's frame. */); |
| 5911 | 5911 | ||
| @@ -6175,7 +6175,7 @@ Setting this variable is very fast, much faster than scanning all the text in | |||
| 6175 | the buffer looking for properties to change. */); | 6175 | the buffer looking for properties to change. */); |
| 6176 | 6176 | ||
| 6177 | DEFVAR_PER_BUFFER ("buffer-display-count", | 6177 | DEFVAR_PER_BUFFER ("buffer-display-count", |
| 6178 | &BVAR (current_buffer, display_count), Qfixnump, | 6178 | &BVAR (current_buffer, display_count), Qintegerp, |
| 6179 | doc: /* A number incremented each time this buffer is displayed in a window. | 6179 | doc: /* A number incremented each time this buffer is displayed in a window. |
| 6180 | The function `set-window-buffer' increments it. */); | 6180 | The function `set-window-buffer' increments it. */); |
| 6181 | 6181 | ||
diff --git a/src/character.h b/src/character.h index 5dff85aed47..cc57a2a7d5c 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -558,12 +558,13 @@ enum | |||
| 558 | 558 | ||
| 559 | /* Return a non-outlandish value for the tab width. */ | 559 | /* Return a non-outlandish value for the tab width. */ |
| 560 | 560 | ||
| 561 | #define SANE_TAB_WIDTH(buf) \ | 561 | #define SANE_TAB_WIDTH(buf) sanitize_tab_width (BVAR (buf, tab_width)) |
| 562 | sanitize_tab_width (XFIXNAT (BVAR (buf, tab_width))) | 562 | |
| 563 | INLINE int | 563 | INLINE int |
| 564 | sanitize_tab_width (EMACS_INT width) | 564 | sanitize_tab_width (Lisp_Object width) |
| 565 | { | 565 | { |
| 566 | return 0 < width && width <= 1000 ? width : 8; | 566 | return (FIXNUMP (width) && 0 < XFIXNUM (width) && XFIXNUM (width) <= 1000 |
| 567 | ? XFIXNUM (width) : 8); | ||
| 567 | } | 568 | } |
| 568 | 569 | ||
| 569 | /* Return the width of ASCII character C. The width is measured by | 570 | /* Return the width of ASCII character C. The width is measured by |
diff --git a/src/data.c b/src/data.c index 476d28eadbc..c1699aeae73 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1122,20 +1122,21 @@ store_symval_forwarding (lispfwd valcontents, Lisp_Object newval, | |||
| 1122 | int offset = XBUFFER_OBJFWD (valcontents)->offset; | 1122 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 1123 | Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate; | 1123 | Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate; |
| 1124 | 1124 | ||
| 1125 | if (!NILP (newval)) | 1125 | if (!NILP (newval) && !NILP (predicate)) |
| 1126 | { | 1126 | { |
| 1127 | if (SYMBOLP (predicate)) | 1127 | eassert (SYMBOLP (predicate)); |
| 1128 | Lisp_Object choiceprop = Fget (predicate, Qchoice); | ||
| 1129 | if (!NILP (choiceprop)) | ||
| 1128 | { | 1130 | { |
| 1129 | Lisp_Object prop; | 1131 | if (NILP (Fmemq (newval, choiceprop))) |
| 1130 | 1132 | wrong_choice (choiceprop, newval); | |
| 1131 | if ((prop = Fget (predicate, Qchoice), !NILP (prop))) | 1133 | } |
| 1132 | { | 1134 | else |
| 1133 | if (NILP (Fmemq (newval, prop))) | 1135 | { |
| 1134 | wrong_choice (prop, newval); | 1136 | Lisp_Object rangeprop = Fget (predicate, Qrange); |
| 1135 | } | 1137 | if (CONSP (rangeprop)) |
| 1136 | else if ((prop = Fget (predicate, Qrange), !NILP (prop))) | ||
| 1137 | { | 1138 | { |
| 1138 | Lisp_Object min = XCAR (prop), max = XCDR (prop); | 1139 | Lisp_Object min = XCAR (rangeprop), max = XCDR (rangeprop); |
| 1139 | if (! NUMBERP (newval) | 1140 | if (! NUMBERP (newval) |
| 1140 | || NILP (CALLN (Fleq, min, newval, max))) | 1141 | || NILP (CALLN (Fleq, min, newval, max))) |
| 1141 | wrong_range (min, max, newval); | 1142 | wrong_range (min, max, newval); |
diff --git a/src/fileio.c b/src/fileio.c index 4ee125d7de2..9e9779967dd 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5802,6 +5802,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5802 | && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) | 5802 | && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) |
| 5803 | && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b) | 5803 | && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b) |
| 5804 | /* -1 means we've turned off autosaving for a while--see below. */ | 5804 | /* -1 means we've turned off autosaving for a while--see below. */ |
| 5805 | && FIXNUMP (BVAR (b, save_length)) | ||
| 5805 | && XFIXNUM (BVAR (b, save_length)) >= 0 | 5806 | && XFIXNUM (BVAR (b, save_length)) >= 0 |
| 5806 | && (do_handled_files | 5807 | && (do_handled_files |
| 5807 | || NILP (Ffind_file_name_handler (BVAR (b, auto_save_file_name), | 5808 | || NILP (Ffind_file_name_handler (BVAR (b, auto_save_file_name), |
| @@ -5815,13 +5816,17 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5815 | && before_time.tv_sec - b->auto_save_failure_time < 1200) | 5816 | && before_time.tv_sec - b->auto_save_failure_time < 1200) |
| 5816 | continue; | 5817 | continue; |
| 5817 | 5818 | ||
| 5819 | enum { growth_factor = 4 }; | ||
| 5820 | verify (BUF_BYTES_MAX <= EMACS_INT_MAX / growth_factor); | ||
| 5821 | |||
| 5818 | set_buffer_internal (b); | 5822 | set_buffer_internal (b); |
| 5819 | if (NILP (Vauto_save_include_big_deletions) | 5823 | if (NILP (Vauto_save_include_big_deletions) |
| 5820 | && (XFIXNAT (BVAR (b, save_length)) * 10 | 5824 | && FIXNUMP (BVAR (b, save_length)) |
| 5821 | > (BUF_Z (b) - BUF_BEG (b)) * 13) | ||
| 5822 | /* A short file is likely to change a large fraction; | 5825 | /* A short file is likely to change a large fraction; |
| 5823 | spare the user annoying messages. */ | 5826 | spare the user annoying messages. */ |
| 5824 | && XFIXNAT (BVAR (b, save_length)) > 5000 | 5827 | && XFIXNAT (BVAR (b, save_length)) > 5000 |
| 5828 | && (growth_factor * (BUF_Z (b) - BUF_BEG (b)) | ||
| 5829 | < (growth_factor - 1) * XFIXNAT (BVAR (b, save_length))) | ||
| 5825 | /* These messages are frequent and annoying for `*mail*'. */ | 5830 | /* These messages are frequent and annoying for `*mail*'. */ |
| 5826 | && !NILP (BVAR (b, filename)) | 5831 | && !NILP (BVAR (b, filename)) |
| 5827 | && NILP (no_message)) | 5832 | && NILP (no_message)) |
diff --git a/src/lisp.h b/src/lisp.h index 876b757bf3f..6db90596899 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2679,7 +2679,7 @@ struct Lisp_Buffer_Objfwd | |||
| 2679 | { | 2679 | { |
| 2680 | enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */ | 2680 | enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */ |
| 2681 | int offset; | 2681 | int offset; |
| 2682 | /* One of Qnil, Qfixnump, Qsymbolp, Qstringp, Qfloatp or Qnumberp. */ | 2682 | /* One of Qnil, Qintegerp, Qsymbolp, Qstringp, Qfloatp or Qnumberp. */ |
| 2683 | Lisp_Object predicate; | 2683 | Lisp_Object predicate; |
| 2684 | }; | 2684 | }; |
| 2685 | 2685 | ||
diff --git a/src/window.c b/src/window.c index ca7cf7a4a61..deeb4f63fe0 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3947,8 +3947,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, | |||
| 3947 | b->display_error_modiff = 0; | 3947 | b->display_error_modiff = 0; |
| 3948 | 3948 | ||
| 3949 | /* Update time stamps of buffer display. */ | 3949 | /* Update time stamps of buffer display. */ |
| 3950 | if (FIXNUMP (BVAR (b, display_count))) | 3950 | if (INTEGERP (BVAR (b, display_count))) |
| 3951 | bset_display_count (b, make_fixnum (XFIXNUM (BVAR (b, display_count)) + 1)); | 3951 | bset_display_count (b, Fadd1 (BVAR (b, display_count))); |
| 3952 | bset_display_time (b, Fcurrent_time ()); | 3952 | bset_display_time (b, Fcurrent_time ()); |
| 3953 | 3953 | ||
| 3954 | w->window_end_pos = 0; | 3954 | w->window_end_pos = 0; |
diff --git a/src/xdisp.c b/src/xdisp.c index 9eed74cb98a..5f438152341 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -376,17 +376,26 @@ static Lisp_Object list_of_error; | |||
| 376 | || it->s[IT_BYTEPOS (*it)] == '\t')) \ | 376 | || it->s[IT_BYTEPOS (*it)] == '\t')) \ |
| 377 | || (IT_BYTEPOS (*it) < ZV_BYTE \ | 377 | || (IT_BYTEPOS (*it) < ZV_BYTE \ |
| 378 | && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' ' \ | 378 | && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' ' \ |
| 379 | || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t')))) \ | 379 | || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t')))) |
| 380 | 380 | ||
| 381 | /* Test all the conditions needed to print the fill column indicator. */ | 381 | /* If all the conditions needed to print the fill column indicator are |
| 382 | #define FILL_COLUMN_INDICATOR_NEEDED(it) \ | 382 | met, return the (nonnegative) column number, else return a negative |
| 383 | Vdisplay_fill_column_indicator \ | 383 | value. */ |
| 384 | && (it->continuation_lines_width == 0) \ | 384 | static int |
| 385 | && (!NILP (Vdisplay_fill_column_indicator_column)) \ | 385 | fill_column_indicator_column (struct it *it) |
| 386 | && FIXNATP (Vdisplay_fill_column_indicator_character) \ | 386 | { |
| 387 | && ((EQ (Vdisplay_fill_column_indicator_column, Qt) \ | 387 | if (Vdisplay_fill_column_indicator |
| 388 | && FIXNATP (BVAR (current_buffer, fill_column))) \ | 388 | && it->continuation_lines_width == 0 |
| 389 | || (FIXNATP (Vdisplay_fill_column_indicator_column))) | 389 | && CHARACTERP (Vdisplay_fill_column_indicator_character)) |
| 390 | { | ||
| 391 | Lisp_Object col = (EQ (Vdisplay_fill_column_indicator_column, Qt) | ||
| 392 | ? BVAR (current_buffer, fill_column) | ||
| 393 | : Vdisplay_fill_column_indicator_column); | ||
| 394 | if (RANGED_FIXNUMP (0, col, INT_MAX)) | ||
| 395 | return XFIXNUM (col); | ||
| 396 | } | ||
| 397 | return -1; | ||
| 398 | } | ||
| 390 | 399 | ||
| 391 | /* True means print newline to stdout before next mini-buffer message. */ | 400 | /* True means print newline to stdout before next mini-buffer message. */ |
| 392 | 401 | ||
| @@ -20160,18 +20169,11 @@ append_space_for_newline (struct it *it, bool default_face_p) | |||
| 20160 | /* Corner case for when display-fill-column-indicator-mode | 20169 | /* Corner case for when display-fill-column-indicator-mode |
| 20161 | is active and the extra character should be added in the | 20170 | is active and the extra character should be added in the |
| 20162 | same place than the line. */ | 20171 | same place than the line. */ |
| 20163 | if ((it->w->pseudo_window_p == 0) | 20172 | int indicator_column = (it->w->pseudo_window_p == 0 |
| 20164 | && FILL_COLUMN_INDICATOR_NEEDED(it)) | 20173 | ? fill_column_indicator_column (it) |
| 20174 | : -1); | ||
| 20175 | if (0 <= indicator_column) | ||
| 20165 | { | 20176 | { |
| 20166 | int fill_column_indicator_column = -1; | ||
| 20167 | |||
| 20168 | if (EQ (Vdisplay_fill_column_indicator_column, Qt)) | ||
| 20169 | fill_column_indicator_column = | ||
| 20170 | XFIXNAT (BVAR (current_buffer, fill_column)); | ||
| 20171 | else | ||
| 20172 | fill_column_indicator_column = | ||
| 20173 | XFIXNAT (Vdisplay_fill_column_indicator_column); | ||
| 20174 | |||
| 20175 | struct font *font = | 20177 | struct font *font = |
| 20176 | default_face->font ? | 20178 | default_face->font ? |
| 20177 | default_face->font : FRAME_FONT (it->f); | 20179 | default_face->font : FRAME_FONT (it->f); |
| @@ -20179,18 +20181,19 @@ append_space_for_newline (struct it *it, bool default_face_p) | |||
| 20179 | font->average_width ? | 20181 | font->average_width ? |
| 20180 | font->average_width : font->space_width; | 20182 | font->average_width : font->space_width; |
| 20181 | 20183 | ||
| 20182 | const int column_x = | 20184 | int column_x; |
| 20183 | char_width * fill_column_indicator_column + | 20185 | if (!INT_MULTIPLY_WRAPV (indicator_column, char_width, |
| 20184 | it->lnum_pixel_width; | 20186 | &column_x) |
| 20185 | 20187 | && !INT_ADD_WRAPV (it->lnum_pixel_width, column_x, | |
| 20186 | if (it->current_x == column_x) | 20188 | &column_x) |
| 20189 | && it->current_x == column_x) | ||
| 20187 | { | 20190 | { |
| 20188 | it->c = it->char_to_display = | 20191 | it->c = it->char_to_display = |
| 20189 | XFIXNAT (Vdisplay_fill_column_indicator_character); | 20192 | XFIXNAT (Vdisplay_fill_column_indicator_character); |
| 20190 | it->face_id = | 20193 | it->face_id = |
| 20191 | merge_faces (it->w, Qfill_column_indicator, | 20194 | merge_faces (it->w, Qfill_column_indicator, |
| 20192 | 0, saved_face_id); | 20195 | 0, saved_face_id); |
| 20193 | face = FACE_FROM_ID(it->f, it->face_id); | 20196 | face = FACE_FROM_ID (it->f, it->face_id); |
| 20194 | goto produce_glyphs; | 20197 | goto produce_glyphs; |
| 20195 | } | 20198 | } |
| 20196 | } | 20199 | } |
| @@ -20422,30 +20425,22 @@ extend_face_to_end_of_line (struct it *it) | |||
| 20422 | /* Display fill column indicator if not in modeline or | 20425 | /* Display fill column indicator if not in modeline or |
| 20423 | toolbar and display fill column indicator mode is | 20426 | toolbar and display fill column indicator mode is |
| 20424 | active. */ | 20427 | active. */ |
| 20425 | if ((it->w->pseudo_window_p == 0) | 20428 | int indicator_column = (it->w->pseudo_window_p == 0 |
| 20426 | && FILL_COLUMN_INDICATOR_NEEDED(it)) | 20429 | ? fill_column_indicator_column (it) |
| 20430 | : -1); | ||
| 20431 | if (0 <= indicator_column) | ||
| 20427 | { | 20432 | { |
| 20428 | int fill_column_indicator_column = -1; | ||
| 20429 | |||
| 20430 | if (EQ (Vdisplay_fill_column_indicator_column, Qt)) | ||
| 20431 | fill_column_indicator_column = | ||
| 20432 | XFIXNAT (BVAR (current_buffer, fill_column)); | ||
| 20433 | else | ||
| 20434 | fill_column_indicator_column = | ||
| 20435 | XFIXNAT (Vdisplay_fill_column_indicator_column); | ||
| 20436 | |||
| 20437 | struct font *font = | 20433 | struct font *font = |
| 20438 | default_face->font ? default_face->font : FRAME_FONT (f); | 20434 | default_face->font ? default_face->font : FRAME_FONT (f); |
| 20439 | const int char_width = | 20435 | const int char_width = |
| 20440 | font->average_width ? | 20436 | font->average_width ? |
| 20441 | font->average_width : font->space_width; | 20437 | font->average_width : font->space_width; |
| 20442 | 20438 | ||
| 20443 | const int column_x = | 20439 | int column_x; |
| 20444 | char_width * fill_column_indicator_column + | 20440 | if (!INT_MULTIPLY_WRAPV (indicator_column, char_width, &column_x) |
| 20445 | it->lnum_pixel_width; | 20441 | && !INT_ADD_WRAPV (it->lnum_pixel_width, column_x, &column_x) |
| 20446 | 20442 | && it->current_x <= column_x | |
| 20447 | if ((it->current_x <= column_x) | 20443 | && column_x <= it->last_visible_x) |
| 20448 | && (column_x <= it->last_visible_x)) | ||
| 20449 | { | 20444 | { |
| 20450 | const char saved_char = it->char_to_display; | 20445 | const char saved_char = it->char_to_display; |
| 20451 | const struct text_pos saved_pos = it->position; | 20446 | const struct text_pos saved_pos = it->position; |
| @@ -20625,45 +20620,33 @@ extend_face_to_end_of_line (struct it *it) | |||
| 20625 | it->face_id = face->id; | 20620 | it->face_id = face->id; |
| 20626 | 20621 | ||
| 20627 | /* Display fill-column indicator if needed. */ | 20622 | /* Display fill-column indicator if needed. */ |
| 20628 | if (FILL_COLUMN_INDICATOR_NEEDED(it)) | 20623 | int indicator_column = fill_column_indicator_column (it); |
| 20624 | if (0 <= indicator_column | ||
| 20625 | && INT_ADD_WRAPV (it->lnum_pixel_width, indicator_column, | ||
| 20626 | &indicator_column)) | ||
| 20627 | indicator_column = -1; | ||
| 20628 | do | ||
| 20629 | { | 20629 | { |
| 20630 | int fill_column_indicator_column = -1; | 20630 | int saved_face_id; |
| 20631 | bool indicate = it->current_x == indicator_column; | ||
| 20632 | if (indicate) | ||
| 20633 | { | ||
| 20634 | saved_face_id = it->face_id; | ||
| 20635 | it->face_id = | ||
| 20636 | merge_faces (it->w, Qfill_column_indicator, 0, saved_face_id); | ||
| 20637 | it->c = it->char_to_display = | ||
| 20638 | XFIXNAT (Vdisplay_fill_column_indicator_character); | ||
| 20639 | } | ||
| 20631 | 20640 | ||
| 20632 | /* Vdisplay_fill_column_indicator_column accepts the special | 20641 | PRODUCE_GLYPHS (it); |
| 20633 | value t to use the default fill-column variable. The | ||
| 20634 | conditions are all defined in the macro | ||
| 20635 | FILL_COLUMN_INDICATOR_NEEDED. */ | ||
| 20636 | if (EQ (Vdisplay_fill_column_indicator_column, Qt)) | ||
| 20637 | fill_column_indicator_column = | ||
| 20638 | XFIXNAT (BVAR (current_buffer, fill_column)) + it->lnum_pixel_width; | ||
| 20639 | else | ||
| 20640 | fill_column_indicator_column = | ||
| 20641 | XFIXNAT (Vdisplay_fill_column_indicator_column) + it->lnum_pixel_width; | ||
| 20642 | 20642 | ||
| 20643 | do | 20643 | if (indicate) |
| 20644 | { | 20644 | { |
| 20645 | if (it->current_x == fill_column_indicator_column) | 20645 | it->face_id = saved_face_id; |
| 20646 | { | 20646 | it->c = it->char_to_display = ' '; |
| 20647 | const int saved_face_id = it->face_id; | 20647 | } |
| 20648 | it->face_id = | ||
| 20649 | merge_faces (it->w, Qfill_column_indicator, 0, saved_face_id); | ||
| 20650 | it->c = it->char_to_display = | ||
| 20651 | XFIXNAT (Vdisplay_fill_column_indicator_character); | ||
| 20652 | PRODUCE_GLYPHS (it); | ||
| 20653 | it->face_id = saved_face_id; | ||
| 20654 | it->c = it->char_to_display = ' '; | ||
| 20655 | } | ||
| 20656 | else | ||
| 20657 | PRODUCE_GLYPHS (it); | ||
| 20658 | } while (it->current_x <= it->last_visible_x); | ||
| 20659 | } | 20648 | } |
| 20660 | else | 20649 | while (it->current_x <= it->last_visible_x); |
| 20661 | { | ||
| 20662 | do | ||
| 20663 | { | ||
| 20664 | PRODUCE_GLYPHS (it); | ||
| 20665 | } while (it->current_x <= it->last_visible_x); | ||
| 20666 | } | ||
| 20667 | 20650 | ||
| 20668 | if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 | 20651 | if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 |
| 20669 | && (it->glyph_row->used[RIGHT_MARGIN_AREA] | 20652 | && (it->glyph_row->used[RIGHT_MARGIN_AREA] |