aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorDmitry Antipov2014-07-16 12:45:22 +0400
committerDmitry Antipov2014-07-16 12:45:22 +0400
commite0b07ec3416d1ee7c77234e9dd0a7408b50da83c (patch)
tree430fc691f2cc593268fd1ada8defcec5b9c78ef4 /src/buffer.c
parent74660d84d923fd8252b166770ca2403f6025a7ac (diff)
downloademacs-e0b07ec3416d1ee7c77234e9dd0a7408b50da83c.tar.gz
emacs-e0b07ec3416d1ee7c77234e9dd0a7408b50da83c.zip
More precise control over values of some buffer-local variables.
* keyboard.c (Qvertical_scroll_bar): * frame.c (Qleft, Qright): Move to ... * buffer.c (Qleft, Qright, Qvertical_scroll_bar): ... here. * buffer.c (Qchoice, Qrange, Qoverwrite_mode, Qfraction): New symbols. (syms_of_buffer): DEFSYM all of the above, attach special properties. Use special symbols to DEFVAR_PER_BUFFER overwrite-mode, vertical-scroll-bar, scroll-up-aggressively and scroll-down-aggressively. * buffer.h (Qchoice, Qrange, Qleft, Qright, Qvertical_scroll_bar): Add declarations. * nsfns.m, frame.h (Qleft, Qright): * nsterm.m (Qleft): Remove declarations. * gtkutil.c (toplevel): Include buffer.h. * data.c (wrong_choice, wrong_range): New functions. (store_symval_forwarding): Handle special properties of buffer-local variables and use functions from the above to signal error, if any.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d6f6b2c7703..53cc25e2c8f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -145,6 +145,9 @@ Lisp_Object Qmodification_hooks;
145Lisp_Object Qinsert_in_front_hooks; 145Lisp_Object Qinsert_in_front_hooks;
146Lisp_Object Qinsert_behind_hooks; 146Lisp_Object Qinsert_behind_hooks;
147 147
148Lisp_Object Qchoice, Qrange, Qleft, Qright, Qvertical_scroll_bar;
149static Lisp_Object Qoverwrite_mode, Qfraction;
150
148static void alloc_buffer_text (struct buffer *, ptrdiff_t); 151static void alloc_buffer_text (struct buffer *, ptrdiff_t);
149static void free_buffer_text (struct buffer *b); 152static void free_buffer_text (struct buffer *b);
150static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); 153static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *);
@@ -5422,6 +5425,10 @@ syms_of_buffer (void)
5422 staticpro (&Qpermanent_local); 5425 staticpro (&Qpermanent_local);
5423 staticpro (&Qkill_buffer_hook); 5426 staticpro (&Qkill_buffer_hook);
5424 5427
5428 DEFSYM (Qleft, "left");
5429 DEFSYM (Qright, "right");
5430 DEFSYM (Qrange, "range");
5431
5425 DEFSYM (Qpermanent_local_hook, "permanent-local-hook"); 5432 DEFSYM (Qpermanent_local_hook, "permanent-local-hook");
5426 DEFSYM (Qoverlayp, "overlayp"); 5433 DEFSYM (Qoverlayp, "overlayp");
5427 DEFSYM (Qevaporate, "evaporate"); 5434 DEFSYM (Qevaporate, "evaporate");
@@ -5437,6 +5444,17 @@ syms_of_buffer (void)
5437 DEFSYM (Qafter_change_functions, "after-change-functions"); 5444 DEFSYM (Qafter_change_functions, "after-change-functions");
5438 DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); 5445 DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions");
5439 5446
5447 DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar");
5448 Fput (Qvertical_scroll_bar, Qchoice, list4 (Qnil, Qt, Qleft, Qright));
5449
5450 DEFSYM (Qfraction, "fraction");
5451 Fput (Qfraction, Qrange, Fcons (make_float (0.0), make_float (1.0)));
5452
5453 DEFSYM (Qoverwrite_mode, "overwrite-mode");
5454 Fput (Qoverwrite_mode, Qchoice,
5455 list3 (Qnil, intern ("overwrite-mode-textual"),
5456 intern ("overwrite-mode-binary")));
5457
5440 Fput (Qprotected_field, Qerror_conditions, 5458 Fput (Qprotected_field, Qerror_conditions,
5441 listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); 5459 listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror));
5442 Fput (Qprotected_field, Qerror_message, 5460 Fput (Qprotected_field, Qerror_message,
@@ -5842,7 +5860,8 @@ in a file, save the ^M as a newline. */);
5842 Qnil, 5860 Qnil,
5843 doc: /* Non-nil means display ... on previous line when a line is invisible. */); 5861 doc: /* Non-nil means display ... on previous line when a line is invisible. */);
5844 5862
5845 DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, 5863 DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode),
5864 Qoverwrite_mode,
5846 doc: /* Non-nil if self-insertion should replace existing text. 5865 doc: /* Non-nil if self-insertion should replace existing text.
5847The value should be one of `overwrite-mode-textual', 5866The value should be one of `overwrite-mode-textual',
5848`overwrite-mode-binary', or nil. 5867`overwrite-mode-binary', or nil.
@@ -5936,7 +5955,7 @@ in a window. To make the change take effect, call `set-window-buffer'. */);
5936A value of nil means to use the scroll bar width from the window's frame. */); 5955A value of nil means to use the scroll bar width from the window's frame. */);
5937 5956
5938 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), 5957 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),
5939 Qnil, 5958 Qvertical_scroll_bar,
5940 doc: /* Position of this buffer's vertical scroll bar. 5959 doc: /* Position of this buffer's vertical scroll bar.
5941The value takes effect whenever you tell a window to display this buffer; 5960The value takes effect whenever you tell a window to display this buffer;
5942for instance, with `set-window-buffer' or when `display-buffer' displays it. 5961for instance, with `set-window-buffer' or when `display-buffer' displays it.
@@ -6011,7 +6030,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical
6011cursor type. */); 6030cursor type. */);
6012 6031
6013 DEFVAR_PER_BUFFER ("scroll-up-aggressively", 6032 DEFVAR_PER_BUFFER ("scroll-up-aggressively",
6014 &BVAR (current_buffer, scroll_up_aggressively), Qfloatp, 6033 &BVAR (current_buffer, scroll_up_aggressively), Qfraction,
6015 doc: /* How far to scroll windows upward. 6034 doc: /* How far to scroll windows upward.
6016If you move point off the bottom, the window scrolls automatically. 6035If you move point off the bottom, the window scrolls automatically.
6017This variable controls how far it scrolls. The value nil, the default, 6036This variable controls how far it scrolls. The value nil, the default,
@@ -6024,7 +6043,7 @@ window scrolls by a full window height. Meaningful values are
6024between 0.0 and 1.0, inclusive. */); 6043between 0.0 and 1.0, inclusive. */);
6025 6044
6026 DEFVAR_PER_BUFFER ("scroll-down-aggressively", 6045 DEFVAR_PER_BUFFER ("scroll-down-aggressively",
6027 &BVAR (current_buffer, scroll_down_aggressively), Qfloatp, 6046 &BVAR (current_buffer, scroll_down_aggressively), Qfraction,
6028 doc: /* How far to scroll windows downward. 6047 doc: /* How far to scroll windows downward.
6029If you move point off the top, the window scrolls automatically. 6048If you move point off the top, the window scrolls automatically.
6030This variable controls how far it scrolls. The value nil, the default, 6049This variable controls how far it scrolls. The value nil, the default,