diff options
| author | Eli Zaretskii | 2009-12-31 15:04:11 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2009-12-31 15:04:11 -0500 |
| commit | f44e260c0263804c89335f21f2778e36b3af351f (patch) | |
| tree | 0033199644b6fa1248e8050a08fcf1ff4da7abb7 /src | |
| parent | b7b65b15091c57cf5b5c28caeac83aded8f5e9aa (diff) | |
| download | emacs-f44e260c0263804c89335f21f2778e36b3af351f.tar.gz emacs-f44e260c0263804c89335f21f2778e36b3af351f.zip | |
Retrospective commit from 2009-08-15.
Start of work on bidi Emacs 23/24.
bidi.c (bidi_initialize): Fix initialization of bidi_type_table.
xdisp.c (set_iterator_to_next): Fix position setting after call
to bidi_get_next_char_visually.
bidi.c: Include stdio.h unconditionally. Fix and elaborate
commentary. Add Copyright blurb.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog.bidi | 10 | ||||
| -rw-r--r-- | src/Makefile.in | 5 | ||||
| -rw-r--r-- | src/bidi.c | 4 | ||||
| -rw-r--r-- | src/buffer.c | 40 | ||||
| -rw-r--r-- | src/buffer.h | 10 | ||||
| -rw-r--r-- | src/dispextern.h | 5 | ||||
| -rw-r--r-- | src/dispnew.c | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 13 |
8 files changed, 56 insertions, 39 deletions
diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi index 415e6a5c468..9d2d643ae57 100644 --- a/src/ChangeLog.bidi +++ b/src/ChangeLog.bidi | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2009-08-15 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * bidi.c (bidi_initialize): Fix initialization of bidi_type_table. | ||
| 4 | |||
| 5 | * xdisp.c (set_iterator_to_next): Fix position setting after call | ||
| 6 | to bidi_get_next_char_visually. | ||
| 7 | |||
| 1 | 2005-12-03 Eli Zaretskii <eliz@gnu.org> | 8 | 2005-12-03 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * bidi.c: Include stdio.h unconditionally. Fix and elaborate | 10 | * bidi.c: Include stdio.h unconditionally. Fix and elaborate |
| @@ -11,7 +18,8 @@ | |||
| 11 | 18 | ||
| 12 | 2004-03-04 Kenichi Handa <handa@m17n.org> | 19 | 2004-03-04 Kenichi Handa <handa@m17n.org> |
| 13 | 20 | ||
| 14 | The following changes are to support bidirectional text display. | 21 | The following changes are to support for bi-directional text |
| 22 | display. | ||
| 15 | 23 | ||
| 16 | * Makefile.in (obj): Include bidi.o. | 24 | * Makefile.in (obj): Include bidi.o. |
| 17 | (bidi.o): New target. | 25 | (bidi.o): New target. |
diff --git a/src/Makefile.in b/src/Makefile.in index f5b7133a7ae..60e7ac1ee0f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -560,8 +560,7 @@ FONT_DRIVERS = xfont.o | |||
| 560 | /* lastfile must follow all files | 560 | /* lastfile must follow all files |
| 561 | whose initialized data areas should be dumped as pure by dump-emacs. */ | 561 | whose initialized data areas should be dumped as pure by dump-emacs. */ |
| 562 | obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ | 562 | obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ |
| 563 | bidi.o \ | 563 | charset.o coding.o category.o ccl.o character.o chartab.o bidi.o \ |
| 564 | charset.o coding.o category.o ccl.o character.o chartab.o \ | ||
| 565 | cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \ | 564 | cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \ |
| 566 | emacs.o keyboard.o macros.o keymap.o sysdep.o \ | 565 | emacs.o keyboard.o macros.o keymap.o sysdep.o \ |
| 567 | buffer.o filelock.o insdel.o marker.o \ | 566 | buffer.o filelock.o insdel.o marker.o \ |
| @@ -1053,7 +1052,7 @@ doc.o: buildobj.h | |||
| 1053 | 1052 | ||
| 1054 | atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \ | 1053 | atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \ |
| 1055 | $(config_h) | 1054 | $(config_h) |
| 1056 | bidi.o: bidi.c buffer.h character.h | 1055 | bidi.o: bidi.c buffer.h character.h dispextern.h |
| 1057 | buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \ | 1056 | buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \ |
| 1058 | $(INTERVALS_H) blockinput.h atimer.h systime.h character.h \ | 1057 | $(INTERVALS_H) blockinput.h atimer.h systime.h character.h \ |
| 1059 | indent.h keyboard.h coding.h keymap.h frame.h lisp.h $(config_h) | 1058 | indent.h keyboard.h coding.h keymap.h frame.h lisp.h $(config_h) |
diff --git a/src/bidi.c b/src/bidi.c index 2a3a9706767..46382b2b66c 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -155,6 +155,7 @@ int bidi_ignore_explicit_marks_for_paragraph_level = 1; | |||
| 155 | 155 | ||
| 156 | bidi_dir_t bidi_overriding_paragraph_direction = NEUTRAL_DIR; | 156 | bidi_dir_t bidi_overriding_paragraph_direction = NEUTRAL_DIR; |
| 157 | 157 | ||
| 158 | /* FIXME: Unused? */ | ||
| 158 | #define ASCII_BIDI_TYPE_SET(STR, TYPE) \ | 159 | #define ASCII_BIDI_TYPE_SET(STR, TYPE) \ |
| 159 | do { \ | 160 | do { \ |
| 160 | unsigned char *p; \ | 161 | unsigned char *p; \ |
| @@ -448,7 +449,8 @@ bidi_initialize () | |||
| 448 | bidi_type_table = Fmake_char_table (Qnil, make_number (STRONG_L)); | 449 | bidi_type_table = Fmake_char_table (Qnil, make_number (STRONG_L)); |
| 449 | 450 | ||
| 450 | for (i = 0; i < sizeof bidi_type / sizeof bidi_type[0]; i++) | 451 | for (i = 0; i < sizeof bidi_type / sizeof bidi_type[0]; i++) |
| 451 | char_table_set_range (bidi_type_table, bidi_type[i].from, bidi_type[i].to, | 452 | char_table_set_range (bidi_type_table, bidi_type[i].from, |
| 453 | bidi_type[i].to ? bidi_type[i].to : bidi_type[i].from, | ||
| 452 | make_number (bidi_type[i].type)); | 454 | make_number (bidi_type[i].type)); |
| 453 | bidi_initialized = 1; | 455 | bidi_initialized = 1; |
| 454 | } | 456 | } |
diff --git a/src/buffer.c b/src/buffer.c index 35e1f4d22ec..2930465834d 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5186,8 +5186,8 @@ init_buffer_once () | |||
| 5186 | buffer_defaults.truncate_lines = Qnil; | 5186 | buffer_defaults.truncate_lines = Qnil; |
| 5187 | buffer_defaults.word_wrap = Qnil; | 5187 | buffer_defaults.word_wrap = Qnil; |
| 5188 | buffer_defaults.ctl_arrow = Qt; | 5188 | buffer_defaults.ctl_arrow = Qt; |
| 5189 | buffer_defaults.enable_bidi_display = Qnil; | 5189 | buffer_defaults.bidi_display_reordering = Qnil; |
| 5190 | buffer_defaults.orientation_reversed = Qnil; | 5190 | buffer_defaults.direction_reversed = Qnil; |
| 5191 | buffer_defaults.cursor_type = Qt; | 5191 | buffer_defaults.cursor_type = Qt; |
| 5192 | buffer_defaults.extra_line_spacing = Qnil; | 5192 | buffer_defaults.extra_line_spacing = Qnil; |
| 5193 | buffer_defaults.cursor_in_non_selected_windows = Qt; | 5193 | buffer_defaults.cursor_in_non_selected_windows = Qt; |
| @@ -5272,8 +5272,8 @@ init_buffer_once () | |||
| 5272 | XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx; | 5272 | XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx; |
| 5273 | XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; | 5273 | XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; |
| 5274 | XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; | 5274 | XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; |
| 5275 | XSETFASTINT (buffer_local_flags.enable_bidi_display, idx); ++idx; | 5275 | XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; |
| 5276 | XSETFASTINT (buffer_local_flags.orientation_reversed, idx); ++idx; | 5276 | XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx; |
| 5277 | XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); | 5277 | XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); |
| 5278 | /* Make this one a permanent local. */ | 5278 | /* Make this one a permanent local. */ |
| 5279 | buffer_permanent_local_flags[idx++] = 1; | 5279 | buffer_permanent_local_flags[idx++] = 1; |
| @@ -5530,15 +5530,15 @@ This is the same as (default-value 'abbrev-mode). */); | |||
| 5530 | doc: /* Default value of `ctl-arrow' for buffers that do not override it. | 5530 | doc: /* Default value of `ctl-arrow' for buffers that do not override it. |
| 5531 | This is the same as (default-value 'ctl-arrow). */); | 5531 | This is the same as (default-value 'ctl-arrow). */); |
| 5532 | 5532 | ||
| 5533 | DEFVAR_LISP_NOPRO ("default-enable-bidi-display", | 5533 | DEFVAR_LISP_NOPRO ("default-bidi-display-reordering", |
| 5534 | &buffer_defaults.enable_bidi_display, | 5534 | &buffer_defaults.bidi_display_reordering, |
| 5535 | doc: /* *Default value of `enable-bidi-display' for buffers not overriding it. | 5535 | doc: /* *Default value of `bidi-display-reordering' for buffers not overriding it. |
| 5536 | This is the same as (default-value 'enable-bidi-display). */); | 5536 | This is the same as (default-value 'bidi-display-reordering). */); |
| 5537 | 5537 | ||
| 5538 | DEFVAR_LISP_NOPRO ("default-orientation-reversed", | 5538 | DEFVAR_LISP_NOPRO ("default-direction-reversed", |
| 5539 | &buffer_defaults.orientation_reversed, | 5539 | &buffer_defaults.direction_reversed, |
| 5540 | doc: /* *Default value of `orientation-reversed' for buffers that do not override it. | 5540 | doc: /* Default value of `direction-reversed' for buffers that do not override it. |
| 5541 | This is the same as (default-value 'orientation-reversed). */); | 5541 | This is the same as (default-value 'direction-reversed). */); |
| 5542 | 5542 | ||
| 5543 | DEFVAR_LISP_NOPRO ("default-enable-multibyte-characters", | 5543 | DEFVAR_LISP_NOPRO ("default-enable-multibyte-characters", |
| 5544 | &buffer_defaults.enable_multibyte_characters, | 5544 | &buffer_defaults.enable_multibyte_characters, |
| @@ -5796,15 +5796,15 @@ The variable `coding-system-for-write', if non-nil, overrides this variable. | |||
| 5796 | 5796 | ||
| 5797 | This variable is never applied to a way of decoding a file while reading it. */); | 5797 | This variable is never applied to a way of decoding a file while reading it. */); |
| 5798 | 5798 | ||
| 5799 | DEFVAR_PER_BUFFER ("orientation-reversed", | 5799 | DEFVAR_PER_BUFFER ("direction-reversed", |
| 5800 | ¤t_buffer->orientation_reversed, Qnil, | 5800 | ¤t_buffer->direction_reversed, Qnil, |
| 5801 | doc: /* Non-nil means set beginning of lines at the right end of the window. | 5801 | doc: /* Non-nil means set beginning of lines at the right edge of the window. |
| 5802 | See also the variable `enable-bidi-display'. */); | 5802 | See also the variable `bidi-display-reordering'. */); |
| 5803 | 5803 | ||
| 5804 | DEFVAR_PER_BUFFER ("enable-bidi-display", | 5804 | DEFVAR_PER_BUFFER ("bidi-display-reordering", |
| 5805 | ¤t_buffer->enable_bidi_display, Qnil, | 5805 | ¤t_buffer->bidi_display_reordering, Qnil, |
| 5806 | doc: /*Non-nil means display bidi text in correct visual order. | 5806 | doc: /*Non-nil means reorder bidirectional text for display in the visual order. |
| 5807 | See also the variable `orientation-reversed'. */); | 5807 | See also the variable `direction-reversed'. */); |
| 5808 | 5808 | ||
| 5809 | DEFVAR_PER_BUFFER ("truncate-lines", ¤t_buffer->truncate_lines, Qnil, | 5809 | DEFVAR_PER_BUFFER ("truncate-lines", ¤t_buffer->truncate_lines, Qnil, |
| 5810 | doc: /* *Non-nil means do not display continuation lines. | 5810 | doc: /* *Non-nil means do not display continuation lines. |
diff --git a/src/buffer.h b/src/buffer.h index 8197ac6328c..c870f923e87 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -658,10 +658,12 @@ struct buffer | |||
| 658 | Lisp_Object word_wrap; | 658 | Lisp_Object word_wrap; |
| 659 | /* Non-nil means display ctl chars with uparrow. */ | 659 | /* Non-nil means display ctl chars with uparrow. */ |
| 660 | Lisp_Object ctl_arrow; | 660 | Lisp_Object ctl_arrow; |
| 661 | /* Non-nil means display bidi text in correct visual order. */ | 661 | /* Non-nil means reorder bidirectional text for display in the |
| 662 | Lisp_Object enable_bidi_display; | 662 | visual order. */ |
| 663 | /* Non-nil means set beginning of lines at the right end of windows. */ | 663 | Lisp_Object bidi_display_reordering; |
| 664 | Lisp_Object orientation_reversed; | 664 | /* Non-nil means set beginning of lines at the right edge of |
| 665 | windows. */ | ||
| 666 | Lisp_Object direction_reversed; | ||
| 665 | /* Non-nil means do selective display; | 667 | /* Non-nil means do selective display; |
| 666 | see doc string in syms_of_buffer (buffer.c) for details. */ | 668 | see doc string in syms_of_buffer (buffer.c) for details. */ |
| 667 | Lisp_Object selective_display; | 669 | Lisp_Object selective_display; |
diff --git a/src/dispextern.h b/src/dispextern.h index 0b3310c8f69..3cc1c83c7e3 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2307,10 +2307,11 @@ struct it | |||
| 2307 | /* Face of the right fringe glyph. */ | 2307 | /* Face of the right fringe glyph. */ |
| 2308 | unsigned right_user_fringe_face_id : FACE_ID_BITS; | 2308 | unsigned right_user_fringe_face_id : FACE_ID_BITS; |
| 2309 | 2309 | ||
| 2310 | /* 1 means we need bidi processing. */ | 2310 | /* Non-zero means we need to reorder bidirectional text for display |
| 2311 | in the visual order. */ | ||
| 2311 | int bidi_p; | 2312 | int bidi_p; |
| 2312 | 2313 | ||
| 2313 | /* For iterating over bidi text. */ | 2314 | /* For iterating over bidirectional text. */ |
| 2314 | struct bidi_it bidi_it; | 2315 | struct bidi_it bidi_it; |
| 2315 | }; | 2316 | }; |
| 2316 | 2317 | ||
diff --git a/src/dispnew.c b/src/dispnew.c index a6984d96a15..d8cab59dbe9 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3776,12 +3776,12 @@ direct_output_forward_char (n) | |||
| 3776 | if (!display_completed || cursor_in_echo_area) | 3776 | if (!display_completed || cursor_in_echo_area) |
| 3777 | return 0; | 3777 | return 0; |
| 3778 | 3778 | ||
| 3779 | /* Give up if we need bidi display. */ | 3779 | /* Give up if we need to reorder bidirectional text. */ |
| 3780 | if (!NILP (XBUFFER (w->buffer)->enable_bidi_display)) | 3780 | if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)) |
| 3781 | return 0; | 3781 | return 0; |
| 3782 | 3782 | ||
| 3783 | /* Give up if the buffer's orientation is reversed. */ | 3783 | /* Give up if the buffer's direction is reversed. */ |
| 3784 | if (!NILP (XBUFFER (w->buffer)->orientation_reversed)) | 3784 | if (!NILP (XBUFFER (w->buffer)->direction_reversed)) |
| 3785 | return 0; | 3785 | return 0; |
| 3786 | 3786 | ||
| 3787 | /* Can't use direct output if highlighting a region. */ | 3787 | /* Can't use direct output if highlighting a region. */ |
diff --git a/src/xdisp.c b/src/xdisp.c index 560ca38e2d0..bd9300a40a2 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2658,8 +2658,8 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) | |||
| 2658 | /* Are multibyte characters enabled in current_buffer? */ | 2658 | /* Are multibyte characters enabled in current_buffer? */ |
| 2659 | it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); | 2659 | it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); |
| 2660 | 2660 | ||
| 2661 | /* Do we need multibyte processing? */ | 2661 | /* Do we need to reorded bidirectional text? */ |
| 2662 | it->bidi_p = !NILP (current_buffer->enable_bidi_display); | 2662 | it->bidi_p = !NILP (current_buffer->bidi_display_reordering); |
| 2663 | 2663 | ||
| 2664 | /* Non-zero if we should highlight the region. */ | 2664 | /* Non-zero if we should highlight the region. */ |
| 2665 | highlight_region_p | 2665 | highlight_region_p |
| @@ -5520,6 +5520,11 @@ reseat_1 (it, pos, set_stop_p) | |||
| 5520 | 5520 | ||
| 5521 | if (it->bidi_p) | 5521 | if (it->bidi_p) |
| 5522 | { | 5522 | { |
| 5523 | /* FIXME: L2R below is just for easyness of testing, as we | ||
| 5524 | currently support only left-to-right paragraphs. The value | ||
| 5525 | should be user-definable and/or come from some ``higher | ||
| 5526 | protocol''. In the absence of any other guidance, the default | ||
| 5527 | for this initialization should be NEUTRAL_DIR. */ | ||
| 5523 | bidi_init_it (pos.charpos - 1, L2R, &it->bidi_it); | 5528 | bidi_init_it (pos.charpos - 1, L2R, &it->bidi_it); |
| 5524 | bidi_get_next_char_visually (&it->bidi_it); | 5529 | bidi_get_next_char_visually (&it->bidi_it); |
| 5525 | 5530 | ||
| @@ -6100,8 +6105,8 @@ set_iterator_to_next (it, reseat_p) | |||
| 6100 | else | 6105 | else |
| 6101 | { | 6106 | { |
| 6102 | bidi_get_next_char_visually (&it->bidi_it); | 6107 | bidi_get_next_char_visually (&it->bidi_it); |
| 6103 | IT_BYTEPOS (*it) = it->bidi_it.charpos; | 6108 | IT_BYTEPOS (*it) = it->bidi_it.bytepos; |
| 6104 | IT_CHARPOS (*it) = it->bidi_it.bytepos; | 6109 | IT_CHARPOS (*it) = it->bidi_it.charpos; |
| 6105 | } | 6110 | } |
| 6106 | xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it))); | 6111 | xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it))); |
| 6107 | } | 6112 | } |