diff options
| author | Vitalie Spinu | 2016-03-21 05:41:55 +0100 |
|---|---|---|
| committer | Vitalie Spinu | 2016-03-22 03:16:17 +0100 |
| commit | c331b6626a427fb89303fea75faebd8c39d343a8 (patch) | |
| tree | f5cf4ee74164ed2b9fe2037d764be441e4b67175 /src/buffer.c | |
| parent | 91e667692ba1362ca1334b8d58fd16c305ad5e2a (diff) | |
| download | emacs-scratch/widen-limits.tar.gz emacs-scratch/widen-limits.zip | |
Implement buffer-widen-limits functionalityscratch/widen-limits
`widen` now respects restrictions imposed by new variable
`hard-widen-limits`
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c index f06d7e08e49..1b62d3a4d51 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -329,6 +329,11 @@ bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) | |||
| 329 | b->scroll_up_aggressively_ = val; | 329 | b->scroll_up_aggressively_ = val; |
| 330 | } | 330 | } |
| 331 | static void | 331 | static void |
| 332 | bset_widen_limits (struct buffer *b, Lisp_Object val) | ||
| 333 | { | ||
| 334 | b->widen_limits_ = val; | ||
| 335 | } | ||
| 336 | static void | ||
| 332 | bset_selective_display (struct buffer *b, Lisp_Object val) | 337 | bset_selective_display (struct buffer *b, Lisp_Object val) |
| 333 | { | 338 | { |
| 334 | b->selective_display_ = val; | 339 | b->selective_display_ = val; |
| @@ -847,6 +852,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 847 | bset_display_count (b, make_number (0)); | 852 | bset_display_count (b, make_number (0)); |
| 848 | bset_backed_up (b, Qnil); | 853 | bset_backed_up (b, Qnil); |
| 849 | bset_auto_save_file_name (b, Qnil); | 854 | bset_auto_save_file_name (b, Qnil); |
| 855 | bset_widen_limits (b, b->base_buffer->widen_limits_); | ||
| 850 | set_buffer_internal_1 (b); | 856 | set_buffer_internal_1 (b); |
| 851 | Fset (intern ("buffer-save-without-query"), Qnil); | 857 | Fset (intern ("buffer-save-without-query"), Qnil); |
| 852 | Fset (intern ("buffer-file-number"), Qnil); | 858 | Fset (intern ("buffer-file-number"), Qnil); |
| @@ -961,6 +967,7 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too) | |||
| 961 | things that depend on the major mode. | 967 | things that depend on the major mode. |
| 962 | default-major-mode is handled at a higher level. | 968 | default-major-mode is handled at a higher level. |
| 963 | We ignore it here. */ | 969 | We ignore it here. */ |
| 970 | bset_widen_limits(b, Qnil); | ||
| 964 | bset_major_mode (b, Qfundamental_mode); | 971 | bset_major_mode (b, Qfundamental_mode); |
| 965 | bset_keymap (b, Qnil); | 972 | bset_keymap (b, Qnil); |
| 966 | bset_mode_name (b, QSFundamental); | 973 | bset_mode_name (b, QSFundamental); |
| @@ -2167,7 +2174,7 @@ so the buffer is truly empty after this. */) | |||
| 2167 | { | 2174 | { |
| 2168 | Fwiden (); | 2175 | Fwiden (); |
| 2169 | 2176 | ||
| 2170 | del_range (BEG, Z); | 2177 | del_range (BEGWL, ZWL); |
| 2171 | 2178 | ||
| 2172 | current_buffer->last_window_start = 1; | 2179 | current_buffer->last_window_start = 1; |
| 2173 | /* Prevent warnings, or suspension of auto saving, that would happen | 2180 | /* Prevent warnings, or suspension of auto saving, that would happen |
| @@ -5037,6 +5044,7 @@ init_buffer_once (void) | |||
| 5037 | bset_display_count (&buffer_local_flags, make_number (-1)); | 5044 | bset_display_count (&buffer_local_flags, make_number (-1)); |
| 5038 | bset_display_time (&buffer_local_flags, make_number (-1)); | 5045 | bset_display_time (&buffer_local_flags, make_number (-1)); |
| 5039 | bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1)); | 5046 | bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1)); |
| 5047 | bset_widen_limits (&buffer_local_flags, make_number (-1)); | ||
| 5040 | 5048 | ||
| 5041 | /* These used to be stuck at 0 by default, but now that the all-zero value | 5049 | /* These used to be stuck at 0 by default, but now that the all-zero value |
| 5042 | means Qnil, we have to initialize them explicitly. */ | 5050 | means Qnil, we have to initialize them explicitly. */ |
| @@ -5160,6 +5168,7 @@ init_buffer_once (void) | |||
| 5160 | bset_cursor_type (&buffer_defaults, Qt); | 5168 | bset_cursor_type (&buffer_defaults, Qt); |
| 5161 | bset_extra_line_spacing (&buffer_defaults, Qnil); | 5169 | bset_extra_line_spacing (&buffer_defaults, Qnil); |
| 5162 | bset_cursor_in_non_selected_windows (&buffer_defaults, Qt); | 5170 | bset_cursor_in_non_selected_windows (&buffer_defaults, Qt); |
| 5171 | bset_widen_limits (&buffer_defaults, Qnil); | ||
| 5163 | 5172 | ||
| 5164 | bset_enable_multibyte_characters (&buffer_defaults, Qt); | 5173 | bset_enable_multibyte_characters (&buffer_defaults, Qt); |
| 5165 | bset_buffer_file_coding_system (&buffer_defaults, Qnil); | 5174 | bset_buffer_file_coding_system (&buffer_defaults, Qnil); |
| @@ -5367,7 +5376,6 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, | |||
| 5367 | emacs_abort (); | 5376 | emacs_abort (); |
| 5368 | } | 5377 | } |
| 5369 | 5378 | ||
| 5370 | |||
| 5371 | /* Initialize the buffer routines. */ | 5379 | /* Initialize the buffer routines. */ |
| 5372 | void | 5380 | void |
| 5373 | syms_of_buffer (void) | 5381 | syms_of_buffer (void) |
| @@ -5796,6 +5804,13 @@ If you set this to -2, that means don't turn off auto-saving in this buffer | |||
| 5796 | if its text size shrinks. If you use `buffer-swap-text' on a buffer, | 5804 | if its text size shrinks. If you use `buffer-swap-text' on a buffer, |
| 5797 | you probably should set this to -2 in that buffer. */); | 5805 | you probably should set this to -2 in that buffer. */); |
| 5798 | 5806 | ||
| 5807 | DEFVAR_PER_BUFFER ("buffer-widen-limits", &BVAR (current_buffer, widen_limits), | ||
| 5808 | Qnil, | ||
| 5809 | doc: /* When non-nil `widen` will widen to these limits. | ||
| 5810 | Must be a cons of the form (MIN . MAX) where MIN and MAX are integers | ||
| 5811 | of hard widen limits in this buffer. This is an experimental variable | ||
| 5812 | intended primarily for multi-mode engines. */); | ||
| 5813 | |||
| 5799 | DEFVAR_PER_BUFFER ("selective-display", &BVAR (current_buffer, selective_display), | 5814 | DEFVAR_PER_BUFFER ("selective-display", &BVAR (current_buffer, selective_display), |
| 5800 | Qnil, | 5815 | Qnil, |
| 5801 | doc: /* Non-nil enables selective display. | 5816 | doc: /* Non-nil enables selective display. |