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/buffer.c | |
| 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/buffer.c')
| -rw-r--r-- | src/buffer.c | 22 |
1 files changed, 11 insertions, 11 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 | ||