Merge from mainline.
authorEli Zaretskii <eliz@gnu.org>
Sat, 6 Mar 2010 10:16:27 +0000 (05:16 -0500)
committerEli Zaretskii <eliz@gnu.org>
Sat, 6 Mar 2010 10:16:27 +0000 (05:16 -0500)
1  2 
src/buffer.c

diff --combined src/buffer.c
@@@ -2279,8 -2279,6 +2279,8 @@@ DEFUN ("buffer-swap-text", Fbuffer_swap
    swapfield (undo_list, Lisp_Object);
    swapfield (mark, Lisp_Object);
    swapfield (enable_multibyte_characters, Lisp_Object);
 +  swapfield (bidi_display_reordering, Lisp_Object);
 +  swapfield (bidi_paragraph_direction, Lisp_Object);
    /* FIXME: Not sure what we should do with these *_marker fields.
       Hopefully they're just nil anyway.  */
    swapfield (pt_marker, Lisp_Object);
@@@ -2499,7 -2497,9 +2499,9 @@@ current buffer is cleared.  */
  
          if (ASCII_BYTE_P (*p))
            p++, pos++;
-         else if (EQ (flag, Qt) && (bytes = MULTIBYTE_LENGTH (p, pend)) > 0)
+         else if (EQ (flag, Qt)
+                  && ! CHAR_BYTE8_HEAD_P (*p)
+                  && (bytes = MULTIBYTE_LENGTH (p, pend)) > 0)
            p += bytes, pos += bytes;
          else
            {
@@@ -5206,9 -5206,7 +5208,9 @@@ init_buffer_once (
    buffer_defaults.truncate_lines = Qnil;
    buffer_defaults.word_wrap = Qnil;
    buffer_defaults.ctl_arrow = Qt;
 +  buffer_defaults.bidi_display_reordering = Qnil;
    buffer_defaults.direction_reversed = Qnil;
 +  buffer_defaults.bidi_paragraph_direction = Qnil;
    buffer_defaults.cursor_type = Qt;
    buffer_defaults.extra_line_spacing = Qnil;
    buffer_defaults.cursor_in_non_selected_windows = Qt;
    XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx;
    XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx;
    XSETFASTINT (buffer_local_flags.category_table, idx); ++idx;
 +  XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx;
    XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx;
 +  XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx;
    XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx);
    /* Make this one a permanent local.  */
    buffer_permanent_local_flags[idx++] = 1;
@@@ -5552,6 -5548,11 +5554,6 @@@ This is the same as (default-value 'abb
                     doc: /* Default value of `ctl-arrow' for buffers that do not override it.
  This is the same as (default-value 'ctl-arrow).  */);
  
 -  DEFVAR_LISP_NOPRO ("default-direction-reversed",
 -                     &buffer_defaults.direction_reversed,
 -                     doc: /* Default value of `direction-reversed' for buffers that do not override it.
 -This is the same as (default-value 'direction-reversed).  */);
 -
    DEFVAR_LISP_NOPRO ("default-enable-multibyte-characters",
                       &buffer_defaults.enable_multibyte_characters,
                       doc: /* *Default value of `enable-multibyte-characters' for buffers not overriding it.
@@@ -5808,29 -5809,11 +5810,29 @@@ The variable `coding-system-for-write'
  
  This variable is never applied to a way of decoding a file while reading it.  */);
  
 -  DEFVAR_PER_BUFFER ("direction-reversed", &current_buffer->direction_reversed,
 -                   Qnil,
 -                   doc: /* *Non-nil means lines in the buffer are displayed right to left.  */);
 -
 -  DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines, Qnil,
 +  DEFVAR_PER_BUFFER ("direction-reversed",
 +                   &current_buffer->direction_reversed, Qnil,
 +                   doc: /* Non-nil means set beginning of lines at the right edge of the window.
 +See also the variable `bidi-display-reordering'.  */);
 +
 +  DEFVAR_PER_BUFFER ("bidi-display-reordering",
 +                   &current_buffer->bidi_display_reordering, Qnil,
 +                   doc: /* Non-nil means reorder bidirectional text for display in the visual order.
 +See also the variable `direction-reversed'.  */);
 +
 +  DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
 +                   &current_buffer->bidi_paragraph_direction, Qnil,
 +                   doc: /* *If non-nil, forces directionality of text paragraphs in the buffer.
 +                           
 +If this is nil (the default), the direction of each paragraph is
 +determined by the first strong directional character of its text.
 +The values of `right-to-left' and `left-to-right' override that.
 +Any other value is treated as nil.
 +                           
 +This variable has no effect unless the buffer's value of
 +\`bidi-display-reordering' is non-nil.  */);
 +
 + DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines, Qnil,
                     doc: /* *Non-nil means do not display continuation lines.
  Instead, give each line of text just one screen line.