diff options
| author | Dmitry Antipov | 2013-01-10 14:30:16 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-01-10 14:30:16 +0400 |
| commit | 58cc0a010b7e16dfcf03d7e858ea27eba5dece65 (patch) | |
| tree | c7df6a362013ac141d0cff69529052977b45e4b8 /src | |
| parent | 997d5f2d1d86acc55fa9b659ab69399c2968bbdc (diff) | |
| download | emacs-58cc0a010b7e16dfcf03d7e858ea27eba5dece65.tar.gz emacs-58cc0a010b7e16dfcf03d7e858ea27eba5dece65.zip | |
Omit buffer_slot_type_mismatch and use generic predicates to enforce
the type of per-buffer values where appropriate.
* src/lisp.h (struct Lisp_Buffer_Objfwd): Rename slottype member to
predicate, which is how it's really used now. Adjust comment.
* src/buffer.h (buffer_slot_type_mismatch): Remove prototype.
* src/buffer.c (buffer_slot_type_mismatch): Remove.
(DEFVAR_PER_BUFFER, defvar_per_buffer): Rename type argument to
predicate. Adjust comment.
(syms_of_buffer): Use Qsymbolp for major-mode. Use Qintegerp for
fill-column, left-margin, tab-width, buffer-saved-size,
left-margin-width, right-margin-width, left-fringe-width,
right-fringe-width, scroll-bar-width and buffer-display-count.
Use Qstringp for default-directory, buffer-file-name,
buffer-file-truename and buffer-auto-save-file-name. Use Qfloatp for
scroll-up-aggressively and scroll-down-aggressively. Use Qnumberp for
line-spacing.
* src/data.c (store_symval_forwarding): Adjust to call the predicate.
* lisp/cus-start.el (toplevel): Only allow float values for
scroll-up-aggressively and scroll-down-aggressively.
Allow any number for line-spacing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/buffer.c | 86 | ||||
| -rw-r--r-- | src/buffer.h | 1 | ||||
| -rw-r--r-- | src/data.c | 10 | ||||
| -rw-r--r-- | src/lisp.h | 3 |
5 files changed, 58 insertions, 62 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6ce141331ec..55a233adcd7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2013-01-10 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Omit buffer_slot_type_mismatch and use generic predicates to enforce | ||
| 4 | the type of per-buffer values where appropriate. | ||
| 5 | * lisp.h (struct Lisp_Buffer_Objfwd): Rename slottype member to | ||
| 6 | predicate, which is how it's really used now. Adjust comment. | ||
| 7 | * buffer.h (buffer_slot_type_mismatch): Remove prototype. | ||
| 8 | * buffer.c (buffer_slot_type_mismatch): Remove. | ||
| 9 | (DEFVAR_PER_BUFFER, defvar_per_buffer): Rename type argument to | ||
| 10 | predicate. Adjust comment. | ||
| 11 | (syms_of_buffer): Use Qsymbolp for major-mode. Use Qintegerp for | ||
| 12 | fill-column, left-margin, tab-width, buffer-saved-size, | ||
| 13 | left-margin-width, right-margin-width, left-fringe-width, | ||
| 14 | right-fringe-width, scroll-bar-width and buffer-display-count. | ||
| 15 | Use Qstringp for default-directory, buffer-file-name, | ||
| 16 | buffer-file-truename and buffer-auto-save-file-name. Use Qfloatp for | ||
| 17 | scroll-up-aggressively and scroll-down-aggressively. Use Qnumberp for | ||
| 18 | line-spacing. | ||
| 19 | * data.c (store_symval_forwarding): Adjust to call the predicate. | ||
| 20 | |||
| 1 | 2013-01-09 Juanma Barranquero <lekktu@gmail.com> | 21 | 2013-01-09 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 22 | ||
| 3 | * w32.c (get_name_and_id, acl_set_file): | 23 | * w32.c (get_name_and_id, acl_set_file): |
diff --git a/src/buffer.c b/src/buffer.c index 51c4d9c71da..218ae1a7d11 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4576,27 +4576,7 @@ evaporate_overlays (ptrdiff_t pos) | |||
| 4576 | for (; CONSP (hit_list); hit_list = XCDR (hit_list)) | 4576 | for (; CONSP (hit_list); hit_list = XCDR (hit_list)) |
| 4577 | Fdelete_overlay (XCAR (hit_list)); | 4577 | Fdelete_overlay (XCAR (hit_list)); |
| 4578 | } | 4578 | } |
| 4579 | |||
| 4580 | /* Somebody has tried to store a value with an unacceptable type | ||
| 4581 | in the slot with offset OFFSET. */ | ||
| 4582 | 4579 | ||
| 4583 | void | ||
| 4584 | buffer_slot_type_mismatch (Lisp_Object newval, int type) | ||
| 4585 | { | ||
| 4586 | Lisp_Object predicate; | ||
| 4587 | |||
| 4588 | switch (type) | ||
| 4589 | { | ||
| 4590 | case_Lisp_Int: predicate = Qintegerp; break; | ||
| 4591 | case Lisp_String: predicate = Qstringp; break; | ||
| 4592 | case Lisp_Symbol: predicate = Qsymbolp; break; | ||
| 4593 | default: emacs_abort (); | ||
| 4594 | } | ||
| 4595 | |||
| 4596 | wrong_type_argument (predicate, newval); | ||
| 4597 | } | ||
| 4598 | |||
| 4599 | |||
| 4600 | /*********************************************************************** | 4580 | /*********************************************************************** |
| 4601 | Allocation with mmap | 4581 | Allocation with mmap |
| 4602 | ***********************************************************************/ | 4582 | ***********************************************************************/ |
| @@ -5370,25 +5350,23 @@ init_buffer (void) | |||
| 5370 | free (pwd); | 5350 | free (pwd); |
| 5371 | } | 5351 | } |
| 5372 | 5352 | ||
| 5373 | /* Similar to defvar_lisp but define a variable whose value is the Lisp | 5353 | /* Similar to defvar_lisp but define a variable whose value is the |
| 5374 | Object stored in the current buffer. address is the address of the slot | 5354 | Lisp_Object stored in the current buffer. LNAME is the Lisp-level |
| 5375 | in the buffer that is current now. */ | 5355 | variable name. VNAME is the name of the buffer slot. PREDICATE |
| 5376 | 5356 | is nil for a general Lisp variable. If PREDICATE is non-nil, then | |
| 5377 | /* TYPE is nil for a general Lisp variable. | 5357 | only Lisp values that satisfies the PREDICATE are allowed (except |
| 5378 | An integer specifies a type; then only Lisp values | 5358 | that nil is allowed too). DOC is a dummy where you write the doc |
| 5379 | with that type code are allowed (except that nil is allowed too). | 5359 | string as a comment. */ |
| 5380 | LNAME is the Lisp-level variable name. | 5360 | |
| 5381 | VNAME is the name of the buffer slot. | 5361 | #define DEFVAR_PER_BUFFER(lname, vname, predicate, doc) \ |
| 5382 | DOC is a dummy where you write the doc string as a comment. */ | 5362 | do { \ |
| 5383 | #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ | 5363 | static struct Lisp_Buffer_Objfwd bo_fwd; \ |
| 5384 | do { \ | 5364 | defvar_per_buffer (&bo_fwd, lname, vname, predicate); \ |
| 5385 | static struct Lisp_Buffer_Objfwd bo_fwd; \ | ||
| 5386 | defvar_per_buffer (&bo_fwd, lname, vname, type); \ | ||
| 5387 | } while (0) | 5365 | } while (0) |
| 5388 | 5366 | ||
| 5389 | static void | 5367 | static void |
| 5390 | defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, | 5368 | defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, |
| 5391 | Lisp_Object *address, Lisp_Object type) | 5369 | Lisp_Object *address, Lisp_Object predicate) |
| 5392 | { | 5370 | { |
| 5393 | struct Lisp_Symbol *sym; | 5371 | struct Lisp_Symbol *sym; |
| 5394 | int offset; | 5372 | int offset; |
| @@ -5398,7 +5376,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, | |||
| 5398 | 5376 | ||
| 5399 | bo_fwd->type = Lisp_Fwd_Buffer_Obj; | 5377 | bo_fwd->type = Lisp_Fwd_Buffer_Obj; |
| 5400 | bo_fwd->offset = offset; | 5378 | bo_fwd->offset = offset; |
| 5401 | bo_fwd->slottype = type; | 5379 | bo_fwd->predicate = predicate; |
| 5402 | sym->declared_special = 1; | 5380 | sym->declared_special = 1; |
| 5403 | sym->redirect = SYMBOL_FORWARDED; | 5381 | sym->redirect = SYMBOL_FORWARDED; |
| 5404 | { | 5382 | { |
| @@ -5661,7 +5639,7 @@ Decimal digits after the % specify field width to which to pad. */); | |||
| 5661 | doc: /* Value of `major-mode' for new buffers. */); | 5639 | doc: /* Value of `major-mode' for new buffers. */); |
| 5662 | 5640 | ||
| 5663 | DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), | 5641 | DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), |
| 5664 | make_number (Lisp_Symbol), | 5642 | Qsymbolp, |
| 5665 | doc: /* Symbol for current buffer's major mode. | 5643 | doc: /* Symbol for current buffer's major mode. |
| 5666 | The default value (normally `fundamental-mode') affects new buffers. | 5644 | The default value (normally `fundamental-mode') affects new buffers. |
| 5667 | A value of nil means to use the current buffer's major mode, provided | 5645 | A value of nil means to use the current buffer's major mode, provided |
| @@ -5692,17 +5670,17 @@ Use the command `abbrev-mode' to change this variable. */); | |||
| 5692 | doc: /* Non-nil if searches and matches should ignore case. */); | 5670 | doc: /* Non-nil if searches and matches should ignore case. */); |
| 5693 | 5671 | ||
| 5694 | DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), | 5672 | DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), |
| 5695 | make_number (Lisp_Int0), | 5673 | Qintegerp, |
| 5696 | doc: /* Column beyond which automatic line-wrapping should happen. | 5674 | doc: /* Column beyond which automatic line-wrapping should happen. |
| 5697 | Interactively, you can set the buffer local value using \\[set-fill-column]. */); | 5675 | Interactively, you can set the buffer local value using \\[set-fill-column]. */); |
| 5698 | 5676 | ||
| 5699 | DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), | 5677 | DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), |
| 5700 | make_number (Lisp_Int0), | 5678 | Qintegerp, |
| 5701 | doc: /* Column for the default `indent-line-function' to indent to. | 5679 | doc: /* Column for the default `indent-line-function' to indent to. |
| 5702 | Linefeed indents to this column in Fundamental mode. */); | 5680 | Linefeed indents to this column in Fundamental mode. */); |
| 5703 | 5681 | ||
| 5704 | DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), | 5682 | DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), |
| 5705 | make_number (Lisp_Int0), | 5683 | Qintegerp, |
| 5706 | doc: /* Distance between tab stops (for display of tab characters), in columns. | 5684 | doc: /* Distance between tab stops (for display of tab characters), in columns. |
| 5707 | This should be an integer greater than zero. */); | 5685 | This should be an integer greater than zero. */); |
| 5708 | 5686 | ||
| @@ -5787,7 +5765,7 @@ visual lines rather than logical lines. See the documentation of | |||
| 5787 | `visual-line-mode'. */); | 5765 | `visual-line-mode'. */); |
| 5788 | 5766 | ||
| 5789 | DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), | 5767 | DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), |
| 5790 | make_number (Lisp_String), | 5768 | Qstringp, |
| 5791 | doc: /* Name of default directory of current buffer. Should end with slash. | 5769 | doc: /* Name of default directory of current buffer. Should end with slash. |
| 5792 | To interactively change the default directory, use command `cd'. */); | 5770 | To interactively change the default directory, use command `cd'. */); |
| 5793 | 5771 | ||
| @@ -5800,18 +5778,18 @@ NOTE: This variable is not a hook; | |||
| 5800 | its value may not be a list of functions. */); | 5778 | its value may not be a list of functions. */); |
| 5801 | 5779 | ||
| 5802 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), | 5780 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), |
| 5803 | make_number (Lisp_String), | 5781 | Qstringp, |
| 5804 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); | 5782 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); |
| 5805 | 5783 | ||
| 5806 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), | 5784 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), |
| 5807 | make_number (Lisp_String), | 5785 | Qstringp, |
| 5808 | doc: /* Abbreviated truename of file visited in current buffer, or nil if none. | 5786 | doc: /* Abbreviated truename of file visited in current buffer, or nil if none. |
| 5809 | The truename of a file is calculated by `file-truename' | 5787 | The truename of a file is calculated by `file-truename' |
| 5810 | and then abbreviated with `abbreviate-file-name'. */); | 5788 | and then abbreviated with `abbreviate-file-name'. */); |
| 5811 | 5789 | ||
| 5812 | DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", | 5790 | DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", |
| 5813 | &BVAR (current_buffer, auto_save_file_name), | 5791 | &BVAR (current_buffer, auto_save_file_name), |
| 5814 | make_number (Lisp_String), | 5792 | Qstringp, |
| 5815 | doc: /* Name of file for auto-saving current buffer. | 5793 | doc: /* Name of file for auto-saving current buffer. |
| 5816 | If it is nil, that means don't auto-save this buffer. */); | 5794 | If it is nil, that means don't auto-save this buffer. */); |
| 5817 | 5795 | ||
| @@ -5823,7 +5801,7 @@ If it is nil, that means don't auto-save this buffer. */); | |||
| 5823 | Backing up is done before the first time the file is saved. */); | 5801 | Backing up is done before the first time the file is saved. */); |
| 5824 | 5802 | ||
| 5825 | DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), | 5803 | DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), |
| 5826 | make_number (Lisp_Int0), | 5804 | Qintegerp, |
| 5827 | doc: /* Length of current buffer when last read in, saved or auto-saved. | 5805 | doc: /* Length of current buffer when last read in, saved or auto-saved. |
| 5828 | 0 initially. | 5806 | 0 initially. |
| 5829 | -1 means auto-saving turned off until next real save. | 5807 | -1 means auto-saving turned off until next real save. |
| @@ -5893,23 +5871,23 @@ In addition, a char-table has six extra slots to control the display of: | |||
| 5893 | See also the functions `display-table-slot' and `set-display-table-slot'. */); | 5871 | See also the functions `display-table-slot' and `set-display-table-slot'. */); |
| 5894 | 5872 | ||
| 5895 | DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), | 5873 | DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), |
| 5896 | Qnil, | 5874 | Qintegerp, |
| 5897 | doc: /* Width of left marginal area for display of a buffer. | 5875 | doc: /* Width of left marginal area for display of a buffer. |
| 5898 | A value of nil means no marginal area. */); | 5876 | A value of nil means no marginal area. */); |
| 5899 | 5877 | ||
| 5900 | DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), | 5878 | DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), |
| 5901 | Qnil, | 5879 | Qintegerp, |
| 5902 | doc: /* Width of right marginal area for display of a buffer. | 5880 | doc: /* Width of right marginal area for display of a buffer. |
| 5903 | A value of nil means no marginal area. */); | 5881 | A value of nil means no marginal area. */); |
| 5904 | 5882 | ||
| 5905 | DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), | 5883 | DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), |
| 5906 | Qnil, | 5884 | Qintegerp, |
| 5907 | doc: /* Width of this buffer's left fringe (in pixels). | 5885 | doc: /* Width of this buffer's left fringe (in pixels). |
| 5908 | A value of 0 means no left fringe is shown in this buffer's window. | 5886 | A value of 0 means no left fringe is shown in this buffer's window. |
| 5909 | A value of nil means to use the left fringe width from the window's frame. */); | 5887 | A value of nil means to use the left fringe width from the window's frame. */); |
| 5910 | 5888 | ||
| 5911 | DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), | 5889 | DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), |
| 5912 | Qnil, | 5890 | Qintegerp, |
| 5913 | doc: /* Width of this buffer's right fringe (in pixels). | 5891 | doc: /* Width of this buffer's right fringe (in pixels). |
| 5914 | A value of 0 means no right fringe is shown in this buffer's window. | 5892 | A value of 0 means no right fringe is shown in this buffer's window. |
| 5915 | A value of nil means to use the right fringe width from the window's frame. */); | 5893 | A value of nil means to use the right fringe width from the window's frame. */); |
| @@ -5920,7 +5898,7 @@ A value of nil means to use the right fringe width from the window's frame. */) | |||
| 5920 | A value of nil means to display fringes between margins and buffer text. */); | 5898 | A value of nil means to display fringes between margins and buffer text. */); |
| 5921 | 5899 | ||
| 5922 | DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), | 5900 | DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), |
| 5923 | Qnil, | 5901 | Qintegerp, |
| 5924 | doc: /* Width of this buffer's scroll bars in pixels. | 5902 | doc: /* Width of this buffer's scroll bars in pixels. |
| 5925 | A value of nil means to use the scroll bar width from the window's frame. */); | 5903 | A value of nil means to use the scroll bar width from the window's frame. */); |
| 5926 | 5904 | ||
| @@ -6000,7 +5978,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical | |||
| 6000 | cursor type. */); | 5978 | cursor type. */); |
| 6001 | 5979 | ||
| 6002 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", | 5980 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", |
| 6003 | &BVAR (current_buffer, scroll_up_aggressively), Qnil, | 5981 | &BVAR (current_buffer, scroll_up_aggressively), Qfloatp, |
| 6004 | doc: /* How far to scroll windows upward. | 5982 | doc: /* How far to scroll windows upward. |
| 6005 | If you move point off the bottom, the window scrolls automatically. | 5983 | If you move point off the bottom, the window scrolls automatically. |
| 6006 | This variable controls how far it scrolls. The value nil, the default, | 5984 | This variable controls how far it scrolls. The value nil, the default, |
| @@ -6013,7 +5991,7 @@ window scrolls by a full window height. Meaningful values are | |||
| 6013 | between 0.0 and 1.0, inclusive. */); | 5991 | between 0.0 and 1.0, inclusive. */); |
| 6014 | 5992 | ||
| 6015 | DEFVAR_PER_BUFFER ("scroll-down-aggressively", | 5993 | DEFVAR_PER_BUFFER ("scroll-down-aggressively", |
| 6016 | &BVAR (current_buffer, scroll_down_aggressively), Qnil, | 5994 | &BVAR (current_buffer, scroll_down_aggressively), Qfloatp, |
| 6017 | doc: /* How far to scroll windows downward. | 5995 | doc: /* How far to scroll windows downward. |
| 6018 | If you move point off the top, the window scrolls automatically. | 5996 | If you move point off the top, the window scrolls automatically. |
| 6019 | This variable controls how far it scrolls. The value nil, the default, | 5997 | This variable controls how far it scrolls. The value nil, the default, |
| @@ -6167,7 +6145,7 @@ then characters with property value PROP are invisible, | |||
| 6167 | and they have an ellipsis as well if ELLIPSIS is non-nil. */); | 6145 | and they have an ellipsis as well if ELLIPSIS is non-nil. */); |
| 6168 | 6146 | ||
| 6169 | DEFVAR_PER_BUFFER ("buffer-display-count", | 6147 | DEFVAR_PER_BUFFER ("buffer-display-count", |
| 6170 | &BVAR (current_buffer, display_count), Qnil, | 6148 | &BVAR (current_buffer, display_count), Qintegerp, |
| 6171 | doc: /* A number incremented each time this buffer is displayed in a window. | 6149 | doc: /* A number incremented each time this buffer is displayed in a window. |
| 6172 | The function `set-window-buffer' increments it. */); | 6150 | The function `set-window-buffer' increments it. */); |
| 6173 | 6151 | ||
| @@ -6226,7 +6204,7 @@ cursor's appearance is instead controlled by the variable | |||
| 6226 | `cursor-in-non-selected-windows'. */); | 6204 | `cursor-in-non-selected-windows'. */); |
| 6227 | 6205 | ||
| 6228 | DEFVAR_PER_BUFFER ("line-spacing", | 6206 | DEFVAR_PER_BUFFER ("line-spacing", |
| 6229 | &BVAR (current_buffer, extra_line_spacing), Qnil, | 6207 | &BVAR (current_buffer, extra_line_spacing), Qnumberp, |
| 6230 | doc: /* Additional space to put between lines when displaying a buffer. | 6208 | doc: /* Additional space to put between lines when displaying a buffer. |
| 6231 | The space is measured in pixels, and put below lines on graphic displays, | 6209 | The space is measured in pixels, and put below lines on graphic displays, |
| 6232 | see `display-graphic-p'. | 6210 | see `display-graphic-p'. |
diff --git a/src/buffer.h b/src/buffer.h index ec9c34b3eb3..b4cc21d675d 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -1078,7 +1078,6 @@ extern void set_buffer_internal_1 (struct buffer *); | |||
| 1078 | extern void set_buffer_temp (struct buffer *); | 1078 | extern void set_buffer_temp (struct buffer *); |
| 1079 | extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object); | 1079 | extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object); |
| 1080 | extern void record_buffer (Lisp_Object); | 1080 | extern void record_buffer (Lisp_Object); |
| 1081 | extern _Noreturn void buffer_slot_type_mismatch (Lisp_Object, int); | ||
| 1082 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); | 1081 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 1083 | extern void mmap_set_vars (bool); | 1082 | extern void mmap_set_vars (bool); |
| 1084 | 1083 | ||
diff --git a/src/data.c b/src/data.c index 50dc188684f..6622088b648 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -914,13 +914,11 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva | |||
| 914 | case Lisp_Fwd_Buffer_Obj: | 914 | case Lisp_Fwd_Buffer_Obj: |
| 915 | { | 915 | { |
| 916 | int offset = XBUFFER_OBJFWD (valcontents)->offset; | 916 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 917 | Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; | 917 | Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate; |
| 918 | 918 | ||
| 919 | if (!(NILP (type) || NILP (newval) | 919 | if (!NILP (predicate) && !NILP (newval) |
| 920 | || (XINT (type) == Lisp_Int0 | 920 | && NILP (call1 (predicate, newval))) |
| 921 | ? INTEGERP (newval) | 921 | wrong_type_argument (predicate, newval); |
| 922 | : XTYPE (newval) == XINT (type)))) | ||
| 923 | buffer_slot_type_mismatch (newval, XINT (type)); | ||
| 924 | 922 | ||
| 925 | if (buf == NULL) | 923 | if (buf == NULL) |
| 926 | buf = current_buffer; | 924 | buf = current_buffer; |
diff --git a/src/lisp.h b/src/lisp.h index a0dcc9ab5f3..8db61d3623a 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1450,7 +1450,8 @@ struct Lisp_Buffer_Objfwd | |||
| 1450 | { | 1450 | { |
| 1451 | enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */ | 1451 | enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */ |
| 1452 | int offset; | 1452 | int offset; |
| 1453 | Lisp_Object slottype; /* Qnil, Lisp_Int, Lisp_Symbol, or Lisp_String. */ | 1453 | /* One of Qnil, Qintegerp, Qsymbolp, Qstringp, Qfloatp or Qnumberp. */ |
| 1454 | Lisp_Object predicate; | ||
| 1454 | }; | 1455 | }; |
| 1455 | 1456 | ||
| 1456 | /* struct Lisp_Buffer_Local_Value is used in a symbol value cell when | 1457 | /* struct Lisp_Buffer_Local_Value is used in a symbol value cell when |