aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c73
1 files changed, 33 insertions, 40 deletions
diff --git a/src/buffer.c b/src/buffer.c
index acee3c45158..8cb68317bed 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,6 +1,6 @@
1/* Buffer manipulation primitives for GNU Emacs. 1/* Buffer manipulation primitives for GNU Emacs.
2 2
3Copyright (C) 1985-1989, 1993-1995, 1997-2012 Free Software Foundation, Inc. 3Copyright (C) 1985-1989, 1993-1995, 1997-2012 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -128,7 +128,6 @@ static Lisp_Object Qchange_major_mode_hook;
128Lisp_Object Qfirst_change_hook; 128Lisp_Object Qfirst_change_hook;
129Lisp_Object Qbefore_change_functions; 129Lisp_Object Qbefore_change_functions;
130Lisp_Object Qafter_change_functions; 130Lisp_Object Qafter_change_functions;
131static Lisp_Object Qucs_set_table_for_input;
132 131
133static Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; 132static Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local;
134static Lisp_Object Qpermanent_local_hook; 133static Lisp_Object Qpermanent_local_hook;
@@ -402,13 +401,6 @@ even if it is dead. The return value is never nil. */)
402 if (!NILP (Vrun_hooks)) 401 if (!NILP (Vrun_hooks))
403 call1 (Vrun_hooks, Qbuffer_list_update_hook); 402 call1 (Vrun_hooks, Qbuffer_list_update_hook);
404 403
405 /* An error in calling the function here (should someone redefine it)
406 can lead to infinite regress until you run out of stack. rms
407 says that's not worth protecting against. */
408 if (!NILP (Ffboundp (Qucs_set_table_for_input)))
409 /* buffer is on buffer-alist, so no gcpro. */
410 call1 (Qucs_set_table_for_input, buffer);
411
412 return buffer; 404 return buffer;
413} 405}
414 406
@@ -1717,7 +1709,7 @@ record_buffer (Lisp_Object buffer)
1717/* Move BUFFER to the end of the buffer (a)lists. Do nothing if the 1709/* Move BUFFER to the end of the buffer (a)lists. Do nothing if the
1718 buffer is killed. For the selected frame's buffer list this moves 1710 buffer is killed. For the selected frame's buffer list this moves
1719 BUFFER to its end even if it was never shown in that frame. If 1711 BUFFER to its end even if it was never shown in that frame. If
1720 this happens we have a feature, hence `unrecord-buffer' should be 1712 this happens we have a feature, hence `bury-buffer-internal' should be
1721 called only when BUFFER was shown in the selected frame. */ 1713 called only when BUFFER was shown in the selected frame. */
1722 1714
1723DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal, 1715DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal,
@@ -2863,6 +2855,12 @@ compare_overlays (const void *v1, const void *v2)
2863 return s1->beg < s2->beg ? -1 : 1; 2855 return s1->beg < s2->beg ? -1 : 1;
2864 if (s1->end != s2->end) 2856 if (s1->end != s2->end)
2865 return s2->end < s1->end ? -1 : 1; 2857 return s2->end < s1->end ? -1 : 1;
2858 /* Avoid the non-determinism of qsort by choosing an arbitrary ordering
2859 between "equal" overlays. The result can still change between
2860 invocations of Emacs, but it won't change in the middle of
2861 `find_field' (bug#6830). */
2862 if (XHASH (s1->overlay) != XHASH (s2->overlay))
2863 return XHASH (s1->overlay) < XHASH (s2->overlay) ? -1 : 1;
2866 return 0; 2864 return 0;
2867} 2865}
2868 2866
@@ -5036,8 +5034,6 @@ init_buffer_once (void)
5036 Qkill_buffer_hook = intern_c_string ("kill-buffer-hook"); 5034 Qkill_buffer_hook = intern_c_string ("kill-buffer-hook");
5037 Fput (Qkill_buffer_hook, Qpermanent_local, Qt); 5035 Fput (Qkill_buffer_hook, Qpermanent_local, Qt);
5038 5036
5039 Qucs_set_table_for_input = intern_c_string ("ucs-set-table-for-input");
5040
5041 /* super-magic invisible buffer */ 5037 /* super-magic invisible buffer */
5042 Vprin1_to_string_buffer = Fget_buffer_create (make_pure_c_string (" prin1")); 5038 Vprin1_to_string_buffer = Fget_buffer_create (make_pure_c_string (" prin1"));
5043 Vbuffer_alist = Qnil; 5039 Vbuffer_alist = Qnil;
@@ -5193,9 +5189,6 @@ syms_of_buffer (void)
5193 DEFSYM (Qafter_change_functions, "after-change-functions"); 5189 DEFSYM (Qafter_change_functions, "after-change-functions");
5194 DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); 5190 DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions");
5195 5191
5196 /* The next one is initialized in init_buffer_once. */
5197 staticpro (&Qucs_set_table_for_input);
5198
5199 Fput (Qprotected_field, Qerror_conditions, 5192 Fput (Qprotected_field, Qerror_conditions,
5200 pure_cons (Qprotected_field, pure_cons (Qerror, Qnil))); 5193 pure_cons (Qprotected_field, pure_cons (Qerror, Qnil)));
5201 Fput (Qprotected_field, Qerror_message, 5194 Fput (Qprotected_field, Qerror_message,
@@ -5237,7 +5230,7 @@ This is the same as (default-value 'ctl-arrow). */);
5237 5230
5238 DEFVAR_BUFFER_DEFAULTS ("default-enable-multibyte-characters", 5231 DEFVAR_BUFFER_DEFAULTS ("default-enable-multibyte-characters",
5239 enable_multibyte_characters, 5232 enable_multibyte_characters,
5240 doc: /* *Default value of `enable-multibyte-characters' for buffers not overriding it. 5233 doc: /* Default value of `enable-multibyte-characters' for buffers not overriding it.
5241This is the same as (default-value 'enable-multibyte-characters). */); 5234This is the same as (default-value 'enable-multibyte-characters). */);
5242 5235
5243 DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-coding-system", 5236 DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-coding-system",
@@ -5399,7 +5392,7 @@ A string is printed verbatim in the mode line except for %-constructs:
5399Decimal digits after the % specify field width to which to pad. */); 5392Decimal digits after the % specify field width to which to pad. */);
5400 5393
5401 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, 5394 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode,
5402 doc: /* *Value of `major-mode' for new buffers. */); 5395 doc: /* Value of `major-mode' for new buffers. */);
5403 5396
5404 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), 5397 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode),
5405 make_number (Lisp_Symbol), 5398 make_number (Lisp_Symbol),
@@ -5430,25 +5423,25 @@ Use the command `abbrev-mode' to change this variable. */);
5430 5423
5431 DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search), 5424 DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search),
5432 Qnil, 5425 Qnil,
5433 doc: /* *Non-nil if searches and matches should ignore case. */); 5426 doc: /* Non-nil if searches and matches should ignore case. */);
5434 5427
5435 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), 5428 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
5436 make_number (LISP_INT_TAG), 5429 make_number (LISP_INT_TAG),
5437 doc: /* *Column beyond which automatic line-wrapping should happen. 5430 doc: /* Column beyond which automatic line-wrapping should happen.
5438Interactively, you can set the buffer local value using \\[set-fill-column]. */); 5431Interactively, you can set the buffer local value using \\[set-fill-column]. */);
5439 5432
5440 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), 5433 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
5441 make_number (LISP_INT_TAG), 5434 make_number (LISP_INT_TAG),
5442 doc: /* *Column for the default `indent-line-function' to indent to. 5435 doc: /* Column for the default `indent-line-function' to indent to.
5443Linefeed indents to this column in Fundamental mode. */); 5436Linefeed indents to this column in Fundamental mode. */);
5444 5437
5445 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), 5438 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
5446 make_number (LISP_INT_TAG), 5439 make_number (LISP_INT_TAG),
5447 doc: /* *Distance between tab stops (for display of tab characters), in columns. 5440 doc: /* Distance between tab stops (for display of tab characters), in columns.
5448This should be an integer greater than zero. */); 5441This should be an integer greater than zero. */);
5449 5442
5450 DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil, 5443 DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil,
5451 doc: /* *Non-nil means display control chars with uparrow. 5444 doc: /* Non-nil means display control chars with uparrow.
5452A value of nil means use backslash and octal digits. 5445A value of nil means use backslash and octal digits.
5453This variable does not apply to characters whose display is specified 5446This variable does not apply to characters whose display is specified
5454in the current display table (if there is one). */); 5447in the current display table (if there is one). */);
@@ -5489,7 +5482,7 @@ This variable is never applied to a way of decoding a file while reading it. */
5489 5482
5490 DEFVAR_PER_BUFFER ("bidi-paragraph-direction", 5483 DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
5491 &BVAR (current_buffer, bidi_paragraph_direction), Qnil, 5484 &BVAR (current_buffer, bidi_paragraph_direction), Qnil,
5492 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. 5485 doc: /* If non-nil, forces directionality of text paragraphs in the buffer.
5493 5486
5494If this is nil (the default), the direction of each paragraph is 5487If this is nil (the default), the direction of each paragraph is
5495determined by the first strong directional character of its text. 5488determined by the first strong directional character of its text.
@@ -5500,7 +5493,7 @@ This variable has no effect unless the buffer's value of
5500\`bidi-display-reordering' is non-nil. */); 5493\`bidi-display-reordering' is non-nil. */);
5501 5494
5502 DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil, 5495 DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil,
5503 doc: /* *Non-nil means do not display continuation lines. 5496 doc: /* Non-nil means do not display continuation lines.
5504Instead, give each line of text just one screen line. 5497Instead, give each line of text just one screen line.
5505 5498
5506Note that this is overridden by the variable 5499Note that this is overridden by the variable
@@ -5510,7 +5503,7 @@ and this buffer is not full-frame width.
5510Minibuffers set this variable to nil. */); 5503Minibuffers set this variable to nil. */);
5511 5504
5512 DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, 5505 DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil,
5513 doc: /* *Non-nil means to use word-wrapping for continuation lines. 5506 doc: /* Non-nil means to use word-wrapping for continuation lines.
5514When word-wrapping is on, continuation lines are wrapped at the space 5507When word-wrapping is on, continuation lines are wrapped at the space
5515or tab character nearest to the right window edge. 5508or tab character nearest to the right window edge.
5516If nil, continuation lines are wrapped at the right screen edge. 5509If nil, continuation lines are wrapped at the right screen edge.
@@ -5631,39 +5624,39 @@ See also the functions `display-table-slot' and `set-display-table-slot'. */);
5631 5624
5632 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), 5625 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols),
5633 Qnil, 5626 Qnil,
5634 doc: /* *Width of left marginal area for display of a buffer. 5627 doc: /* Width of left marginal area for display of a buffer.
5635A value of nil means no marginal area. */); 5628A value of nil means no marginal area. */);
5636 5629
5637 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), 5630 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols),
5638 Qnil, 5631 Qnil,
5639 doc: /* *Width of right marginal area for display of a buffer. 5632 doc: /* Width of right marginal area for display of a buffer.
5640A value of nil means no marginal area. */); 5633A value of nil means no marginal area. */);
5641 5634
5642 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), 5635 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width),
5643 Qnil, 5636 Qnil,
5644 doc: /* *Width of this buffer's left fringe (in pixels). 5637 doc: /* Width of this buffer's left fringe (in pixels).
5645A value of 0 means no left fringe is shown in this buffer's window. 5638A value of 0 means no left fringe is shown in this buffer's window.
5646A value of nil means to use the left fringe width from the window's frame. */); 5639A value of nil means to use the left fringe width from the window's frame. */);
5647 5640
5648 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), 5641 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width),
5649 Qnil, 5642 Qnil,
5650 doc: /* *Width of this buffer's right fringe (in pixels). 5643 doc: /* Width of this buffer's right fringe (in pixels).
5651A value of 0 means no right fringe is shown in this buffer's window. 5644A value of 0 means no right fringe is shown in this buffer's window.
5652A value of nil means to use the right fringe width from the window's frame. */); 5645A value of nil means to use the right fringe width from the window's frame. */);
5653 5646
5654 DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins), 5647 DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins),
5655 Qnil, 5648 Qnil,
5656 doc: /* *Non-nil means to display fringes outside display margins. 5649 doc: /* Non-nil means to display fringes outside display margins.
5657A value of nil means to display fringes between margins and buffer text. */); 5650A value of nil means to display fringes between margins and buffer text. */);
5658 5651
5659 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), 5652 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
5660 Qnil, 5653 Qnil,
5661 doc: /* *Width of this buffer's scroll bars in pixels. 5654 doc: /* Width of this buffer's scroll bars in pixels.
5662A value of nil means to use the scroll bar width from the window's frame. */); 5655A value of nil means to use the scroll bar width from the window's frame. */);
5663 5656
5664 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), 5657 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),
5665 Qnil, 5658 Qnil,
5666 doc: /* *Position of this buffer's vertical scroll bar. 5659 doc: /* Position of this buffer's vertical scroll bar.
5667The value takes effect whenever you tell a window to display this buffer; 5660The value takes effect whenever you tell a window to display this buffer;
5668for instance, with `set-window-buffer' or when `display-buffer' displays it. 5661for instance, with `set-window-buffer' or when `display-buffer' displays it.
5669 5662
@@ -5673,13 +5666,13 @@ A value of t (the default) means do whatever the window's frame specifies. */);
5673 5666
5674 DEFVAR_PER_BUFFER ("indicate-empty-lines", 5667 DEFVAR_PER_BUFFER ("indicate-empty-lines",
5675 &BVAR (current_buffer, indicate_empty_lines), Qnil, 5668 &BVAR (current_buffer, indicate_empty_lines), Qnil,
5676 doc: /* *Visually indicate empty lines after the buffer end. 5669 doc: /* Visually indicate empty lines after the buffer end.
5677If non-nil, a bitmap is displayed in the left fringe of a window on 5670If non-nil, a bitmap is displayed in the left fringe of a window on
5678window-systems. */); 5671window-systems. */);
5679 5672
5680 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", 5673 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
5681 &BVAR (current_buffer, indicate_buffer_boundaries), Qnil, 5674 &BVAR (current_buffer, indicate_buffer_boundaries), Qnil,
5682 doc: /* *Visually indicate buffer boundaries and scrolling. 5675 doc: /* Visually indicate buffer boundaries and scrolling.
5683If non-nil, the first and last line of the buffer are marked in the fringe 5676If non-nil, the first and last line of the buffer are marked in the fringe
5684of a window on window-systems with angle bitmaps, or if the window can be 5677of a window on window-systems with angle bitmaps, or if the window can be
5685scrolled, the top and bottom line of the window are marked with up and down 5678scrolled, the top and bottom line of the window are marked with up and down
@@ -5704,7 +5697,7 @@ fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */);
5704 5697
5705 DEFVAR_PER_BUFFER ("fringe-indicator-alist", 5698 DEFVAR_PER_BUFFER ("fringe-indicator-alist",
5706 &BVAR (current_buffer, fringe_indicator_alist), Qnil, 5699 &BVAR (current_buffer, fringe_indicator_alist), Qnil,
5707 doc: /* *Mapping from logical to physical fringe indicator bitmaps. 5700 doc: /* Mapping from logical to physical fringe indicator bitmaps.
5708The value is an alist where each element (INDICATOR . BITMAPS) 5701The value is an alist where each element (INDICATOR . BITMAPS)
5709specifies the fringe bitmaps used to display a specific logical 5702specifies the fringe bitmaps used to display a specific logical
5710fringe indicator. 5703fringe indicator.
@@ -5723,7 +5716,7 @@ symbol which is used in both left and right fringes. */);
5723 5716
5724 DEFVAR_PER_BUFFER ("fringe-cursor-alist", 5717 DEFVAR_PER_BUFFER ("fringe-cursor-alist",
5725 &BVAR (current_buffer, fringe_cursor_alist), Qnil, 5718 &BVAR (current_buffer, fringe_cursor_alist), Qnil,
5726 doc: /* *Mapping from logical to physical fringe cursor bitmaps. 5719 doc: /* Mapping from logical to physical fringe cursor bitmaps.
5727The value is an alist where each element (CURSOR . BITMAP) 5720The value is an alist where each element (CURSOR . BITMAP)
5728specifies the fringe bitmaps used to display a specific logical 5721specifies the fringe bitmaps used to display a specific logical
5729cursor type in the fringe. 5722cursor type in the fringe.
@@ -5887,7 +5880,7 @@ set when a file is visited. */);
5887 5880
5888 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", 5881 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format",
5889 &BVAR (current_buffer, auto_save_file_format), Qnil, 5882 &BVAR (current_buffer, auto_save_file_format), Qnil,
5890 doc: /* *Format in which to write auto-save files. 5883 doc: /* Format in which to write auto-save files.
5891Should be a list of symbols naming formats that are defined in `format-alist'. 5884Should be a list of symbols naming formats that are defined in `format-alist'.
5892If it is t, which is the default, auto-save files are written in the 5885If it is t, which is the default, auto-save files are written in the
5893same format as a regular save would use. */); 5886same format as a regular save would use. */);
@@ -5937,7 +5930,7 @@ Lisp programs may give this variable certain special values:
5937 Vtransient_mark_mode = Qnil; 5930 Vtransient_mark_mode = Qnil;
5938 5931
5939 DEFVAR_LISP ("inhibit-read-only", Vinhibit_read_only, 5932 DEFVAR_LISP ("inhibit-read-only", Vinhibit_read_only,
5940 doc: /* *Non-nil means disregard read-only status of buffers or characters. 5933 doc: /* Non-nil means disregard read-only status of buffers or characters.
5941If the value is t, disregard `buffer-read-only' and all `read-only' 5934If the value is t, disregard `buffer-read-only' and all `read-only'
5942text properties. If the value is a list, disregard `buffer-read-only' 5935text properties. If the value is a list, disregard `buffer-read-only'
5943and disregard a `read-only' text property if the property value 5936and disregard a `read-only' text property if the property value
@@ -5972,7 +5965,7 @@ to the default frame line height. A value of nil means add no extra space. */)
5972 5965
5973 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", 5966 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows",
5974 &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil, 5967 &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil,
5975 doc: /* *Non-nil means show a cursor in non-selected windows. 5968 doc: /* Non-nil means show a cursor in non-selected windows.
5976If nil, only shows a cursor in the selected window. 5969If nil, only shows a cursor in the selected window.
5977If t, displays a cursor related to the usual cursor type 5970If t, displays a cursor related to the usual cursor type
5978\(a solid box becomes hollow, a bar becomes a narrower bar). 5971\(a solid box becomes hollow, a bar becomes a narrower bar).
@@ -5995,7 +5988,7 @@ The function `kill-all-local-variables' runs this before doing anything else. *
5995 doc: /* Hook run when the buffer list changes. 5988 doc: /* Hook run when the buffer list changes.
5996Functions running this hook are `get-buffer-create', 5989Functions running this hook are `get-buffer-create',
5997`make-indirect-buffer', `rename-buffer', `kill-buffer', 5990`make-indirect-buffer', `rename-buffer', `kill-buffer',
5998`record-buffer' and `unrecord-buffer'. */); 5991and `bury-buffer-internal'. */);
5999 Vbuffer_list_update_hook = Qnil; 5992 Vbuffer_list_update_hook = Qnil;
6000 DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook"); 5993 DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook");
6001 5994