diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 67 |
1 files changed, 63 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c index 541fa832297..4eddd7029cc 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -148,6 +148,10 @@ Lisp_Object Qmodification_hooks; | |||
| 148 | Lisp_Object Qinsert_in_front_hooks; | 148 | Lisp_Object Qinsert_in_front_hooks; |
| 149 | Lisp_Object Qinsert_behind_hooks; | 149 | Lisp_Object Qinsert_behind_hooks; |
| 150 | 150 | ||
| 151 | Lisp_Object Qchoice, Qrange, Qleft, Qright; | ||
| 152 | Lisp_Object Qvertical_scroll_bar, Qhorizontal_scroll_bar; | ||
| 153 | static Lisp_Object Qoverwrite_mode, Qfraction; | ||
| 154 | |||
| 151 | static void alloc_buffer_text (struct buffer *, ptrdiff_t); | 155 | static void alloc_buffer_text (struct buffer *, ptrdiff_t); |
| 152 | static void free_buffer_text (struct buffer *b); | 156 | static void free_buffer_text (struct buffer *b); |
| 153 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); | 157 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); |
| @@ -343,6 +347,11 @@ bset_scroll_bar_width (struct buffer *b, Lisp_Object val) | |||
| 343 | b->INTERNAL_FIELD (scroll_bar_width) = val; | 347 | b->INTERNAL_FIELD (scroll_bar_width) = val; |
| 344 | } | 348 | } |
| 345 | static void | 349 | static void |
| 350 | bset_scroll_bar_height (struct buffer *b, Lisp_Object val) | ||
| 351 | { | ||
| 352 | b->INTERNAL_FIELD (scroll_bar_height) = val; | ||
| 353 | } | ||
| 354 | static void | ||
| 346 | bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) | 355 | bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) |
| 347 | { | 356 | { |
| 348 | b->INTERNAL_FIELD (scroll_down_aggressively) = val; | 357 | b->INTERNAL_FIELD (scroll_down_aggressively) = val; |
| @@ -368,6 +377,11 @@ bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) | |||
| 368 | b->INTERNAL_FIELD (vertical_scroll_bar_type) = val; | 377 | b->INTERNAL_FIELD (vertical_scroll_bar_type) = val; |
| 369 | } | 378 | } |
| 370 | static void | 379 | static void |
| 380 | bset_horizontal_scroll_bar_type (struct buffer *b, Lisp_Object val) | ||
| 381 | { | ||
| 382 | b->INTERNAL_FIELD (horizontal_scroll_bar_type) = val; | ||
| 383 | } | ||
| 384 | static void | ||
| 371 | bset_word_wrap (struct buffer *b, Lisp_Object val) | 385 | bset_word_wrap (struct buffer *b, Lisp_Object val) |
| 372 | { | 386 | { |
| 373 | b->INTERNAL_FIELD (word_wrap) = val; | 387 | b->INTERNAL_FIELD (word_wrap) = val; |
| @@ -2434,6 +2448,14 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2434 | make_number | 2448 | make_number |
| 2435 | (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))), | 2449 | (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))), |
| 2436 | XWINDOW (w)->contents); | 2450 | XWINDOW (w)->contents); |
| 2451 | /* Blindly copied from pointm part. */ | ||
| 2452 | if (MARKERP (XWINDOW (w)->old_pointm) | ||
| 2453 | && (EQ (XWINDOW (w)->contents, buf1) | ||
| 2454 | || EQ (XWINDOW (w)->contents, buf2))) | ||
| 2455 | Fset_marker (XWINDOW (w)->old_pointm, | ||
| 2456 | make_number | ||
| 2457 | (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))), | ||
| 2458 | XWINDOW (w)->contents); | ||
| 2437 | if (MARKERP (XWINDOW (w)->start) | 2459 | if (MARKERP (XWINDOW (w)->start) |
| 2438 | && (EQ (XWINDOW (w)->contents, buf1) | 2460 | && (EQ (XWINDOW (w)->contents, buf1) |
| 2439 | || EQ (XWINDOW (w)->contents, buf2))) | 2461 | || EQ (XWINDOW (w)->contents, buf2))) |
| @@ -5162,7 +5184,9 @@ init_buffer_once (void) | |||
| 5162 | bset_right_fringe_width (&buffer_defaults, Qnil); | 5184 | bset_right_fringe_width (&buffer_defaults, Qnil); |
| 5163 | bset_fringes_outside_margins (&buffer_defaults, Qnil); | 5185 | bset_fringes_outside_margins (&buffer_defaults, Qnil); |
| 5164 | bset_scroll_bar_width (&buffer_defaults, Qnil); | 5186 | bset_scroll_bar_width (&buffer_defaults, Qnil); |
| 5187 | bset_scroll_bar_height (&buffer_defaults, Qnil); | ||
| 5165 | bset_vertical_scroll_bar_type (&buffer_defaults, Qt); | 5188 | bset_vertical_scroll_bar_type (&buffer_defaults, Qt); |
| 5189 | bset_horizontal_scroll_bar_type (&buffer_defaults, Qt); | ||
| 5166 | bset_indicate_empty_lines (&buffer_defaults, Qnil); | 5190 | bset_indicate_empty_lines (&buffer_defaults, Qnil); |
| 5167 | bset_indicate_buffer_boundaries (&buffer_defaults, Qnil); | 5191 | bset_indicate_buffer_boundaries (&buffer_defaults, Qnil); |
| 5168 | bset_fringe_indicator_alist (&buffer_defaults, Qnil); | 5192 | bset_fringe_indicator_alist (&buffer_defaults, Qnil); |
| @@ -5230,7 +5254,9 @@ init_buffer_once (void) | |||
| 5230 | XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx; | 5254 | XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx; |
| 5231 | XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx; | 5255 | XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx; |
| 5232 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx; | 5256 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx; |
| 5257 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_height), idx); ++idx; | ||
| 5233 | XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; | 5258 | XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; |
| 5259 | XSETFASTINT (BVAR (&buffer_local_flags, horizontal_scroll_bar_type), idx); ++idx; | ||
| 5234 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx; | 5260 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx; |
| 5235 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; | 5261 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; |
| 5236 | XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; | 5262 | XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; |
| @@ -5430,6 +5456,10 @@ syms_of_buffer (void) | |||
| 5430 | staticpro (&Qpermanent_local); | 5456 | staticpro (&Qpermanent_local); |
| 5431 | staticpro (&Qkill_buffer_hook); | 5457 | staticpro (&Qkill_buffer_hook); |
| 5432 | 5458 | ||
| 5459 | DEFSYM (Qleft, "left"); | ||
| 5460 | DEFSYM (Qright, "right"); | ||
| 5461 | DEFSYM (Qrange, "range"); | ||
| 5462 | |||
| 5433 | DEFSYM (Qpermanent_local_hook, "permanent-local-hook"); | 5463 | DEFSYM (Qpermanent_local_hook, "permanent-local-hook"); |
| 5434 | DEFSYM (Qoverlayp, "overlayp"); | 5464 | DEFSYM (Qoverlayp, "overlayp"); |
| 5435 | DEFSYM (Qevaporate, "evaporate"); | 5465 | DEFSYM (Qevaporate, "evaporate"); |
| @@ -5445,6 +5475,18 @@ syms_of_buffer (void) | |||
| 5445 | DEFSYM (Qafter_change_functions, "after-change-functions"); | 5475 | DEFSYM (Qafter_change_functions, "after-change-functions"); |
| 5446 | DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); | 5476 | DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); |
| 5447 | 5477 | ||
| 5478 | DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar"); | ||
| 5479 | Fput (Qvertical_scroll_bar, Qchoice, list4 (Qnil, Qt, Qleft, Qright)); | ||
| 5480 | DEFSYM (Qhorizontal_scroll_bar, "horizontal-scroll-bar"); | ||
| 5481 | |||
| 5482 | DEFSYM (Qfraction, "fraction"); | ||
| 5483 | Fput (Qfraction, Qrange, Fcons (make_float (0.0), make_float (1.0))); | ||
| 5484 | |||
| 5485 | DEFSYM (Qoverwrite_mode, "overwrite-mode"); | ||
| 5486 | Fput (Qoverwrite_mode, Qchoice, | ||
| 5487 | list3 (Qnil, intern ("overwrite-mode-textual"), | ||
| 5488 | intern ("overwrite-mode-binary"))); | ||
| 5489 | |||
| 5448 | Fput (Qprotected_field, Qerror_conditions, | 5490 | Fput (Qprotected_field, Qerror_conditions, |
| 5449 | listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); | 5491 | listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); |
| 5450 | Fput (Qprotected_field, Qerror_message, | 5492 | Fput (Qprotected_field, Qerror_message, |
| @@ -5850,7 +5892,8 @@ in a file, save the ^M as a newline. */); | |||
| 5850 | Qnil, | 5892 | Qnil, |
| 5851 | doc: /* Non-nil means display ... on previous line when a line is invisible. */); | 5893 | doc: /* Non-nil means display ... on previous line when a line is invisible. */); |
| 5852 | 5894 | ||
| 5853 | DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, | 5895 | DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), |
| 5896 | Qoverwrite_mode, | ||
| 5854 | doc: /* Non-nil if self-insertion should replace existing text. | 5897 | doc: /* Non-nil if self-insertion should replace existing text. |
| 5855 | The value should be one of `overwrite-mode-textual', | 5898 | The value should be one of `overwrite-mode-textual', |
| 5856 | `overwrite-mode-binary', or nil. | 5899 | `overwrite-mode-binary', or nil. |
| @@ -5943,8 +5986,13 @@ in a window. To make the change take effect, call `set-window-buffer'. */); | |||
| 5943 | doc: /* Width of this buffer's scroll bars in pixels. | 5986 | doc: /* Width of this buffer's scroll bars in pixels. |
| 5944 | A value of nil means to use the scroll bar width from the window's frame. */); | 5987 | A value of nil means to use the scroll bar width from the window's frame. */); |
| 5945 | 5988 | ||
| 5989 | DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height), | ||
| 5990 | Qintegerp, | ||
| 5991 | doc: /* Height of this buffer's scroll bars in pixels. | ||
| 5992 | A value of nil means to use the scroll bar heiht from the window's frame. */); | ||
| 5993 | |||
| 5946 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), | 5994 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), |
| 5947 | Qnil, | 5995 | Qvertical_scroll_bar, |
| 5948 | doc: /* Position of this buffer's vertical scroll bar. | 5996 | doc: /* Position of this buffer's vertical scroll bar. |
| 5949 | The value takes effect whenever you tell a window to display this buffer; | 5997 | The value takes effect whenever you tell a window to display this buffer; |
| 5950 | for instance, with `set-window-buffer' or when `display-buffer' displays it. | 5998 | for instance, with `set-window-buffer' or when `display-buffer' displays it. |
| @@ -5953,6 +6001,17 @@ A value of `left' or `right' means put the vertical scroll bar at that side | |||
| 5953 | of the window; a value of nil means don't show any vertical scroll bars. | 6001 | of the window; a value of nil means don't show any vertical scroll bars. |
| 5954 | A value of t (the default) means do whatever the window's frame specifies. */); | 6002 | A value of t (the default) means do whatever the window's frame specifies. */); |
| 5955 | 6003 | ||
| 6004 | DEFVAR_PER_BUFFER ("horizontal-scroll-bar", &BVAR (current_buffer, horizontal_scroll_bar_type), | ||
| 6005 | Qnil, | ||
| 6006 | doc: /* Position of this buffer's horizontal scroll bar. | ||
| 6007 | The value takes effect whenever you tell a window to display this buffer; | ||
| 6008 | for instance, with `set-window-buffer' or when `display-buffer' displays it. | ||
| 6009 | |||
| 6010 | A value of `bottom' means put the horizontal scroll bar at the bottom of | ||
| 6011 | the window; a value of nil means don't show any horizonal scroll bars. | ||
| 6012 | A value of t (the default) means do whatever the window's frame | ||
| 6013 | specifies. */); | ||
| 6014 | |||
| 5956 | DEFVAR_PER_BUFFER ("indicate-empty-lines", | 6015 | DEFVAR_PER_BUFFER ("indicate-empty-lines", |
| 5957 | &BVAR (current_buffer, indicate_empty_lines), Qnil, | 6016 | &BVAR (current_buffer, indicate_empty_lines), Qnil, |
| 5958 | doc: /* Visually indicate empty lines after the buffer end. | 6017 | doc: /* Visually indicate empty lines after the buffer end. |
| @@ -6019,7 +6078,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical | |||
| 6019 | cursor type. */); | 6078 | cursor type. */); |
| 6020 | 6079 | ||
| 6021 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", | 6080 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", |
| 6022 | &BVAR (current_buffer, scroll_up_aggressively), Qfloatp, | 6081 | &BVAR (current_buffer, scroll_up_aggressively), Qfraction, |
| 6023 | doc: /* How far to scroll windows upward. | 6082 | doc: /* How far to scroll windows upward. |
| 6024 | If you move point off the bottom, the window scrolls automatically. | 6083 | If you move point off the bottom, the window scrolls automatically. |
| 6025 | This variable controls how far it scrolls. The value nil, the default, | 6084 | This variable controls how far it scrolls. The value nil, the default, |
| @@ -6032,7 +6091,7 @@ window scrolls by a full window height. Meaningful values are | |||
| 6032 | between 0.0 and 1.0, inclusive. */); | 6091 | between 0.0 and 1.0, inclusive. */); |
| 6033 | 6092 | ||
| 6034 | DEFVAR_PER_BUFFER ("scroll-down-aggressively", | 6093 | DEFVAR_PER_BUFFER ("scroll-down-aggressively", |
| 6035 | &BVAR (current_buffer, scroll_down_aggressively), Qfloatp, | 6094 | &BVAR (current_buffer, scroll_down_aggressively), Qfraction, |
| 6036 | doc: /* How far to scroll windows downward. | 6095 | doc: /* How far to scroll windows downward. |
| 6037 | If you move point off the top, the window scrolls automatically. | 6096 | If you move point off the top, the window scrolls automatically. |
| 6038 | This variable controls how far it scrolls. The value nil, the default, | 6097 | This variable controls how far it scrolls. The value nil, the default, |